diff --git a/.build/jsonSchema.ts b/.build/jsonSchema.ts index 7a700c1e2..48a9883de 100644 --- a/.build/jsonSchema.ts +++ b/.build/jsonSchema.ts @@ -27,6 +27,7 @@ const MERMAID_CONFIG_DIAGRAM_KEYS = [ 'block', 'packet', 'architecture', + 'radar', ] as const; /** diff --git a/.changeset/angry-bags-brake.md b/.changeset/angry-bags-brake.md deleted file mode 100644 index 472e486ec..000000000 --- a/.changeset/angry-bags-brake.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'mermaid': patch ---- - -fix: architecture diagrams no longer grow to extreme heights due to conflicting alignments diff --git a/.changeset/bright-ads-exist.md b/.changeset/bright-ads-exist.md deleted file mode 100644 index ef2f76f4c..000000000 --- a/.changeset/bright-ads-exist.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'mermaid': patch ---- - -Fixes for consistent edge id creation & handling edge cases for animate edge feature diff --git a/.changeset/chatty-elephants-warn.md b/.changeset/chatty-elephants-warn.md deleted file mode 100644 index 225047ece..000000000 --- a/.changeset/chatty-elephants-warn.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'mermaid': patch ---- - -Fix for issue #6195 - allowing @ signs inside node labels diff --git a/.changeset/chilly-years-cheat.md b/.changeset/chilly-years-cheat.md deleted file mode 100644 index e665af75b..000000000 --- a/.changeset/chilly-years-cheat.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'mermaid': patch ---- - -fix: `mermaidAPI.getDiagramFromText()` now returns a new different db for each class diagram diff --git a/.changeset/dull-tips-cough.md b/.changeset/dull-tips-cough.md deleted file mode 100644 index 1f5179417..000000000 --- a/.changeset/dull-tips-cough.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'mermaid': patch ---- - -fix: revert state db to resolve getData returning empty nodes and edges diff --git a/.changeset/gold-shoes-camp.md b/.changeset/gold-shoes-camp.md new file mode 100644 index 000000000..3018e7381 --- /dev/null +++ b/.changeset/gold-shoes-camp.md @@ -0,0 +1,5 @@ +--- +'mermaid': patch +--- + +fix: Remove incorrect `style="undefined;"` attributes in some Mermaid diagrams diff --git a/.changeset/great-ghosts-rule.md b/.changeset/great-ghosts-rule.md deleted file mode 100644 index f11c6e2a9..000000000 --- a/.changeset/great-ghosts-rule.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -'mermaid': minor ---- - -Flowchart new syntax for node metadata bugs - -- Incorrect label mapping for nodes when using `&` -- Syntax error when `}` with trailing spaces before new line diff --git a/.changeset/grumpy-cheetahs-deliver.md b/.changeset/grumpy-cheetahs-deliver.md deleted file mode 100644 index fa6736d42..000000000 --- a/.changeset/grumpy-cheetahs-deliver.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'mermaid': patch ---- - -`mermaidAPI.getDiagramFromText()` now returns a new db instance on each call for state diagrams diff --git a/.changeset/heavy-moose-mix.md b/.changeset/heavy-moose-mix.md deleted file mode 100644 index c02d62446..000000000 --- a/.changeset/heavy-moose-mix.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'mermaid': patch ---- - -Added versioning to StateDB and updated tests and diagrams to use it. diff --git a/.changeset/honest-trees-dress.md b/.changeset/honest-trees-dress.md new file mode 100644 index 000000000..054f1bedb --- /dev/null +++ b/.changeset/honest-trees-dress.md @@ -0,0 +1,7 @@ +--- +'@mermaid-js/mermaid-zenuml': patch +--- + +chore: bump minimum ZenUML version to 3.23.28 + +commit: 9d06d8f31e7f12af9e9e092214f907f2dc93ad75 diff --git a/.changeset/many-brooms-promise.md b/.changeset/many-brooms-promise.md deleted file mode 100644 index fec442b34..000000000 --- a/.changeset/many-brooms-promise.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'mermaid': minor ---- - -Adding support for animation of flowchart edges diff --git a/.changeset/new-kiwis-listen.md b/.changeset/new-kiwis-listen.md deleted file mode 100644 index 24306573c..000000000 --- a/.changeset/new-kiwis-listen.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'mermaid': patch ---- - -fix: `mermaidAPI.getDiagramFromText()` now returns a new different db for each flowchart diff --git a/.changeset/sad-mails-accept.md b/.changeset/sad-mails-accept.md new file mode 100644 index 000000000..11dd69d8d --- /dev/null +++ b/.changeset/sad-mails-accept.md @@ -0,0 +1,6 @@ +--- +'mermaid': patch +'@mermaid-js/parser': patch +--- + +Refactor grammar so that title don't break Architecture Diagrams diff --git a/.changeset/silver-olives-marry.md b/.changeset/silver-olives-marry.md deleted file mode 100644 index d709b17ba..000000000 --- a/.changeset/silver-olives-marry.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'mermaid': patch ---- - -fix: `mermaidAPI.getDiagramFromText()` now returns a new different db for each sequence diagram. Added unique IDs for messages. diff --git a/.changeset/stupid-dots-do.md b/.changeset/stupid-dots-do.md deleted file mode 100644 index 594fa9536..000000000 --- a/.changeset/stupid-dots-do.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'mermaid': patch ---- - -fix: Gantt, Sankey and User Journey diagram are now able to pick font-family from mermaid config. diff --git a/.changeset/weak-trees-perform.md b/.changeset/weak-trees-perform.md deleted file mode 100644 index 17175301d..000000000 --- a/.changeset/weak-trees-perform.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'mermaid': patch ---- - -fix: `getDirection` and `setDirection` in `stateDb` refactored to return and set actual direction diff --git a/.changeset/witty-crews-smell.md b/.changeset/witty-crews-smell.md deleted file mode 100644 index 4213083f2..000000000 --- a/.changeset/witty-crews-smell.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'mermaid': patch ---- - -`mermaidAPI.getDiagramFromText()` now returns a new different db for each state diagram diff --git a/.changeset/yellow-mirrors-change.md b/.changeset/yellow-mirrors-change.md new file mode 100644 index 000000000..09a766104 --- /dev/null +++ b/.changeset/yellow-mirrors-change.md @@ -0,0 +1,7 @@ +--- +'@mermaid-js/mermaid-zenuml': patch +--- + +fix(zenuml): limit `peerDependencies` to Mermaid v10 and v11 + +commit: 0ad44c12feead9d20c6a870a49327ada58d6e657 diff --git a/.esbuild/build.ts b/.esbuild/build.ts index 423e8f047..05002cb16 100644 --- a/.esbuild/build.ts +++ b/.esbuild/build.ts @@ -34,6 +34,19 @@ const buildPackage = async (entryName: keyof typeof packageOptions) => { { ...iifeOptions, minify: true, metafile: shouldVisualize } ); } + if (entryName === 'mermaid-zenuml') { + const iifeOptions: MermaidBuildOptions = { + ...commonOptions, + format: 'iife', + globalName: 'mermaid-zenuml', + }; + buildConfigs.push( + // mermaid-zenuml.js + { ...iifeOptions }, + // mermaid-zenuml.min.js + { ...iifeOptions, minify: true, metafile: shouldVisualize } + ); + } const results = await Promise.all(buildConfigs.map((option) => build(getBuildConfig(option)))); diff --git a/.esbuild/util.ts b/.esbuild/util.ts index 6d6d1d59b..dde0352af 100644 --- a/.esbuild/util.ts +++ b/.esbuild/util.ts @@ -58,6 +58,7 @@ export const getBuildConfig = (options: MermaidBuildOptions): BuildOptions => { format, minify, options: { name, file, packageName }, + globalName = 'mermaid', } = options; const external: string[] = ['require', 'fs', 'path']; const outFileName = getFileName(name, options); @@ -68,6 +69,7 @@ export const getBuildConfig = (options: MermaidBuildOptions): BuildOptions => { }, metafile, minify, + globalName, logLevel: 'info', chunkNames: `chunks/${outFileName}/[name]-[hash]`, define: { @@ -89,11 +91,12 @@ export const getBuildConfig = (options: MermaidBuildOptions): BuildOptions => { if (format === 'iife') { output.format = 'iife'; output.splitting = false; - output.globalName = '__esbuild_esm_mermaid'; + const originalGlobalName = output.globalName ?? 'mermaid'; + output.globalName = `__esbuild_esm_mermaid_nm[${JSON.stringify(originalGlobalName)}]`; // Workaround for removing the .default access in esbuild IIFE. // https://github.com/mermaid-js/mermaid/pull/4109#discussion_r1292317396 output.footer = { - js: 'globalThis.mermaid = globalThis.__esbuild_esm_mermaid.default;', + js: `globalThis[${JSON.stringify(originalGlobalName)}] = globalThis.${output.globalName}.default;`, }; output.outExtension = { '.js': '.js' }; } else { diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 6be6f3b5d..b7313b621 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -4,7 +4,7 @@ contact_links: url: https://github.com/mermaid-js/mermaid/discussions about: Ask the Community questions or share your own graphs in our discussions. - name: Discord - url: https://discord.gg/AgrbSrBer3 + url: https://discord.gg/sKeNQX4Wtj about: Join our Community on Discord for Help and a casual chat. - name: Documentation url: https://mermaid.js.org diff --git a/.github/workflows/autofix.yml b/.github/workflows/autofix.yml index 7280278d2..5b1066661 100644 --- a/.github/workflows/autofix.yml +++ b/.github/workflows/autofix.yml @@ -13,13 +13,13 @@ jobs: autofix: runs-on: ubuntu-latest steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 + - uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 # uses version from "packageManager" field in package.json - name: Setup Node.js - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 + uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 with: cache: pnpm node-version-file: '.node-version' diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index 79e9deea1..79ed53de1 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -18,12 +18,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 + - uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 - name: Setup Node.js - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 + uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 with: cache: pnpm node-version-file: '.node-version' diff --git a/.github/workflows/check-readme-in-sync.yml b/.github/workflows/check-readme-in-sync.yml index 5c940c087..ed5c70208 100644 --- a/.github/workflows/check-readme-in-sync.yml +++ b/.github/workflows/check-readme-in-sync.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Check for difference in README.md and docs/README.md run: | diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index a5cbbf8d5..a6400a86a 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -32,11 +32,11 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@f779452ac5af1c261dce0346a8f964149f49322b # v3.26.13 + uses: github/codeql-action/init@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3.28.10 with: config-file: ./.github/codeql/codeql-config.yml languages: ${{ matrix.language }} @@ -48,7 +48,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@f779452ac5af1c261dce0346a8f964149f49322b # v3.26.13 + uses: github/codeql-action/autobuild@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3.28.10 # โ„น๏ธ Command-line programs to run using the OS shell. # ๐Ÿ“š See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun @@ -62,4 +62,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@f779452ac5af1c261dce0346a8f964149f49322b # v3.26.13 + uses: github/codeql-action/analyze@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3.28.10 diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index dce9ad2b2..69c435631 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -15,6 +15,6 @@ jobs: runs-on: ubuntu-latest steps: - name: 'Checkout Repository' - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: 'Dependency Review' - uses: actions/dependency-review-action@a6993e2c61fd5dc440b409aa1d6904921c5e1894 # v4.3.5 + uses: actions/dependency-review-action@3b139cfc5fae8b618d3eae3675e383bb1769c019 # v4.5.0 diff --git a/.github/workflows/e2e-applitools.yml b/.github/workflows/e2e-applitools.yml index b1eb70674..9c357a581 100644 --- a/.github/workflows/e2e-applitools.yml +++ b/.github/workflows/e2e-applitools.yml @@ -32,13 +32,13 @@ jobs: run: | echo "::error,title=Not using Applitools::APPLITOOLS_API_KEY is empty, disabling Applitools for this run." - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 + - uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 # uses version from "packageManager" field in package.json - name: Setup Node.js - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 + uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 with: node-version-file: '.node-version' @@ -54,7 +54,7 @@ jobs: APPLITOOLS_SERVER_URL: 'https://eyesapi.applitools.com' - name: Cypress run - uses: cypress-io/github-action@d79d2d530a66e641eb4a5f227e13bc985c60b964 # v4.2.2 + uses: cypress-io/github-action@18a6541367f4580a515371905f499a27a44e8dbe # v6.7.12 id: cypress with: start: pnpm run dev diff --git a/.github/workflows/e2e-timings.yml b/.github/workflows/e2e-timings.yml index 42760e222..f45551988 100644 --- a/.github/workflows/e2e-timings.yml +++ b/.github/workflows/e2e-timings.yml @@ -11,6 +11,7 @@ concurrency: ${{ github.workflow }}-${{ github.ref }} permissions: contents: write + pull-requests: write jobs: timings: @@ -19,18 +20,19 @@ jobs: image: cypress/browsers:node-20.11.0-chrome-121.0.6167.85-1-ff-120.0-edge-121.0.2277.83-1 options: --user 1001 steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 - name: Setup Node.js - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 + uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 with: node-version-file: '.node-version' - name: Install dependencies - uses: cypress-io/github-action@57b70560982e6a11d23d4b8bec7f8a487cdbb71b # v6.7.8 + uses: cypress-io/github-action@18a6541367f4580a515371905f499a27a44e8dbe # v6.7.12 with: runTests: false + - name: Cypress run - uses: cypress-io/github-action@57b70560982e6a11d23d4b8bec7f8a487cdbb71b # v6.7.8 + uses: cypress-io/github-action@18a6541367f4580a515371905f499a27a44e8dbe # v6.7.12 id: cypress with: install: false @@ -44,10 +46,17 @@ jobs: SPLIT: 1 SPLIT_INDEX: 0 SPLIT_FILE: 'cypress/timings.json' - - name: Commit changes - uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4 + + - name: Compare timings + run: pnpm tsx scripts/compare-timings.ts + + - name: Commit and create pull request + uses: peter-evans/create-pull-request@a7b20e1da215b3ef3ccddb48ff65120256ed6226 with: - add: 'cypress/timings.json' - author_name: 'github-actions[bot]' - author_email: '41898282+github-actions[bot]@users.noreply.github.com' - message: 'chore: update E2E timings' + add-paths: | + cypress/timings.json + commit-message: 'chore: update E2E timings' + branch: update-timings + title: Update E2E Timings + delete-branch: true + sign-commits: true diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 4922da76f..56883b987 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -37,10 +37,10 @@ jobs: image: cypress/browsers:node-20.11.0-chrome-121.0.6167.85-1-ff-120.0-edge-121.0.2277.83-1 options: --user 1001 steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 - name: Setup Node.js - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 + uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 with: node-version-file: '.node-version' - name: Cache snapshots @@ -53,13 +53,13 @@ jobs: # If a snapshot for a given Hash is not found, we checkout that commit, run the tests and cache the snapshots. - name: Switch to base branch if: ${{ steps.cache-snapshot.outputs.cache-hit != 'true' }} - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: ref: ${{ env.targetHash }} - name: Install dependencies if: ${{ steps.cache-snapshot.outputs.cache-hit != 'true' }} - uses: cypress-io/github-action@57b70560982e6a11d23d4b8bec7f8a487cdbb71b # v6.7.8 + uses: cypress-io/github-action@18a6541367f4580a515371905f499a27a44e8dbe # v6.7.12 with: # just perform install runTests: false @@ -82,13 +82,13 @@ jobs: matrix: containers: [1, 2, 3, 4, 5] steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 + - uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 # uses version from "packageManager" field in package.json - name: Setup Node.js - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 + uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 with: node-version-file: '.node-version' @@ -101,7 +101,7 @@ jobs: key: ${{ runner.os }}-snapshots-${{ env.targetHash }} - name: Install dependencies - uses: cypress-io/github-action@57b70560982e6a11d23d4b8bec7f8a487cdbb71b # v6.7.8 + uses: cypress-io/github-action@18a6541367f4580a515371905f499a27a44e8dbe # v6.7.12 with: runTests: false @@ -117,7 +117,7 @@ jobs: # Install NPM dependencies, cache them correctly # and run all Cypress tests - name: Cypress run - uses: cypress-io/github-action@57b70560982e6a11d23d4b8bec7f8a487cdbb71b # v6.7.8 + uses: cypress-io/github-action@18a6541367f4580a515371905f499a27a44e8dbe # v6.7.12 id: cypress with: install: false @@ -139,7 +139,7 @@ jobs: VITEST_COVERAGE: true - name: Upload Coverage to Codecov - uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0 + uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1 # Run step only pushes to develop and pull_requests if: ${{ steps.cypress.conclusion == 'success' && (github.event_name == 'pull_request' || github.ref == 'refs/heads/develop')}} with: diff --git a/.github/workflows/link-checker.yml b/.github/workflows/link-checker.yml index d2f5d7744..f855ed23b 100644 --- a/.github/workflows/link-checker.yml +++ b/.github/workflows/link-checker.yml @@ -29,7 +29,7 @@ jobs: # lychee only uses the GITHUB_TOKEN to avoid rate-limiting contents: read steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Restore lychee cache uses: actions/cache@0c907a75c2c80ebcb7f088228285e798b750cf8f # v4.2.1 @@ -39,7 +39,7 @@ jobs: restore-keys: cache-lychee- - name: Link Checker - uses: lycheeverse/lychee-action@c053181aa0c3d17606addfe97a9075a32723548a # v1.9.3 + uses: lycheeverse/lychee-action@f613c4a64e50d792e0b31ec34bbcbba12263c6a6 # v2.3.0 with: args: >- --config .github/lychee.toml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 24e7ee35d..50edaa271 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -15,7 +15,7 @@ jobs: docker-lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - uses: hadolint/hadolint-action@54c9adbab1582c2ef04b2016b760714a4bfde3cf # v3.1.0 with: @@ -23,13 +23,13 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 + - uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 # uses version from "packageManager" field in package.json - name: Setup Node.js - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 + uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 with: cache: pnpm node-version-file: '.node-version' diff --git a/.github/workflows/pr-labeler.yml b/.github/workflows/pr-labeler.yml index c9faaa062..44860845f 100644 --- a/.github/workflows/pr-labeler.yml +++ b/.github/workflows/pr-labeler.yml @@ -22,7 +22,7 @@ jobs: pull-requests: write # write permission is required to label PRs steps: - name: Label PR - uses: release-drafter/release-drafter@3f0f87098bd6b5c5b9a36d49c41d998ea58f9348 # v6.0.0 + uses: release-drafter/release-drafter@b1476f6e6eb133afa41ed8589daba6dc69b4d3f5 # v6.1.0 with: config-name: pr-labeler.yml disable-autolabeler: false diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index 587ddae08..1a9ccafb6 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -23,12 +23,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 + - uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 - name: Setup Node.js - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 + uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 with: cache: pnpm node-version-file: '.node-version' @@ -37,7 +37,7 @@ jobs: run: pnpm install --frozen-lockfile - name: Setup Pages - uses: actions/configure-pages@1f0c5cde4bc74cd7e1254d0cb4de8d49e9068c7d # v4.0.0 + uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0 - name: Run Build run: pnpm --filter mermaid run docs:build:vitepress diff --git a/.github/workflows/release-preview-publish.yml b/.github/workflows/release-preview-publish.yml index fa48d3659..665222b35 100644 --- a/.github/workflows/release-preview-publish.yml +++ b/.github/workflows/release-preview-publish.yml @@ -9,14 +9,14 @@ jobs: publish-preview: runs-on: ubuntu-latest steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: 0 - - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 + - uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 - name: Setup Node.js - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 + uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 with: cache: pnpm node-version-file: '.node-version' diff --git a/.github/workflows/release-preview.yml b/.github/workflows/release-preview.yml index 7b7dba987..38938dff4 100644 --- a/.github/workflows/release-preview.yml +++ b/.github/workflows/release-preview.yml @@ -26,12 +26,12 @@ jobs: timeout-minutes: 5 steps: - name: Checkout Repo - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 + - uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 - name: Setup Node.js - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 + uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 with: cache: pnpm node-version-file: '.node-version' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d4e349d08..649c40034 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,12 +21,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Repo - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 + - uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 - name: Setup Node.js - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 + uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 with: cache: pnpm node-version-file: '.node-version' diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 5b4fdc342..4901b3781 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -16,22 +16,22 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: persist-credentials: false - name: Run analysis - uses: ossf/scorecard-action@dc50aa9510b46c811795eb24b2f1ba02a914e534 # v2.3.3 + uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1 with: results_file: results.sarif results_format: sarif publish_results: true - name: Upload artifact - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 + uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 with: name: SARIF file path: results.sarif retention-days: 5 - name: Upload to code-scanning - uses: github/codeql-action/upload-sarif@f779452ac5af1c261dce0346a8f964149f49322b # v3.26.13 + uses: github/codeql-action/upload-sarif@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3.28.10 with: sarif_file: results.sarif diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7323ec027..527ab7401 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,13 +9,13 @@ jobs: unit-test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 + - uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 # uses version from "packageManager" field in package.json - name: Setup Node.js - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 + uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 with: cache: pnpm node-version-file: '.node-version' @@ -43,7 +43,7 @@ jobs: pnpm test:check:tsc - name: Upload Coverage to Codecov - uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0 + uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1 # Run step only pushes to develop and pull_requests if: ${{ github.event_name == 'pull_request' || github.ref == 'refs/heads/develop' }} with: diff --git a/.github/workflows/update-browserlist.yml b/.github/workflows/update-browserlist.yml index 1b26271f7..94de12ad3 100644 --- a/.github/workflows/update-browserlist.yml +++ b/.github/workflows/update-browserlist.yml @@ -8,8 +8,8 @@ jobs: update-browser-list: runs-on: ubuntu-latest steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 - run: npx update-browserslist-db@latest - name: Commit changes uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4 @@ -19,7 +19,7 @@ jobs: message: 'chore: update browsers list' push: false - name: Create Pull Request - uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0 + uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f # v7.0.6 with: branch: update-browserslist title: Update Browserslist diff --git a/.node-version b/.node-version index 87834047a..7d41c735d 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -20.12.2 +22.14.0 diff --git a/Dockerfile b/Dockerfile index 7be53d24e..533604407 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:20.12.2-alpine3.19@sha256:7a91aa397f2e2dfbfcdad2e2d72599f374e0b0172be1d86eeb73f1d33f36a4b2 +FROM node:22.12.0-alpine3.19@sha256:40dc4b415c17b85bea9be05314b4a753f45a4e1716bb31c01182e6c53d51a654 USER 0:0 diff --git a/README.md b/README.md index 047f8254c..2fca46b25 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Generate diagrams from markdown-like text. Live Editor!

- ๐Ÿ“– Documentation | ๐Ÿš€ Getting Started | ๐ŸŒ CDN | ๐Ÿ™Œ Join Us + ๐Ÿ“– Documentation | ๐Ÿš€ Getting Started | ๐ŸŒ CDN | ๐Ÿ™Œ Join Us

็ฎ€ไฝ“ไธญๆ–‡ @@ -33,7 +33,7 @@ Try Live Editor previews of future releases: ๅฎžๆ—ถ็ผ–่พ‘ๅ™จ!

- ๐Ÿ“– ๆ–‡ๆกฃ | ๐Ÿš€ ๅ…ฅ้—จ | ๐ŸŒ CDN | ๐Ÿ™Œ ๅŠ ๅ…ฅๆˆ‘ไปฌ + ๐Ÿ“– ๆ–‡ๆกฃ | ๐Ÿš€ ๅ…ฅ้—จ | ๐ŸŒ CDN | ๐Ÿ™Œ ๅŠ ๅ…ฅๆˆ‘ไปฌ

English @@ -34,7 +34,7 @@ Mermaid [![Coverage Status](https://codecov.io/github/mermaid-js/mermaid/branch/develop/graph/badge.svg)](https://app.codecov.io/github/mermaid-js/mermaid/tree/develop) [![CDN Status](https://img.shields.io/jsdelivr/npm/hm/mermaid)](https://www.jsdelivr.com/package/npm/mermaid) [![NPM Downloads](https://img.shields.io/npm/dm/mermaid)](https://www.npmjs.com/package/mermaid) -[![Join our Discord!](https://img.shields.io/static/v1?message=join%20chat&color=9cf&logo=discord&label=discord)](https://discord.gg/AgrbSrBer3) +[![Join our Discord!](https://img.shields.io/static/v1?message=join%20chat&color=9cf&logo=discord&label=discord)](https://discord.gg/sKeNQX4Wtj) [![Twitter Follow](https://img.shields.io/badge/Social-mermaidjs__-blue?style=social&logo=X)](https://twitter.com/mermaidjs_) diff --git a/cypress.config.ts b/cypress.config.ts index d077ba915..50ea940e9 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -1,8 +1,8 @@ import eyesPlugin from '@applitools/eyes-cypress'; import { registerArgosTask } from '@argos-ci/cypress/task'; -import coverage from '@cypress/code-coverage/task'; +import coverage from '@cypress/code-coverage/task.js'; import { defineConfig } from 'cypress'; -import { addMatchImageSnapshotPlugin } from 'cypress-image-snapshot/plugin'; +import { addMatchImageSnapshotPlugin } from 'cypress-image-snapshot/plugin.js'; import cypressSplit from 'cypress-split'; export default eyesPlugin( diff --git a/cypress/integration/rendering/architecture.spec.ts b/cypress/integration/rendering/architecture.spec.ts index 25326ff80..ec74a5dd5 100644 --- a/cypress/integration/rendering/architecture.spec.ts +++ b/cypress/integration/rendering/architecture.spec.ts @@ -19,6 +19,25 @@ describe.skip('architecture diagram', () => { ` ); }); + it('should render a simple architecture diagram with titleAndAccessabilities', () => { + imgSnapshotTest( + `architecture-beta + title Simple Architecture Diagram + accTitle: Accessibility Title + accDescr: Accessibility Description + group api(cloud)[API] + + service db(database)[Database] in api + service disk1(disk)[Storage] in api + service disk2(disk)[Storage] in api + service server(server)[Server] in api + + db:L -- R:server + disk1:T -- B:server + disk2:T -- B:db + ` + ); + }); it('should render an architecture diagram with groups within groups', () => { imgSnapshotTest( `architecture-beta @@ -172,7 +191,7 @@ describe.skip('architecture diagram', () => { ); }); - it('should render an architecture diagram with a resonable height', () => { + it('should render an architecture diagram with a reasonable height', () => { imgSnapshotTest( `architecture-beta group federated(cloud)[Federated Environment] diff --git a/cypress/integration/rendering/erDiagram-unified.spec.js b/cypress/integration/rendering/erDiagram-unified.spec.js new file mode 100644 index 000000000..8cecba21d --- /dev/null +++ b/cypress/integration/rendering/erDiagram-unified.spec.js @@ -0,0 +1,652 @@ +import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts'; + +const testOptions = [ + { description: '', options: { logLevel: 1 } }, + { description: 'ELK: ', options: { logLevel: 1, layout: 'elk' } }, + { description: 'HD: ', options: { logLevel: 1, look: 'handDrawn' } }, +]; + +describe('Entity Relationship Diagram Unified', () => { + testOptions.forEach(({ description, options }) => { + it(`${description}should render a simple ER diagram`, () => { + imgSnapshotTest( + ` + erDiagram + CUSTOMER ||--o{ ORDER : places + ORDER ||--|{ LINE-ITEM : contains + `, + options + ); + }); + + it(`${description}should render a simple ER diagram without htmlLabels`, () => { + imgSnapshotTest( + ` + erDiagram + CUSTOMER ||--o{ ORDER : places + ORDER ||--|{ LINE-ITEM : contains + `, + { ...options, htmlLabels: false } + ); + }); + + it(`${description}should render an ER diagram with a recursive relationship`, () => { + imgSnapshotTest( + ` + erDiagram + CUSTOMER ||..o{ CUSTOMER : refers + CUSTOMER ||--o{ ORDER : places + ORDER ||--|{ LINE-ITEM : contains + `, + options + ); + }); + + it(`${description}should render an ER diagram with multiple relationships between the same two entities`, () => { + imgSnapshotTest( + ` + erDiagram + CUSTOMER ||--|{ ADDRESS : "invoiced at" + CUSTOMER ||--|{ ADDRESS : "receives goods at" + `, + options + ); + }); + + it(`${description}should render a cyclical ER diagram`, () => { + imgSnapshotTest( + ` + erDiagram + A ||--|{ B : likes + B ||--|{ C : likes + C ||--|{ A : likes + `, + options + ); + }); + + it(`${description}should render a not-so-simple ER diagram`, () => { + imgSnapshotTest( + ` + erDiagram + CUSTOMER }|..|{ DELIVERY-ADDRESS : has + CUSTOMER ||--o{ ORDER : places + CUSTOMER ||--o{ INVOICE : "liable for" + DELIVERY-ADDRESS ||--o{ ORDER : receives + INVOICE ||--|{ ORDER : covers + ORDER ||--|{ ORDER-ITEM : includes + PRODUCT-CATEGORY ||--|{ PRODUCT : contains + PRODUCT ||--o{ ORDER-ITEM : "ordered in" + `, + options + ); + }); + + it(`${description}should render a not-so-simple ER diagram without htmlLabels`, () => { + imgSnapshotTest( + ` + erDiagram + CUSTOMER }|..|{ DELIVERY-ADDRESS : has + CUSTOMER ||--o{ ORDER : places + CUSTOMER ||--o{ INVOICE : "liable for" + DELIVERY-ADDRESS ||--o{ ORDER : receives + INVOICE ||--|{ ORDER : covers + ORDER ||--|{ ORDER-ITEM : includes + PRODUCT-CATEGORY ||--|{ PRODUCT : contains + PRODUCT ||--o{ ORDER-ITEM : "ordered in" + `, + { ...options, htmlLabels: false } + ); + }); + + it(`${description}should render multiple ER diagrams`, () => { + imgSnapshotTest( + [ + ` + erDiagram + CUSTOMER ||--o{ ORDER : places + ORDER ||--|{ LINE-ITEM : contains + `, + ` + erDiagram + CUSTOMER ||--o{ ORDER : places + ORDER ||--|{ LINE-ITEM : contains + `, + ], + options + ); + }); + + it(`${description}should render an ER diagram with blank or empty labels`, () => { + imgSnapshotTest( + ` + erDiagram + BOOK }|..|{ AUTHOR : "" + BOOK }|..|{ GENRE : " " + AUTHOR }|..|{ GENRE : " " + `, + options + ); + }); + + it(`${description}should render entities that have no relationships`, () => { + renderGraph( + ` + erDiagram + DEAD_PARROT + HERMIT + RECLUSE + SOCIALITE }o--o{ SOCIALITE : "interacts with" + RECLUSE }o--o{ SOCIALITE : avoids + `, + options + ); + }); + + it(`${description}should render entities with and without attributes`, () => { + renderGraph( + ` + erDiagram + BOOK { string title } + AUTHOR }|..|{ BOOK : writes + BOOK { float price } + `, + options + ); + }); + + it(`${description}should render entities with generic and array attributes`, () => { + renderGraph( + ` + erDiagram + BOOK { + string title + string[] authors + type~T~ type + } + `, + options + ); + }); + + it(`${description}should render entities with generic and array attributes without htmlLabels`, () => { + renderGraph( + ` + erDiagram + BOOK { + string title + string[] authors + type~T~ type + } + `, + { ...options, htmlLabels: false } + ); + }); + + it(`${description}should render entities with length in attributes type`, () => { + renderGraph( + ` + erDiagram + CLUSTER { + varchar(99) name + string(255) description + } + `, + options + ); + }); + + it(`${description}should render entities with length in attributes type without htmlLabels`, () => { + renderGraph( + ` + erDiagram + CLUSTER { + varchar(99) name + string(255) description + } + `, + { ...options, htmlLabels: false } + ); + }); + + it(`${description}should render entities and attributes with big and small entity names`, () => { + renderGraph( + ` + erDiagram + PRIVATE_FINANCIAL_INSTITUTION { + string name + int turnover + } + PRIVATE_FINANCIAL_INSTITUTION ||..|{ EMPLOYEE : employs + EMPLOYEE { bool officer_of_firm } + `, + options + ); + }); + + it(`${description}should render entities and attributes with big and small entity names without htmlLabels`, () => { + renderGraph( + ` + erDiagram + PRIVATE_FINANCIAL_INSTITUTION { + string name + int turnover + } + PRIVATE_FINANCIAL_INSTITUTION ||..|{ EMPLOYEE : employs + EMPLOYEE { bool officer_of_firm } + `, + { ...options, htmlLabels: false } + ); + }); + + it(`${description}should render entities with attributes that begin with asterisk`, () => { + imgSnapshotTest( + ` + erDiagram + BOOK { + int *id + string name + varchar(99) summary + } + BOOK }o..o{ STORE : soldBy + STORE { + int *id + string name + varchar(50) address + } + `, + options + ); + }); + + it(`${description}should render entities with attributes that begin with asterisk without htmlLabels`, () => { + imgSnapshotTest( + ` + erDiagram + BOOK { + int *id + string name + varchar(99) summary + } + BOOK }o..o{ STORE : soldBy + STORE { + int *id + string name + varchar(50) address + } + `, + { ...options, htmlLabels: false } + ); + }); + + it(`${description}should render entities with keys`, () => { + renderGraph( + ` + erDiagram + AUTHOR_WITH_LONG_ENTITY_NAME { + string name PK + } + AUTHOR_WITH_LONG_ENTITY_NAME }|..|{ BOOK : writes + BOOK { + float price + string author FK + string title PK + } + `, + options + ); + }); + + it(`${description}should render entities with keys without htmlLabels`, () => { + renderGraph( + ` + erDiagram + AUTHOR_WITH_LONG_ENTITY_NAME { + string name PK + } + AUTHOR_WITH_LONG_ENTITY_NAME }|..|{ BOOK : writes + BOOK { + float price + string author FK + string title PK + } + `, + { ...options, htmlLabels: false } + ); + }); + + it(`${description}should render entities with comments`, () => { + renderGraph( + ` + erDiagram + AUTHOR_WITH_LONG_ENTITY_NAME { + string name "comment" + } + AUTHOR_WITH_LONG_ENTITY_NAME }|..|{ BOOK : writes + BOOK { + string author + string title "author comment" + float price "price comment" + } + `, + options + ); + }); + + it(`${description}should render entities with comments without htmlLabels`, () => { + renderGraph( + ` + erDiagram + AUTHOR_WITH_LONG_ENTITY_NAME { + string name "comment" + } + AUTHOR_WITH_LONG_ENTITY_NAME }|..|{ BOOK : writes + BOOK { + string author + string title "author comment" + float price "price comment" + } + `, + { ...options, htmlLabels: false } + ); + }); + + it(`${description}should render entities with keys and comments`, () => { + renderGraph( + ` + erDiagram + AUTHOR_WITH_LONG_ENTITY_NAME { + string name PK "comment" + } + AUTHOR_WITH_LONG_ENTITY_NAME }|..|{ BOOK : writes + BOOK { + string description + float price "price comment" + string title PK "title comment" + string author FK + } + `, + options + ); + }); + + it(`${description}should render entities with keys and comments without htmlLabels`, () => { + renderGraph( + ` + erDiagram + AUTHOR_WITH_LONG_ENTITY_NAME { + string name PK "comment" + } + AUTHOR_WITH_LONG_ENTITY_NAME }|..|{ BOOK : writes + BOOK { + string description + float price "price comment" + string title PK "title comment" + string author FK + } + `, + { ...options, htmlLabels: false } + ); + }); + + it(`${description}should render entities with aliases`, () => { + renderGraph( + ` + erDiagram + T1 one or zero to one or more T2 : test + T2 one or many optionally to zero or one T3 : test + T3 zero or more to zero or many T4 : test + T4 many(0) to many(1) T5 : test + T5 many optionally to one T6 : test + T6 only one optionally to only one T1 : test + T4 0+ to 1+ T6 : test + T1 1 to 1 T3 : test + `, + options + ); + }); + + it(`${description}should render a simple ER diagram with a title`, () => { + imgSnapshotTest( + `--- + title: simple ER diagram + --- + erDiagram + CUSTOMER ||--o{ ORDER : places + ORDER ||--|{ LINE-ITEM : contains + `, + options + ); + }); + + it(`${description}should render entities with entity name aliases`, () => { + imgSnapshotTest( + ` + erDiagram + p[Person] { + varchar(64) firstName + varchar(64) lastName + } + c["Customer Account"] { + varchar(128) email + } + p ||--o| c : has + `, + options + ); + }); + + it(`${description}should render relationship labels with line breaks`, () => { + imgSnapshotTest( + ` + erDiagram + p[Person] { + string firstName + string lastName + } + a["Customer Account"] { + string email + } + + b["Customer Account Secondary"] { + string email + } + + c["Customer Account Tertiary"] { + string email + } + + d["Customer Account Nth"] { + string email + } + + p ||--o| a : "has
one" + p ||--o| b : "has
one
two" + p ||--o| c : "has
one
two
three" + p ||--o| d : "has
one
two
three
...
Nth" + `, + options + ); + }); + + it(`${description}should render an ER diagram with unicode text`, () => { + imgSnapshotTest( + ` + erDiagram + _**testแบฝฮถโž•ร˜๐Ÿ˜€ใŒ•ใผ**_ { + *__List~List~int~~sdfds__* **driversLicense** PK "***The l๐Ÿ˜€icense #***" + *string(99)~T~~~~~~* firstName "Only __99__
characters are a
llowed dsfsdfsdfsdfs" + string last*Name* + string __phone__ UK + int _age_ + } + `, + options + ); + }); + + it(`${description}should render an ER diagram with unicode text without htmlLabels`, () => { + imgSnapshotTest( + ` + erDiagram + _**testแบฝฮถโž•ร˜๐Ÿ˜€ใŒ•ใผ**_ { + *__List~List~int~~sdfds__* **driversLicense** PK "***The l๐Ÿ˜€icense #***" + *string(99)~T~~~~~~* firstName "Only __99__
characters are a
llowed dsfsdfsdfsdfs" + string last*Name* + string __phone__ UK + int _age_ + } + `, + { ...options, htmlLabels: false } + ); + }); + + it(`${description}should render an ER diagram with relationships with unicode text`, () => { + imgSnapshotTest( + ` + erDiagram + person[๐Ÿ˜€] { + string *first*Name + string _**last**Name_ + } + a["*Customer Account*"] { + **string** ema*i*l + } + person ||--o| a : __hแบฝ๐Ÿ˜€__ + `, + options + ); + }); + + it(`${description}should render an ER diagram with relationships with unicode text without htmlLabels`, () => { + imgSnapshotTest( + ` + erDiagram + person[๐Ÿ˜€] { + string *first*Name + string _**last**Name_ + } + a["*Customer Account*"] { + **string** ema*i*l + } + person ||--o| a : __hแบฝ๐Ÿ˜€__ + `, + { ...options, htmlLabels: false } + ); + }); + + it(`${description}should render an ER diagram with TB direction`, () => { + imgSnapshotTest( + ` + erDiagram + direction TB + CAR ||--|{ NAMED-DRIVER : allows + PERSON ||..o{ NAMED-DRIVER : is + `, + options + ); + }); + + it(`${description}should render an ER diagram with BT direction`, () => { + imgSnapshotTest( + ` + erDiagram + direction BT + CAR ||--|{ NAMED-DRIVER : allows + PERSON ||..o{ NAMED-DRIVER : is + `, + options + ); + }); + + it(`${description}should render an ER diagram with LR direction`, () => { + imgSnapshotTest( + ` + erDiagram + direction LR + CAR ||--|{ NAMED-DRIVER : allows + PERSON ||..o{ NAMED-DRIVER : is + `, + options + ); + }); + + it(`${description}should render an ER diagram with RL direction`, () => { + imgSnapshotTest( + ` + erDiagram + direction RL + CAR ||--|{ NAMED-DRIVER : allows + PERSON ||..o{ NAMED-DRIVER : is + `, + options + ); + }); + + it(`${description}should render entities with styles applied from style statement`, () => { + imgSnapshotTest( + ` + erDiagram + c[CUSTOMER] + p[PERSON] + style c,p fill:#f9f,stroke:blue, color:grey, font-size:24px,font-weight:bold + `, + options + ); + }); + + it(`${description}should render entities with styles applied from style statement without htmlLabels`, () => { + imgSnapshotTest( + ` + erDiagram + c[CUSTOMER] + p[PERSON] + style c,p fill:#f9f,stroke:blue, color:grey, font-size:24px,font-weight:bold + `, + { ...options, htmlLabels: false } + ); + }); + + it(`${description}should render entities with styles applied from class statement`, () => { + imgSnapshotTest( + ` + erDiagram + c[CUSTOMER] + p[PERSON]:::blue + classDef bold font-size:24px, font-weight: bold + classDef blue stroke:lightblue, color: #0000FF + class c,p bold + `, + options + ); + }); + + it(`${description}should render entities with styles applied from class statement without htmlLabels`, () => { + imgSnapshotTest( + ` + erDiagram + c[CUSTOMER] + p[PERSON]:::blue + classDef bold font-size:24px, font-weight: bold + classDef blue stroke:lightblue, color: #0000FF + class c,p bold + `, + { ...options, htmlLabels: false } + ); + }); + + it(`${description}should render entities with styles applied from the default class and other styles`, () => { + imgSnapshotTest( + ` + erDiagram + c[CUSTOMER] + p[PERSON]:::blue + classDef blue stroke:lightblue, color: #0000FF + classDef default fill:pink + style c color:green + `, + { ...options } + ); + }); + }); +}); diff --git a/cypress/integration/rendering/erDiagram.spec.js b/cypress/integration/rendering/erDiagram.spec.js index aad9b1cf7..cbfec8218 100644 --- a/cypress/integration/rendering/erDiagram.spec.js +++ b/cypress/integration/rendering/erDiagram.spec.js @@ -109,8 +109,8 @@ describe('Entity Relationship Diagram', () => { const style = svg.attr('style'); expect(style).to.match(/^max-width: [\d.]+px;$/); const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join('')); - // use within because the absolute value can be slightly different depending on the environment ยฑ5% - expect(maxWidthValue).to.be.within(140 * 0.95, 140 * 1.05); + // use within because the absolute value can be slightly different depending on the environment ยฑ6% + expect(maxWidthValue).to.be.within(140 * 0.96, 140 * 1.06); }); }); @@ -125,8 +125,8 @@ describe('Entity Relationship Diagram', () => { ); cy.get('svg').should((svg) => { const width = parseFloat(svg.attr('width')); - // use within because the absolute value can be slightly different depending on the environment ยฑ5% - expect(width).to.be.within(140 * 0.95, 140 * 1.05); + // use within because the absolute value can be slightly different depending on the environment ยฑ6% + expect(width).to.be.within(140 * 0.96, 140 * 1.06); // expect(svg).to.have.attr('height', '465'); expect(svg).to.not.have.attr('style'); }); diff --git a/cypress/integration/rendering/flowchart.spec.js b/cypress/integration/rendering/flowchart.spec.js index d3a83ae5f..7b986cd2f 100644 --- a/cypress/integration/rendering/flowchart.spec.js +++ b/cypress/integration/rendering/flowchart.spec.js @@ -895,7 +895,7 @@ graph TD imgSnapshotTest( ` graph TD - classDef default fill:#a34,stroke:#000,stroke-width:4px,color:#fff + classDef default fill:#a34,stroke:#000,stroke-width:4px,color:#fff hello --> default `, { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' } @@ -917,4 +917,21 @@ graph TD } ); }); + it('#6369: edge color should affect arrow head', () => { + imgSnapshotTest( + ` + flowchart LR + A --> B + A --> C + C --> D + + linkStyle 0 stroke:#D50000 + linkStyle 2 stroke:#D50000 + `, + { + flowchart: { htmlLabels: true }, + securityLevel: 'loose', + } + ); + }); }); diff --git a/cypress/integration/rendering/journey.spec.js b/cypress/integration/rendering/journey.spec.js index d8bef6d1b..2d6c14c9d 100644 --- a/cypress/integration/rendering/journey.spec.js +++ b/cypress/integration/rendering/journey.spec.js @@ -63,4 +63,165 @@ section Checkout from website { journey: { useMaxWidth: false } } ); }); + + it('should initialize with a left margin of 150px for user journeys', () => { + renderGraph( + ` + --- + config: + journey: + maxLabelWidth: 320 + --- + journey + title User Journey Example + section Onboarding + Sign Up: 5: + Browse Features: 3: + Use Core Functionality: 4: + section Engagement + Browse Features: 3 + Use Core Functionality: 4 + `, + { journey: { useMaxWidth: true } } + ); + + let diagramStartX; + + cy.contains('foreignobject', 'Sign Up').then(($diagram) => { + diagramStartX = parseFloat($diagram.attr('x')); + expect(diagramStartX).to.be.closeTo(150, 2); + }); + }); + + it('should maintain sufficient space between legend and diagram when legend labels are longer', () => { + renderGraph( + `journey + title Web hook life cycle + section Darkoob + Make preBuilt:5: Darkoob user + register slug : 5: Darkoob userf deliberately increasing the size of this label to check if distance between legend and diagram is maintained + Map slug to a Prebuilt Job:5: Darkoob user + section External Service + set Darkoob slug as hook for an Event : 5 : admin Exjjjnjjjj qwerty + listen to the events : 5 : External Service + call darkoob endpoint : 5 : External Service + section Darkoob + check for inputs : 5 : DarkoobAPI + run the prebuilt job : 5 : DarkoobAPI + `, + { journey: { useMaxWidth: true } } + ); + + let LabelEndX, diagramStartX; + + // Get right edge of the legend + cy.contains('tspan', 'Darkoob userf').then((textBox) => { + const bbox = textBox[0].getBBox(); + LabelEndX = bbox.x + bbox.width; + }); + + // Get left edge of the diagram + cy.contains('foreignobject', 'Make preBuilt').then((rect) => { + diagramStartX = parseFloat(rect.attr('x')); + }); + + // Assert right edge of the diagram is greater than or equal to the right edge of the label + cy.then(() => { + expect(diagramStartX).to.be.gte(LabelEndX); + }); + }); + + it('should wrap a single long word with hyphenation', () => { + renderGraph( + ` + --- + config: + journey: + maxLabelWidth: 100 + --- + journey + title Long Word Test + section Test + VeryLongWord: 5: Supercalifragilisticexpialidocious + `, + { journey: { useMaxWidth: true } } + ); + + // Verify that the line ends with a hyphen, indicating proper hyphenation for words exceeding maxLabelWidth. + cy.get('tspan').then((tspans) => { + const hasHyphen = [...tspans].some((t) => t.textContent.trim().endsWith('-')); + return expect(hasHyphen).to.be.true; + }); + }); + + it('should wrap text on whitespace without adding hyphens', () => { + renderGraph( + ` + --- + config: + journey: + maxLabelWidth: 200 + --- + journey + title Whitespace Test + section Test + TextWithSpaces: 5: Gustavo Fring is played by Giancarlo Esposito and is a character in Breaking Bad. + `, + { journey: { useMaxWidth: true } } + ); + + // Verify that none of the text spans end with a hyphen. + cy.get('tspan').each(($el) => { + const text = $el.text(); + expect(text.trim()).not.to.match(/-$/); + }); + }); + + it('should wrap long labels into multiple lines, keep them under max width, and maintain margins', () => { + renderGraph( + ` + --- + config: + journey: + maxLabelWidth: 320 + --- + journey + title User Journey Example + section Onboarding + Sign Up: 5: This is a long label that will be split into multiple lines to test the wrapping functionality + Browse Features: 3: This is another long label that will be split into multiple lines to test the wrapping functionality + Use Core Functionality: 4: This is yet another long label that will be split into multiple lines to test the wrapping functionality + section Engagement + Browse Features: 3 + Use Core Functionality: 4 + `, + { journey: { useMaxWidth: true } } + ); + + let diagramStartX, maxLineWidth; + + // Get the diagram's left edge x-coordinate + cy.contains('foreignobject', 'Sign Up') + .then(($diagram) => { + diagramStartX = parseFloat($diagram.attr('x')); + }) + .then(() => { + cy.get('text.legend').then(($lines) => { + // Check that there are multiple lines + expect($lines.length).to.be.equal(9); + + // Check that all lines are under the maxLabelWidth + $lines.each((index, el) => { + const bbox = el.getBBox(); + expect(bbox.width).to.be.lte(320); + maxLineWidth = Math.max(maxLineWidth || 0, bbox.width); + }); + + /** The expected margin between the diagram and the legend is 150px, as defined by + * conf.leftMargin in user-journey-config.js + */ + expect(diagramStartX - maxLineWidth).to.be.closeTo(150, 2); + }); + }); + }); }); diff --git a/cypress/integration/rendering/radar.spec.js b/cypress/integration/rendering/radar.spec.js new file mode 100644 index 000000000..b0bc3f6e0 --- /dev/null +++ b/cypress/integration/rendering/radar.spec.js @@ -0,0 +1,79 @@ +import { imgSnapshotTest } from '../../helpers/util'; + +describe('radar structure', () => { + it('should render a simple radar diagram', () => { + imgSnapshotTest( + `radar-beta + title Best Radar Ever + axis A, B, C + curve c1{1, 2, 3} + ` + ); + }); + + it('should render a radar diagram with multiple curves', () => { + imgSnapshotTest( + `radar-beta + title Best Radar Ever + axis A, B, C + curve c1{1, 2, 3} + curve c2{2, 3, 1} + ` + ); + }); + + it('should render a complex radar diagram', () => { + imgSnapshotTest( + `radar-beta + title My favorite ninjas + axis Agility, Speed, Strength + axis Stam["Stamina"] , Intel["Intelligence"] + + curve Ninja1["Naruto Uzumaki"]{ + Agility 2, Speed 2, + Strength 3, Stam 5, + Intel 0 + } + curve Ninja2["Sasuke"]{2, 3, 4, 1, 5} + curve Ninja3 {3, 2, 1, 5, 4} + + showLegend true + ticks 3 + max 8 + min 0 + graticule polygon + ` + ); + cy.get('svg').should((svg) => { + expect(svg).to.have.length(1); + }); + }); + + it('should render radar diagram with config override', () => { + imgSnapshotTest( + `radar-beta + title Best Radar Ever + axis A,B,C + curve mycurve{1,2,3}`, + { radar: { marginTop: 100, axisScaleFactor: 0.5 } } + ); + }); + + it('should parse radar diagram with theme override', () => { + imgSnapshotTest( + `radar-beta + axis A,B,C + curve mycurve{1,2,3}`, + { theme: 'base', themeVariables: { fontSize: 80, cScale0: '#FF0000' } } + ); + }); + + it('should handle radar diagram with radar style override', () => { + imgSnapshotTest( + `radar-beta + axis A,B,C + curve mycurve{1,2,3}`, + { theme: 'base', themeVariables: { radar: { axisColor: '#FF0000' } } } + ); + }); +}); diff --git a/cypress/integration/rendering/requirementDiagram-unified.spec.js b/cypress/integration/rendering/requirementDiagram-unified.spec.js new file mode 100644 index 000000000..48b1a0d61 --- /dev/null +++ b/cypress/integration/rendering/requirementDiagram-unified.spec.js @@ -0,0 +1,703 @@ +import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts'; + +const testOptions = [ + { description: '', options: { logLevel: 1 } }, + { description: 'ELK: ', options: { logLevel: 1, layout: 'elk' } }, + { description: 'HD: ', options: { logLevel: 1, look: 'handDrawn' } }, +]; + +describe('Requirement Diagram Unified', () => { + testOptions.forEach(({ description, options }) => { + it(`${description}should render a simple Requirement diagram`, () => { + imgSnapshotTest( + ` + requirementDiagram + requirement test_req { + id: 1 + text: the test text. + risk: high + verifymethod: test + } + + element test_entity { + type: simulation + } + + test_entity - satisfies -> test_req + `, + options + ); + }); + + it(`${description}should render a simple Requirement diagram without htmlLabels`, () => { + imgSnapshotTest( + ` + requirementDiagram + requirement test_req { + id: 1 + text: the test text. + risk: high + verifymethod: test + } + + element test_entity { + type: simulation + } + + test_entity - satisfies -> test_req + `, + { ...options, htmlLabels: false } + ); + }); + + it(`${description}should render a not-so-simple Requirement diagram`, () => { + imgSnapshotTest( + ` + requirementDiagram + + requirement test_req { + id: 1 + text: the test text. + risk: high + verifymethod: test + } + + functionalRequirement test_req2 { + id: 1.1 + text: the second test text. + risk: low + verifymethod: inspection + } + + performanceRequirement test_req3 { + id: 1.2 + text: the third test text. + risk: medium + verifymethod: demonstration + } + + interfaceRequirement test_req4 { + id: 1.2.1 + text: the fourth test text. + risk: medium + verifymethod: analysis + } + + physicalRequirement test_req5 { + id: 1.2.2 + text: the fifth test text. + risk: medium + verifymethod: analysis + } + + designConstraint test_req6 { + id: 1.2.3 + text: the sixth test text. + risk: medium + verifymethod: analysis + } + + element test_entity { + type: simulation + } + + element test_entity2 { + type: word doc + docRef: reqs/test_entity + } + + element test_entity3 { + type: "test suite" + docRef: github.com/all_the_tests + } + + + test_entity - satisfies -> test_req2 + test_req - traces -> test_req2 + test_req - contains -> test_req3 + test_req3 - contains -> test_req4 + test_req4 - derives -> test_req5 + test_req5 - refines -> test_req6 + test_entity3 - verifies -> test_req5 + test_req <- copies - test_entity2 + `, + options + ); + }); + + it(`${description}should render a not-so-simple Requirement diagram without htmlLabels`, () => { + imgSnapshotTest( + ` + requirementDiagram + + requirement test_req { + id: 1 + text: the test text. + risk: high + verifymethod: test + } + + functionalRequirement test_req2 { + id: 1.1 + text: the second test text. + risk: low + verifymethod: inspection + } + + performanceRequirement test_req3 { + id: 1.2 + text: the third test text. + risk: medium + verifymethod: demonstration + } + + interfaceRequirement test_req4 { + id: 1.2.1 + text: the fourth test text. + risk: medium + verifymethod: analysis + } + + physicalRequirement test_req5 { + id: 1.2.2 + text: the fifth test text. + risk: medium + verifymethod: analysis + } + + designConstraint test_req6 { + id: 1.2.3 + text: the sixth test text. + risk: medium + verifymethod: analysis + } + + element test_entity { + type: simulation + } + + element test_entity2 { + type: word doc + docRef: reqs/test_entity + } + + element test_entity3 { + type: "test suite" + docRef: github.com/all_the_tests + } + + + test_entity - satisfies -> test_req2 + test_req - traces -> test_req2 + test_req - contains -> test_req3 + test_req3 - contains -> test_req4 + test_req4 - derives -> test_req5 + test_req5 - refines -> test_req6 + test_entity3 - verifies -> test_req5 + test_req <- copies - test_entity2 + `, + { ...options, htmlLabels: false } + ); + }); + + it(`${description}should render multiple Requirement diagrams`, () => { + imgSnapshotTest( + [ + ` + requirementDiagram + + requirement test_req { + id: 1 + text: the test text. + risk: high + verifymethod: test + } + + element test_entity { + type: simulation + } + + test_entity - satisfies -> test_req + `, + ` + requirementDiagram + + requirement test_req { + id: 1 + text: the test text. + risk: high + verifymethod: test + } + + element test_entity { + type: simulation + } + + test_entity - satisfies -> test_req + `, + ], + options + ); + }); + + it(`${description}should render a Requirement diagram with empty information`, () => { + imgSnapshotTest( + ` + requirementDiagram + requirement test_req { + } + element test_entity { + } + `, + options + ); + }); + + it(`${description}should render requirements and elements with and without information`, () => { + renderGraph( + ` + requirementDiagram + requirement test_req { + id: 1 + text: the test text. + risk: high + verifymethod: test + } + element test_entity { + } + `, + options + ); + }); + + it(`${description}should render requirements and elements with long and short text`, () => { + renderGraph( + ` + requirementDiagram + requirement test_req { + id: 1 + text: the test text that is long and takes up a lot of space. + risk: high + verifymethod: test + } + element test_entity_name_that_is_extra_long { + } + `, + options + ); + }); + + it(`${description}should render requirements and elements with long and short text without htmlLabels`, () => { + renderGraph( + ` + requirementDiagram + requirement test_req { + id: 1 + text: the test text that is long and takes up a lot of space. + risk: high + verifymethod: test + } + element test_entity_name_that_is_extra_long { + } + `, + { ...options, htmlLabels: false } + ); + }); + + it(`${description}should render requirements and elements with quoted text for spaces`, () => { + renderGraph( + ` + requirementDiagram + requirement "test req name with spaces" { + id: 1 + text: the test text that is long and takes up a lot of space. + risk: high + verifymethod: test + } + element "test entity name that is extra long with spaces" { + } + `, + options + ); + }); + + it(`${description}should render requirements and elements with markdown text`, () => { + renderGraph( + ` + requirementDiagram + requirement "__my bolded name__" { + id: 1 + text: "**Bolded text** _italicized text_" + risk: high + verifymethod: test + } + element "*my italicized name*" { + type: "**Bolded type** _italicized type_" + docref: "*Italicized* __Bolded__" + } + `, + options + ); + }); + + it(`${description}should render requirements and elements with markdown text without htmlLabels`, () => { + renderGraph( + ` + requirementDiagram + requirement "__my bolded name__" { + id: 1 + text: "**Bolded text** _italicized text_" + risk: high + verifymethod: test + } + element "*my italicized name*" { + type: "**Bolded type** _italicized type_" + docref: "*Italicized* __Bolded__" + } + `, + { ...options, htmlLabels: false } + ); + }); + + it(`${description}should render a simple Requirement diagram with a title`, () => { + imgSnapshotTest( + `--- + title: simple Requirement diagram + --- + requirementDiagram + + requirement test_req { + id: 1 + text: the test text. + risk: high + verifymethod: test + } + + element test_entity { + type: simulation + } + + test_entity - satisfies -> test_req + `, + options + ); + }); + + it(`${description}should render a Requirement diagram with TB direction`, () => { + imgSnapshotTest( + ` + requirementDiagram + direction TB + + requirement test_req { + id: 1 + text: the test text. + risk: high + verifymethod: test + } + + element test_entity { + type: simulation + } + + test_entity - satisfies -> test_req + `, + options + ); + }); + + it(`${description}should render a Requirement diagram with BT direction`, () => { + imgSnapshotTest( + ` + requirementDiagram + direction BT + + requirement test_req { + id: 1 + text: the test text. + risk: high + verifymethod: test + } + + element test_entity { + type: simulation + } + + test_entity - satisfies -> test_req + `, + options + ); + }); + + it(`${description}should render a Requirement diagram with LR direction`, () => { + imgSnapshotTest( + ` + requirementDiagram + direction LR + + requirement test_req { + id: 1 + text: the test text. + risk: high + verifymethod: test + } + + element test_entity { + type: simulation + } + + test_entity - satisfies -> test_req + `, + options + ); + }); + + it(`${description}should render a Requirement diagram with RL direction`, () => { + imgSnapshotTest( + ` + requirementDiagram + direction RL + + requirement test_req { + id: 1 + text: the test text. + risk: high + verifymethod: test + } + + element test_entity { + type: simulation + } + + test_entity - satisfies -> test_req + `, + options + ); + }); + + it(`${description}should render requirements and elements with styles applied from style statement`, () => { + imgSnapshotTest( + ` + requirementDiagram + + requirement test_req { + id: 1 + text: the test text. + risk: high + verifymethod: test + } + + element test_entity { + type: simulation + } + + test_entity - satisfies -> test_req + + style test_req,test_entity fill:#f9f,stroke:blue, color:grey, font-weight:bold + `, + options + ); + }); + + it(`${description}should render requirements and elements with styles applied from style statement without htmlLabels`, () => { + imgSnapshotTest( + ` + requirementDiagram + + requirement test_req { + id: 1 + text: the test text. + risk: high + verifymethod: test + } + + element test_entity { + type: simulation + } + + test_entity - satisfies -> test_req + + style test_req,test_entity fill:#f9f,stroke:blue, color:grey, font-weight:bold + `, + { ...options, htmlLabels: false } + ); + }); + + it(`${description}should render requirements and elements with styles applied from class statement`, () => { + imgSnapshotTest( + ` +requirementDiagram + + requirement test_req { + id: 1 + text: the test text. + risk: high + verifymethod: test + } + + element test_entity { + type: simulation + } + + test_entity - satisfies -> test_req + classDef bold font-weight: bold + classDef blue stroke:lightblue, color: #0000FF + class test_entity bold + class test_req blue, bold + `, + options + ); + }); + + it(`${description}should render requirements and elements with styles applied from class statement without htmlLabels`, () => { + imgSnapshotTest( + ` + requirementDiagram + + requirement test_req { + id: 1 + text: the test text. + risk: high + verifymethod: test + } + + element test_entity { + type: simulation + } + + test_entity - satisfies -> test_req + classDef bold font-weight: bold + classDef blue stroke:lightblue, color: #0000FF + class test_entity bold + class test_req blue, bold + `, + { ...options, htmlLabels: false } + ); + }); + + it(`${description}should render requirements and elements with styles applied from classes with shorthand syntax`, () => { + imgSnapshotTest( + ` + requirementDiagram + + requirement test_req:::blue { + id: 1 + text: the test text. + risk: high + verifymethod: test + } + + element test_entity { + type: simulation + } + + test_entity - satisfies -> test_req + classDef bold font-weight: bold + classDef blue stroke:lightblue, color: #0000FF + test_entity:::bold + `, + options + ); + }); + + it(`${description}should render requirements and elements with styles applied from classes with shorthand syntax without htmlLabels`, () => { + imgSnapshotTest( + ` + requirementDiagram + + requirement test_req:::blue { + id: 1 + text: the test text. + risk: high + verifymethod: test + } + + element test_entity { + type: simulation + } + + test_entity - satisfies -> test_req + classDef bold font-weight: bold + classDef blue stroke:lightblue, color: #0000FF + test_entity:::bold + `, + { ...options, htmlLabels: false } + ); + }); + + it(`${description}should render requirements and elements with styles applied from the default class and other styles`, () => { + imgSnapshotTest( + ` +requirementDiagram + + requirement test_req:::blue { + id: 1 + text: the test text. + risk: high + verifymethod: test + } + + element test_entity { + type: simulation + } + + test_entity - satisfies -> test_req + classDef blue stroke:lightblue, color:blue + classDef default fill:pink + style test_entity color:green + `, + options + ); + }); + + it(`${description}should render requirements and elements with styles applied from the default class and other styles without htmlLabels`, () => { + imgSnapshotTest( + ` + requirementDiagram + + requirement test_req:::blue { + id: 1 + text: the test text. + risk: high + verifymethod: test + } + + element test_entity { + type: simulation + } + + test_entity - satisfies -> test_req + classDef blue stroke:lightblue, color:blue + classDef default fill:pink + style test_entity color:green + `, + { ...options, htmlLabels: false } + ); + }); + + it(`${description}should render a Requirement diagram with a theme`, () => { + imgSnapshotTest( + ` +--- + theme: forest +--- + requirementDiagram + + requirement test_req:::blue { + id: 1 + text: the test text. + risk: high + verifymethod: test + } + + element test_entity { + type: simulation + } + + test_entity - satisfies -> test_req + `, + options + ); + }); + }); +}); diff --git a/cypress/platform/ashish2.html b/cypress/platform/ashish2.html index f9132d2e2..351dcabc2 100644 --- a/cypress/platform/ashish2.html +++ b/cypress/platform/ashish2.html @@ -4,7 +4,7 @@ - + diff --git a/cypress/platform/xss10.html b/cypress/platform/xss10.html index 91b0b94ac..9814fed41 100644 --- a/cypress/platform/xss10.html +++ b/cypress/platform/xss10.html @@ -4,7 +4,7 @@ + +

Nodes

+
+
+

Basic ErNode

+
+          ---
+            config:
+              htmlLabels: false
+              look: handDrawn
+              theme: forest
+          ---
+          erDiagram
+            _**hiร˜**_[*test*] {
+              *__List~List~int~~sdfds__* __driversLicense__ PK "***The l๐Ÿ˜€icense #***"
+              *string(99)~T~~~~~~* firstName "Only 99 
characters are a
llowed dsfsdfsdfsdfs" + ~str ing~ lastName + string phone UK + int age + } + style PERSON color:red, stroke:blue,fill:#f9f + classDef test,test2 stroke:red + class PERSON test,test2 +
+
+
+

Basic ErNode

+
+          erDiagram
+            CAR {
+                string registrationNumber
+                string make
+                string model
+            }
+            PERSON {
+                string firstName
+                string lastName
+                int age
+            }
+
+            CAR:::someclass
+            PERSON:::anotherclass,someclass
+        
+            classDef someclass fill:#f96
+            classDef anotherclass color:blue
+        
+
+
+

Diagram Testing

+
+
+

Basic Relationship

+
+          ---
+            config:
+              htmlLabels: false
+              layout: elk
+              look: handDrawn
+              theme: forest
+          ---
+          erDiagram
+            "hi" }o..o{ ORDER : places
+            style hi fill:lightblue
+        
+
+
+

Basic Relationship

+
+          ---
+            config:
+              htmlLabels: false
+              look: handDrawn
+              layout: elk
+          ---
+          erDiagram
+            CAR ||--|{ NAMED-DRIVER : allows
+            PERSON ||..o{ NAMED-DRIVER : is
+        
+
+
+

Basic Relationship

+
+          ---
+            config:
+              htmlLabels: true
+              look: handDrawn
+              theme: forest
+          ---
+          erDiagram
+            CAR ||--o{ NAMED-DRIVER : allows
+            CAR {
+                test test PK "comment"
+                string make
+                string model
+                string[] parts
+            }
+            PERSON ||--o{ NAMED-DRIVER : is
+            PERSON ||--o{ CAR : is
+            PERSON {
+                string driversLicense PK "The license #"
+                string(99) firstName "Only 99 characters are allowed"
+                string lastName
+                string phone UK
+                int age
+            }
+            NAMED-DRIVER {
+                string carRegistrationNumber PK, FK
+                string driverLicence PK, FK
+            }
+            MANUFACTURER only one to zero or more CAR : makes      
+        
+
+
+

Basic Relationship

+
+          ---
+            title: simple ER diagram
+            config:
+              theme: forest
+          ---
+          erDiagram
+          direction TB
+          p[Pers๐Ÿ˜€on] {
+              string firstName
+              string lastName
+          }
+          a["Customer Account"] {
+              string email
+          }
+          p ||--o| a : has
+           
+        
+
+
+

Basic Relationship

+
+          ---
+            config:
+              layout: elk
+          ---
+          erDiagram
+          CUSTOMER }|..|{ DELIVERY-ADDRESS : has
+          CUSTOMER ||--o{ ORDER : places
+          CUSTOMER ||--o{ INVOICE : "liable for"
+          DELIVERY-ADDRESS ||--o{ ORDER : receives
+          INVOICE ||--|{ ORDER : covers
+          ORDER ||--|{ ORDER-ITEM : includes
+          PRODUCT-CATEGORY ||--|{ PRODUCT : contains
+          PRODUCT ||--o{ ORDER-ITEM : "ordered in"
+        
+
+
+

Basic Relationship

+
+---
+  config:
+    layout: elk
+---
+          erDiagram
+          rental{
+                  ~timestamp with time zone~ rental_date "NN"
+                  ~integer~ inventory_id "NN"
+                  ~integer~ customer_id "NN"
+                  ~timestamp with time zone~ return_date
+                  ~integer~ staff_id "NN"
+                  ~integer~ rental_id "NN"
+                  ~timestamp with time zone~ last_update "NN"
+  }
+          film_actor{
+                  ~integer~ actor_id "NN"
+                  ~integer~ film_id "NN"
+                  ~timestamp with time zone~ last_update "NN"
+  }
+          film{
+                  ~text~ title "NN"
+                  ~text~ description
+                  ~public.year~ release_year
+                  ~integer~ language_id "NN"
+                  ~integer~ original_language_id
+                  ~smallint~ length
+                  ~text[]~ special_features
+                  ~tsvector~ fulltext "NN"
+                  ~integer~ film_id "NN"
+                  ~smallint~ rental_duration "NN"
+                  ~numeric(4,2)~ rental_rate "NN"
+                  ~numeric(5,2)~ replacement_cost "NN"
+                  ~public.mpaa_rating~ rating
+                  ~timestamp with time zone~ last_update "NN"
+  }
+          customer{
+                  ~integer~ store_id "NN"
+                  ~text~ first_name "NN"
+                  ~text~ last_name "NN"
+                  ~text~ email
+                  ~integer~ address_id "NN"
+                  ~integer~ active
+                  ~integer~ customer_id "NN"
+                  ~boolean~ activebool "NN"
+                  ~date~ create_date "NN"
+                  ~timestamp with time zone~ last_update
+  }
+          film_category{
+                  ~integer~ film_id "NN"
+                  ~integer~ category_id "NN"
+                  ~timestamp with time zone~ last_update "NN"
+  }
+          actor{
+                  ~text~ first_name "NN"
+                  ~text~ last_name "NN"
+                  ~integer~ actor_id "NN"
+                  ~timestamp with time zone~ last_update "NN"
+  }
+          store{
+                  ~integer~ manager_staff_id "NN"
+                  ~integer~ address_id "NN"
+                  ~integer~ store_id "NN"
+                  ~timestamp with time zone~ last_update "NN"
+  }
+          city{
+                  ~text~ city "NN"
+                  ~integer~ country_id "NN"
+                  ~integer~ city_id "NN"
+                  ~timestamp with time zone~ last_update "NN"
+  }
+          language{
+                  ~character(20)~ name "NN"
+                  ~integer~ language_id "NN"
+                  ~timestamp with time zone~ last_update "NN"
+  }
+          payment{
+                  ~integer~ customer_id "NN"
+                  ~integer~ staff_id "NN"
+                  ~integer~ rental_id "NN"
+                  ~numeric(5,2)~ amount "NN"
+                  ~timestamp with time zone~ payment_date "NN"
+                  ~integer~ payment_id "NN"
+  }
+          category{
+                  ~text~ name "NN"
+                  ~integer~ category_id "NN"
+                  ~timestamp with time zone~ last_update "NN"
+  }
+          inventory{
+                  ~integer~ film_id "NN"
+                  ~integer~ store_id "NN"
+                  ~integer~ inventory_id "NN"
+                  ~timestamp with time zone~ last_update "NN"
+  }
+          address{
+                  ~text~ address "NN"
+                  ~text~ address2
+                  ~text~ district "NN"
+                  ~integer~ city_id "NN"
+                  ~text~ postal_code
+                  ~text~ phone "NN"
+                  ~integer~ address_id "NN"
+                  ~timestamp with time zone~ last_update "NN"
+  }
+          staff{
+                  ~text~ first_name "NN"
+                  ~text~ last_name "NN"
+                  ~integer~ address_id "NN"
+                  ~text~ email
+                  ~integer~ store_id "NN"
+                  ~text~ username "NN"
+                  ~text~ password
+                  ~bytea~ picture
+                  ~integer~ staff_id "NN"
+                  ~boolean~ active "NN"
+                  ~timestamp with time zone~ last_update "NN"
+  }
+          country{
+                  ~text~ country "NN"
+                  ~integer~ country_id "NN"
+                  ~timestamp with time zone~ last_update "NN"
+  }
+  film_actor }|..|| film : film_actor_film_id_fkey
+  film_actor }|..|| actor : film_actor_actor_id_fkey
+  address }|..|| city : address_city_id_fkey
+  city }|..|| country : city_country_id_fkey
+  customer }|..|| store : customer_store_id_fkey
+  customer }|..|| address : customer_address_id_fkey
+  film }|..|| language : film_original_language_id_fkey
+  film }|..|| language : film_language_id_fkey
+  film_category }|..|| film : film_category_film_id_fkey
+  film_category }|..|| category : film_category_category_id_fkey
+  inventory }|..|| store : inventory_store_id_fkey
+        
+
+
+ + + + + diff --git a/cypress/timings.json b/cypress/timings.json index 3455d82fc..6164a81fb 100644 --- a/cypress/timings.json +++ b/cypress/timings.json @@ -2,151 +2,211 @@ "durations": [ { "spec": "cypress/integration/other/configuration.spec.js", - "duration": 4989 + "duration": 5475 }, { "spec": "cypress/integration/other/external-diagrams.spec.js", - "duration": 1382 + "duration": 2037 }, { "spec": "cypress/integration/other/ghsa.spec.js", - "duration": 3178 + "duration": 3207 }, { "spec": "cypress/integration/other/iife.spec.js", - "duration": 1372 + "duration": 1915 }, { "spec": "cypress/integration/other/interaction.spec.js", - "duration": 8998 + "duration": 10952 }, { "spec": "cypress/integration/other/rerender.spec.js", - "duration": 1249 + "duration": 1872 }, { "spec": "cypress/integration/other/xss.spec.js", - "duration": 25664 + "duration": 26686 }, { "spec": "cypress/integration/rendering/appli.spec.js", - "duration": 1928 + "duration": 2629 }, { "spec": "cypress/integration/rendering/architecture.spec.ts", - "duration": 2330 + "duration": 104 }, { "spec": "cypress/integration/rendering/block.spec.js", - "duration": 11156 + "duration": 14765 }, { "spec": "cypress/integration/rendering/c4.spec.js", - "duration": 3418 + "duration": 4913 + }, + { + "spec": "cypress/integration/rendering/classDiagram-elk-v3.spec.js", + "duration": 36667 + }, + { + "spec": "cypress/integration/rendering/classDiagram-handDrawn-v3.spec.js", + "duration": 33813 }, { "spec": "cypress/integration/rendering/classDiagram-v2.spec.js", - "duration": 14866 + "duration": 20441 + }, + { + "spec": "cypress/integration/rendering/classDiagram-v3.spec.js", + "duration": 32504 }, { "spec": "cypress/integration/rendering/classDiagram.spec.js", - "duration": 9894 + "duration": 13772 }, { "spec": "cypress/integration/rendering/conf-and-directives.spec.js", - "duration": 5778 + "duration": 7978 }, { "spec": "cypress/integration/rendering/current.spec.js", - "duration": 1690 + "duration": 2101 + }, + { + "spec": "cypress/integration/rendering/erDiagram-unified.spec.js", + "duration": 76556 }, { "spec": "cypress/integration/rendering/erDiagram.spec.js", - "duration": 9144 + "duration": 12756 }, { "spec": "cypress/integration/rendering/errorDiagram.spec.js", - "duration": 1951 + "duration": 2766 }, { "spec": "cypress/integration/rendering/flowchart-elk.spec.js", - "duration": 2196 + "duration": 35641 }, { "spec": "cypress/integration/rendering/flowchart-handDrawn.spec.js", - "duration": 21029 + "duration": 26915 }, { "spec": "cypress/integration/rendering/flowchart-shape-alias.spec.ts", - "duration": 16087 + "duration": 21171 }, { "spec": "cypress/integration/rendering/flowchart-v2.spec.js", - "duration": 27465 + "duration": 37844 }, { "spec": "cypress/integration/rendering/flowchart.spec.js", - "duration": 20035 + "duration": 26254 }, { "spec": "cypress/integration/rendering/gantt.spec.js", - "duration": 11366 + "duration": 15149 }, { "spec": "cypress/integration/rendering/gitGraph.spec.js", - "duration": 34025 + "duration": 45049 }, { "spec": "cypress/integration/rendering/iconShape.spec.ts", - "duration": 185902 + "duration": 250225 }, { "spec": "cypress/integration/rendering/imageShape.spec.ts", - "duration": 41631 + "duration": 51531 }, { "spec": "cypress/integration/rendering/info.spec.ts", - "duration": 1736 + "duration": 2455 }, { "spec": "cypress/integration/rendering/journey.spec.js", - "duration": 2247 + "duration": 3181 + }, + { + "spec": "cypress/integration/rendering/kanban.spec.ts", + "duration": 6298 }, { "spec": "cypress/integration/rendering/katex.spec.js", - "duration": 2144 + "duration": 3065 }, { "spec": "cypress/integration/rendering/marker_unique_id.spec.js", - "duration": 1646 + "duration": 2521 }, { "spec": "cypress/integration/rendering/mindmap.spec.ts", - "duration": 6406 + "duration": 9341 }, { "spec": "cypress/integration/rendering/newShapes.spec.ts", - "duration": 107219 + "duration": 132809 + }, + { + "spec": "cypress/integration/rendering/oldShapes.spec.ts", + "duration": 101299 + }, + { + "spec": "cypress/integration/rendering/packet.spec.ts", + "duration": 3481 + }, + { + "spec": "cypress/integration/rendering/pie.spec.ts", + "duration": 4878 + }, + { + "spec": "cypress/integration/rendering/quadrantChart.spec.js", + "duration": 7416 + }, + { + "spec": "cypress/integration/rendering/radar.spec.js", + "duration": 4554 + }, + { + "spec": "cypress/integration/rendering/requirement.spec.js", + "duration": 2068 + }, + { + "spec": "cypress/integration/rendering/requirementDiagram-unified.spec.js", + "duration": 47583 + }, + { + "spec": "cypress/integration/rendering/sankey.spec.ts", + "duration": 5792 + }, + { + "spec": "cypress/integration/rendering/sequencediagram.spec.js", + "duration": 33035 + }, + { + "spec": "cypress/integration/rendering/stateDiagram-v2.spec.js", + "duration": 22716 }, { "spec": "cypress/integration/rendering/stateDiagram.spec.js", - "duration": 15834 + "duration": 13868 }, { "spec": "cypress/integration/rendering/theme.spec.js", - "duration": 33240 + "duration": 26376 }, { "spec": "cypress/integration/rendering/timeline.spec.ts", - "duration": 7122 + "duration": 5872 }, { "spec": "cypress/integration/rendering/xyChart.spec.js", - "duration": 11127 + "duration": 9469 }, { "spec": "cypress/integration/rendering/zenuml.spec.js", - "duration": 2391 + "duration": 2742 } ] } diff --git a/demos/index.html b/demos/index.html index 07b51a313..d615bf347 100644 --- a/demos/index.html +++ b/demos/index.html @@ -91,6 +91,9 @@
  • Architecture

  • +
  • +

    Radar

    +
  • diff --git a/demos/radar.html b/demos/radar.html new file mode 100644 index 000000000..16d03abfe --- /dev/null +++ b/demos/radar.html @@ -0,0 +1,157 @@ + + + + + + Mermaid Quick Test Page + + + + + +

    Radar diagram demo

    + +
    +
    +      radar-beta 
    +        title My favorite ninjas
    +        axis Agility, Speed, Strength
    +        axis Stam["Stamina"] , Intel["Intelligence"]
    +      
    +        curve Ninja1["Naruto"]{
    +            Agility 2, Speed 2,
    +            Strength 3, Stam 5,
    +            Intel 0
    +        }
    +        curve Ninja2["Sasuke"]{2, 3, 4, 1, 5}
    +        curve Ninja3["Ninja"] {3, 2, 1, 5, 4}
    +      
    +        showLegend true
    +        ticks 3
    +        max 8
    +        min 0
    +        graticule circle
    +    
    + +
    +      ---
    +      config:
    +        radar:
    +          axisScaleFactor: 0.25
    +          axisLabelFactor: 0.95
    +      ---
    +      radar-beta 
    +        title DevOps Radar
    +        axis f["Feature Velocity"], s["Stability"]
    +        axis r["Resilience"], e["Efficiency"]
    +        axis c["Cost"], d["DevSecOps"]
    +      
    +        curve app1["App1"]{
    +          f 5, s 4.5, r 3.8, d 4.2, e 4.5, c 3.5
    +        }
    +        curve app2["App2"]{4, 3, 4, 3, 3, 4}, app3["App3"]{3, 2, 4, 3, 2, 3}
    +        curve app4["App4"]{2, 1, 3.2, 2.5, 1, 2}
    +      
    +        showLegend true
    +        ticks 3
    +        max 5
    +        graticule polygon
    +    
    + +
    +      %%{init: {'theme': 'forest'} }%%
    +      radar-beta 
    +        title Forest theme
    +        axis Agility, Speed, Strength
    +        axis Stam["Stamina"] , Intel["Intelligence"]
    +      
    +        curve Ninja1["Naruto"]{
    +            Agility 2, Speed 2,
    +            Strength 3, Stam 5,
    +            Intel 0
    +        }
    +        curve Ninja2["Sasuke"]{2, 3, 4, 1, 5}
    +        curve Ninja3["Ninja"] {3, 2, 1, 5, 4}
    +    
    + +
    +      %%{init: {'theme': 'dark'} }%%
    +      radar-beta 
    +        title Dark theme
    +        axis Agility, Speed, Strength
    +        axis Stam["Stamina"] , Intel["Intelligence"]
    +      
    +        curve Ninja1["Naruto"]{
    +            Agility 2, Speed 2,
    +            Strength 3, Stam 5,
    +            Intel 0
    +        }
    +        curve Ninja2["Sasuke"]{2, 3, 4, 1, 5}
    +        curve Ninja3["Ninja"] {3, 2, 1, 5, 4}
    +    
    +
    +      %%{init: {'theme': 'base', 'themeVariables': {'cScale0': '#ff0000', 'cScale1': '#00ff00', 'cScale2': '#0000ff'}} }%%
    +      radar-beta 
    +        title Custom colors
    +        axis Agility, Speed, Strength
    +        axis Stam["Stamina"] , Intel["Intelligence"]
    +
    +        curve Ninja1["Naruto"]{
    +            Agility 2, Speed 2,
    +            Strength 3, Stam 5,
    +            Intel 0
    +        }
    +        curve Ninja2["Sasuke"]{2, 3, 4, 1, 5}
    +        curve Ninja3["Ninja"] {3, 2, 1, 5, 4}
    +    
    +
    +      ---
    +      config:
    +        radar:
    +          axisScaleFactor: 0.25
    +          curveTension: 0.1
    +        theme: base
    +        themeVariables:
    +          cScale0: "#FF0000"
    +          cScale1: "#00FF00"
    +          cScale2: "#0000FF"
    +          radar:
    +            curveOpacity: 0
    +      ---
    +      radar-beta
    +        title Custom colors, axisScaleFactor, curveTension, opacity
    +        axis A, B, C, D, E
    +        curve c1{1,2,3,4,5}
    +        curve c2{5,4,3,2,1}
    +        curve c3{3,3,3,3,3}
    +      
    +
    + + + + + diff --git a/docker-compose.yml b/docker-compose.yml index 5fa1ff04a..d2ee2a087 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,7 +17,7 @@ services: - 9000:9000 - 3333:3333 cypress: - image: cypress/included:13.7.3 + image: cypress/included:14.0.3 stdin_open: true tty: true working_dir: /mermaid diff --git a/docs/community/contributing.md b/docs/community/contributing.md index 792c90a98..b545d03b0 100644 --- a/docs/community/contributing.md +++ b/docs/community/contributing.md @@ -239,6 +239,22 @@ Code is the heart of every software project. We strive to make it better. Who if The core of Mermaid is located under `packages/mermaid/src`. +### Building Mermaid Locally + +**Host** + +```bash +pnpm run build +``` + +**Docker** + +```bash +./run build +``` + +This will build the Mermaid library and the documentation site. + ### Running Mermaid Locally **Host** diff --git a/docs/community/intro.md b/docs/community/intro.md index e14c84696..6b1430572 100644 --- a/docs/community/intro.md +++ b/docs/community/intro.md @@ -43,7 +43,7 @@ Where to start: - You could work on a new feature! [These](https://github.com/mermaid-js/mermaid/issues?q=is%3Aissue+is%3Aopen+label%3A%22Area%3A+Development%22+label%3A%22Type%3A+Enhancement%22+label%3A%22Status%3A+Approved%22+) are some ideas! - You could confirm the bugs in [these issues](https://github.com/mermaid-js/mermaid/issues?q=is%3Aissue+is%3Aopen+label%3A%22Status%3A+Triage%22++label%3A%22Type%3A+Bug+%2F+Error%22). -[You can join our Discord server if you want closer contact!](https://discord.gg/AgrbSrBer3) +[You can join our Discord server if you want closer contact!](https://discord.gg/sKeNQX4Wtj) ## A Question Or a Suggestion? @@ -55,6 +55,6 @@ If you have faced a vulnerability [report it to us](./security.md). Don't get daunted if it is hard in the beginning. We have a great community with only encouraging words. So, if you get stuck, ask for help and hints in the Slack forum. If you want to show off something good, show it off there. -[You can join our Discord server if you want closer contact!](https://discord.gg/AgrbSrBer3) +[You can join our Discord server if you want closer contact!](https://discord.gg/sKeNQX4Wtj) ![Image of superhero wishing you good luck](https://media.giphy.com/media/l49JHz7kJvl6MCj3G/giphy.gif) diff --git a/docs/config/setup/README.md b/docs/config/setup/README.md index 0727321c8..77dadc884 100644 --- a/docs/config/setup/README.md +++ b/docs/config/setup/README.md @@ -4,10 +4,14 @@ > > ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/README.md](../../../packages/mermaid/src/docs/config/setup/README.md). +**mermaid** + +--- + # mermaid ## Modules -- [config](modules/config.md) -- [defaultConfig](modules/defaultConfig.md) -- [mermaid](modules/mermaid.md) +- [config](config/README.md) +- [defaultConfig](defaultConfig/README.md) +- [mermaid](mermaid/README.md) diff --git a/docs/config/setup/classes/mermaid.UnknownDiagramError.md b/docs/config/setup/classes/mermaid.UnknownDiagramError.md deleted file mode 100644 index a3359c9d0..000000000 --- a/docs/config/setup/classes/mermaid.UnknownDiagramError.md +++ /dev/null @@ -1,171 +0,0 @@ -> **Warning** -> -> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. -> -> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/classes/mermaid.UnknownDiagramError.md](../../../../packages/mermaid/src/docs/config/setup/classes/mermaid.UnknownDiagramError.md). - -# Class: UnknownDiagramError - -[mermaid](../modules/mermaid.md).UnknownDiagramError - -## Hierarchy - -- `Error` - - โ†ณ **`UnknownDiagramError`** - -## Constructors - -### constructor - -โ€ข **new UnknownDiagramError**(`message`): [`UnknownDiagramError`](mermaid.UnknownDiagramError.md) - -#### Parameters - -| Name | Type | -| :-------- | :------- | -| `message` | `string` | - -#### Returns - -[`UnknownDiagramError`](mermaid.UnknownDiagramError.md) - -#### Overrides - -Error.constructor - -#### Defined in - -[packages/mermaid/src/errors.ts:2](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/errors.ts#L2) - -## Properties - -### cause - -โ€ข `Optional` **cause**: `unknown` - -#### Inherited from - -Error.cause - -#### Defined in - -node_modules/.pnpm/typescript\@5.4.5/node_modules/typescript/lib/lib.es2022.error.d.ts:24 - ---- - -### message - -โ€ข **message**: `string` - -#### Inherited from - -Error.message - -#### Defined in - -node_modules/.pnpm/typescript\@5.4.5/node_modules/typescript/lib/lib.es5.d.ts:1077 - ---- - -### name - -โ€ข **name**: `string` - -#### Inherited from - -Error.name - -#### Defined in - -node_modules/.pnpm/typescript\@5.4.5/node_modules/typescript/lib/lib.es5.d.ts:1076 - ---- - -### stack - -โ€ข `Optional` **stack**: `string` - -#### Inherited from - -Error.stack - -#### Defined in - -node_modules/.pnpm/typescript\@5.4.5/node_modules/typescript/lib/lib.es5.d.ts:1078 - ---- - -### prepareStackTrace - -โ–ช `Static` `Optional` **prepareStackTrace**: (`err`: `Error`, `stackTraces`: `CallSite`\[]) => `any` - -Optional override for formatting stack traces - -**`See`** - - - -#### Type declaration - -โ–ธ (`err`, `stackTraces`): `any` - -##### Parameters - -| Name | Type | -| :------------ | :------------ | -| `err` | `Error` | -| `stackTraces` | `CallSite`\[] | - -##### Returns - -`any` - -#### Inherited from - -Error.prepareStackTrace - -#### Defined in - -node_modules/.pnpm/@types+node\@20.16.11/node_modules/@types/node/globals.d.ts:98 - ---- - -### stackTraceLimit - -โ–ช `Static` **stackTraceLimit**: `number` - -#### Inherited from - -Error.stackTraceLimit - -#### Defined in - -node_modules/.pnpm/@types+node\@20.16.11/node_modules/@types/node/globals.d.ts:100 - -## Methods - -### captureStackTrace - -โ–ธ **captureStackTrace**(`targetObject`, `constructorOpt?`): `void` - -Create .stack property on a target object - -#### Parameters - -| Name | Type | -| :---------------- | :--------- | -| `targetObject` | `object` | -| `constructorOpt?` | `Function` | - -#### Returns - -`void` - -#### Inherited from - -Error.captureStackTrace - -#### Defined in - -node_modules/.pnpm/@types+node\@20.16.11/node_modules/@types/node/globals.d.ts:91 diff --git a/docs/config/setup/config/README.md b/docs/config/setup/config/README.md new file mode 100644 index 000000000..67fca78eb --- /dev/null +++ b/docs/config/setup/config/README.md @@ -0,0 +1,28 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/config/README.md](../../../../packages/mermaid/src/docs/config/setup/config/README.md). + +[**mermaid**](../README.md) + +--- + +# config + +## Variables + +- [defaultConfig](variables/defaultConfig.md) + +## Functions + +- [addDirective](functions/addDirective.md) +- [getConfig](functions/getConfig.md) +- [getSiteConfig](functions/getSiteConfig.md) +- [reset](functions/reset.md) +- [sanitize](functions/sanitize.md) +- [saveConfigFromInitialize](functions/saveConfigFromInitialize.md) +- [setConfig](functions/setConfig.md) +- [setSiteConfig](functions/setSiteConfig.md) +- [updateCurrentConfig](functions/updateCurrentConfig.md) +- [updateSiteConfig](functions/updateSiteConfig.md) diff --git a/docs/config/setup/config/functions/addDirective.md b/docs/config/setup/config/functions/addDirective.md new file mode 100644 index 000000000..1e51c0108 --- /dev/null +++ b/docs/config/setup/config/functions/addDirective.md @@ -0,0 +1,29 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/config/functions/addDirective.md](../../../../../packages/mermaid/src/docs/config/setup/config/functions/addDirective.md). + +[**mermaid**](../../README.md) + +--- + +# Function: addDirective() + +> **addDirective**(`directive`): `void` + +Defined in: [packages/mermaid/src/config.ts:188](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L188) + +Pushes in a directive to the configuration + +## Parameters + +### directive + +[`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md) + +The directive to push in + +## Returns + +`void` diff --git a/docs/config/setup/config/functions/getConfig.md b/docs/config/setup/config/functions/getConfig.md new file mode 100644 index 000000000..0d5a7dc26 --- /dev/null +++ b/docs/config/setup/config/functions/getConfig.md @@ -0,0 +1,29 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/config/functions/getConfig.md](../../../../../packages/mermaid/src/docs/config/setup/config/functions/getConfig.md). + +[**mermaid**](../../README.md) + +--- + +# Function: getConfig() + +> **getConfig**(): [`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md) + +Defined in: [packages/mermaid/src/config.ts:131](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L131) + +## getConfig + +| Function | Description | Type | Return Values | +| --------- | ------------------------- | ----------- | ------------------------------ | +| getConfig | Obtains the currentConfig | Get Request | Any Values from current Config | + +**Notes**: Avoid calling this function repeatedly. Instead, store the result in a variable and use it, and pass it down to function calls. + +## Returns + +[`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md) + +The currentConfig diff --git a/docs/config/setup/config/functions/getSiteConfig.md b/docs/config/setup/config/functions/getSiteConfig.md new file mode 100644 index 000000000..f6490eb59 --- /dev/null +++ b/docs/config/setup/config/functions/getSiteConfig.md @@ -0,0 +1,29 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/config/functions/getSiteConfig.md](../../../../../packages/mermaid/src/docs/config/setup/config/functions/getSiteConfig.md). + +[**mermaid**](../../README.md) + +--- + +# Function: getSiteConfig() + +> **getSiteConfig**(): [`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md) + +Defined in: [packages/mermaid/src/config.ts:96](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L96) + +## getSiteConfig + +| Function | Description | Type | Values | +| ------------- | ------------------------------------------------- | ----------- | -------------------------------- | +| setSiteConfig | Returns the current siteConfig base configuration | Get Request | Returns Any Values in siteConfig | + +**Notes**: Returns **any** values in siteConfig. + +## Returns + +[`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md) + +The siteConfig diff --git a/docs/config/setup/config/functions/reset.md b/docs/config/setup/config/functions/reset.md new file mode 100644 index 000000000..914537e44 --- /dev/null +++ b/docs/config/setup/config/functions/reset.md @@ -0,0 +1,42 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/config/functions/reset.md](../../../../../packages/mermaid/src/docs/config/setup/config/functions/reset.md). + +[**mermaid**](../../README.md) + +--- + +# Function: reset() + +> **reset**(`config`): `void` + +Defined in: [packages/mermaid/src/config.ts:221](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L221) + +## reset + +| Function | Description | Type | Required | Values | +| -------- | ---------------------------- | ----------- | -------- | ------ | +| reset | Resets currentConfig to conf | Put Request | Required | None | + +## conf + +| Parameter | Description | Type | Required | Values | +| --------- | -------------------------------------------------------------- | ---------- | -------- | -------------------------------------------- | +| conf | base set of values, which currentConfig could be **reset** to. | Dictionary | Required | Any Values, with respect to the secure Array | + +**Notes**: (default: current siteConfig ) (optional, default `getSiteConfig()`) + +## Parameters + +### config + +[`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md) = `siteConfig` + +base set of values, which currentConfig could be **reset** to. +Defaults to the current siteConfig (e.g returned by [getSiteConfig](getSiteConfig.md)). + +## Returns + +`void` diff --git a/docs/config/setup/config/functions/sanitize.md b/docs/config/setup/config/functions/sanitize.md new file mode 100644 index 000000000..ce69da673 --- /dev/null +++ b/docs/config/setup/config/functions/sanitize.md @@ -0,0 +1,36 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/config/functions/sanitize.md](../../../../../packages/mermaid/src/docs/config/setup/config/functions/sanitize.md). + +[**mermaid**](../../README.md) + +--- + +# Function: sanitize() + +> **sanitize**(`options`): `void` + +Defined in: [packages/mermaid/src/config.ts:146](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L146) + +## sanitize + +| Function | Description | Type | Values | +| -------- | -------------------------------------- | ----------- | ------ | +| sanitize | Sets the siteConfig to desired values. | Put Request | None | + +Ensures options parameter does not attempt to override siteConfig secure keys **Notes**: modifies +options in-place + +## Parameters + +### options + +`any` + +The potential setConfig parameter + +## Returns + +`void` diff --git a/docs/config/setup/config/functions/saveConfigFromInitialize.md b/docs/config/setup/config/functions/saveConfigFromInitialize.md new file mode 100644 index 000000000..e911f493d --- /dev/null +++ b/docs/config/setup/config/functions/saveConfigFromInitialize.md @@ -0,0 +1,25 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/config/functions/saveConfigFromInitialize.md](../../../../../packages/mermaid/src/docs/config/setup/config/functions/saveConfigFromInitialize.md). + +[**mermaid**](../../README.md) + +--- + +# Function: saveConfigFromInitialize() + +> **saveConfigFromInitialize**(`conf`): `void` + +Defined in: [packages/mermaid/src/config.ts:75](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L75) + +## Parameters + +### conf + +[`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md) + +## Returns + +`void` diff --git a/docs/config/setup/config/functions/setConfig.md b/docs/config/setup/config/functions/setConfig.md new file mode 100644 index 000000000..3ef79580c --- /dev/null +++ b/docs/config/setup/config/functions/setConfig.md @@ -0,0 +1,39 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/config/functions/setConfig.md](../../../../../packages/mermaid/src/docs/config/setup/config/functions/setConfig.md). + +[**mermaid**](../../README.md) + +--- + +# Function: setConfig() + +> **setConfig**(`conf`): [`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md) + +Defined in: [packages/mermaid/src/config.ts:113](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L113) + +## setConfig + +| Function | Description | Type | Values | +| ------------- | ------------------------------------- | ----------- | --------------------------------------- | +| setSiteConfig | Sets the siteConfig to desired values | Put Request | Any Values, except ones in secure array | + +**Notes**: Sets the currentConfig. The parameter conf is sanitized based on the siteConfig.secure +keys. Any values found in conf with key found in siteConfig.secure will be replaced with the +corresponding siteConfig value. + +## Parameters + +### conf + +[`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md) + +The potential currentConfig + +## Returns + +[`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md) + +The currentConfig merged with the sanitized conf diff --git a/docs/config/setup/config/functions/setSiteConfig.md b/docs/config/setup/config/functions/setSiteConfig.md new file mode 100644 index 000000000..d2be54b88 --- /dev/null +++ b/docs/config/setup/config/functions/setSiteConfig.md @@ -0,0 +1,40 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/config/functions/setSiteConfig.md](../../../../../packages/mermaid/src/docs/config/setup/config/functions/setSiteConfig.md). + +[**mermaid**](../../README.md) + +--- + +# Function: setSiteConfig() + +> **setSiteConfig**(`conf`): [`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md) + +Defined in: [packages/mermaid/src/config.ts:61](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L61) + +## setSiteConfig + +| Function | Description | Type | Values | +| ------------- | ------------------------------------- | ----------- | --------------------------------------- | +| setSiteConfig | Sets the siteConfig to desired values | Put Request | Any Values, except ones in secure array | + +**Notes:** Sets the siteConfig. The siteConfig is a protected configuration for repeat use. Calls +to reset() will reset the currentConfig to siteConfig. Calls to reset(configApi.defaultConfig) +will reset siteConfig and currentConfig to the defaultConfig Note: currentConfig is set in this +function _Default value: At default, will mirror Global Config_ + +## Parameters + +### conf + +[`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md) + +The base currentConfig to use as siteConfig + +## Returns + +[`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md) + +The new siteConfig diff --git a/docs/config/setup/config/functions/updateCurrentConfig.md b/docs/config/setup/config/functions/updateCurrentConfig.md new file mode 100644 index 000000000..d90b4f497 --- /dev/null +++ b/docs/config/setup/config/functions/updateCurrentConfig.md @@ -0,0 +1,29 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/config/functions/updateCurrentConfig.md](../../../../../packages/mermaid/src/docs/config/setup/config/functions/updateCurrentConfig.md). + +[**mermaid**](../../README.md) + +--- + +# Function: updateCurrentConfig() + +> **updateCurrentConfig**(`siteCfg`, `_directives`): [`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md) + +Defined in: [packages/mermaid/src/config.ts:15](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L15) + +## Parameters + +### siteCfg + +[`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md) + +### \_directives + +[`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md)\[] + +## Returns + +[`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md) diff --git a/docs/config/setup/config/functions/updateSiteConfig.md b/docs/config/setup/config/functions/updateSiteConfig.md new file mode 100644 index 000000000..ba98ede2b --- /dev/null +++ b/docs/config/setup/config/functions/updateSiteConfig.md @@ -0,0 +1,25 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/config/functions/updateSiteConfig.md](../../../../../packages/mermaid/src/docs/config/setup/config/functions/updateSiteConfig.md). + +[**mermaid**](../../README.md) + +--- + +# Function: updateSiteConfig() + +> **updateSiteConfig**(`conf`): [`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md) + +Defined in: [packages/mermaid/src/config.ts:79](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L79) + +## Parameters + +### conf + +[`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md) + +## Returns + +[`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md) diff --git a/docs/config/setup/config/variables/defaultConfig.md b/docs/config/setup/config/variables/defaultConfig.md new file mode 100644 index 000000000..3b08411fd --- /dev/null +++ b/docs/config/setup/config/variables/defaultConfig.md @@ -0,0 +1,15 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/config/variables/defaultConfig.md](../../../../../packages/mermaid/src/docs/config/setup/config/variables/defaultConfig.md). + +[**mermaid**](../../README.md) + +--- + +# Variable: defaultConfig + +> `const` **defaultConfig**: [`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md) + +Defined in: [packages/mermaid/src/config.ts:8](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L8) diff --git a/docs/config/setup/defaultConfig/README.md b/docs/config/setup/defaultConfig/README.md new file mode 100644 index 000000000..8554f8a8c --- /dev/null +++ b/docs/config/setup/defaultConfig/README.md @@ -0,0 +1,16 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/defaultConfig/README.md](../../../../packages/mermaid/src/docs/config/setup/defaultConfig/README.md). + +[**mermaid**](../README.md) + +--- + +# defaultConfig + +## Variables + +- [configKeys](variables/configKeys.md) +- [default](variables/default.md) diff --git a/docs/config/setup/defaultConfig/variables/configKeys.md b/docs/config/setup/defaultConfig/variables/configKeys.md new file mode 100644 index 000000000..4687ad8bc --- /dev/null +++ b/docs/config/setup/defaultConfig/variables/configKeys.md @@ -0,0 +1,15 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/defaultConfig/variables/configKeys.md](../../../../../packages/mermaid/src/docs/config/setup/defaultConfig/variables/configKeys.md). + +[**mermaid**](../../README.md) + +--- + +# Variable: configKeys + +> `const` **configKeys**: `Set`<`string`> + +Defined in: [packages/mermaid/src/defaultConfig.ts:274](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/defaultConfig.ts#L274) diff --git a/docs/config/setup/defaultConfig/variables/default.md b/docs/config/setup/defaultConfig/variables/default.md new file mode 100644 index 000000000..ccb6d1302 --- /dev/null +++ b/docs/config/setup/defaultConfig/variables/default.md @@ -0,0 +1,21 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/defaultConfig/variables/default.md](../../../../../packages/mermaid/src/docs/config/setup/defaultConfig/variables/default.md). + +[**mermaid**](../../README.md) + +--- + +# Variable: default + +> `const` **default**: `RequiredDeep`<[`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md)> + +Defined in: [packages/mermaid/src/defaultConfig.ts:18](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/defaultConfig.ts#L18) + +Default mermaid configuration options. + +Please see the Mermaid config JSON Schema for the default JSON values. +Non-JSON JS default values are listed in this file, e.g. functions, or +`undefined` (explicitly set so that `configKeys` finds them). diff --git a/docs/config/setup/interfaces/mermaid.DetailedError.md b/docs/config/setup/interfaces/mermaid.DetailedError.md deleted file mode 100644 index 3b019e58a..000000000 --- a/docs/config/setup/interfaces/mermaid.DetailedError.md +++ /dev/null @@ -1,49 +0,0 @@ -> **Warning** -> -> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. -> -> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/interfaces/mermaid.DetailedError.md](../../../../packages/mermaid/src/docs/config/setup/interfaces/mermaid.DetailedError.md). - -# Interface: DetailedError - -[mermaid](../modules/mermaid.md).DetailedError - -## Properties - -### error - -โ€ข `Optional` **error**: `any` - -#### Defined in - -[packages/mermaid/src/utils.ts:785](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/utils.ts#L785) - ---- - -### hash - -โ€ข **hash**: `any` - -#### Defined in - -[packages/mermaid/src/utils.ts:783](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/utils.ts#L783) - ---- - -### message - -โ€ข `Optional` **message**: `string` - -#### Defined in - -[packages/mermaid/src/utils.ts:786](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/utils.ts#L786) - ---- - -### str - -โ€ข **str**: `string` - -#### Defined in - -[packages/mermaid/src/utils.ts:781](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/utils.ts#L781) diff --git a/docs/config/setup/interfaces/mermaid.ExternalDiagramDefinition.md b/docs/config/setup/interfaces/mermaid.ExternalDiagramDefinition.md deleted file mode 100644 index 04f97f2bc..000000000 --- a/docs/config/setup/interfaces/mermaid.ExternalDiagramDefinition.md +++ /dev/null @@ -1,39 +0,0 @@ -> **Warning** -> -> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. -> -> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/interfaces/mermaid.ExternalDiagramDefinition.md](../../../../packages/mermaid/src/docs/config/setup/interfaces/mermaid.ExternalDiagramDefinition.md). - -# Interface: ExternalDiagramDefinition - -[mermaid](../modules/mermaid.md).ExternalDiagramDefinition - -## Properties - -### detector - -โ€ข **detector**: `DiagramDetector` - -#### Defined in - -[packages/mermaid/src/diagram-api/types.ts:101](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/diagram-api/types.ts#L101) - ---- - -### id - -โ€ข **id**: `string` - -#### Defined in - -[packages/mermaid/src/diagram-api/types.ts:100](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/diagram-api/types.ts#L100) - ---- - -### loader - -โ€ข **loader**: `DiagramLoader` - -#### Defined in - -[packages/mermaid/src/diagram-api/types.ts:102](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/diagram-api/types.ts#L102) diff --git a/docs/config/setup/interfaces/mermaid.LayoutData.md b/docs/config/setup/interfaces/mermaid.LayoutData.md deleted file mode 100644 index 46c9134e8..000000000 --- a/docs/config/setup/interfaces/mermaid.LayoutData.md +++ /dev/null @@ -1,43 +0,0 @@ -> **Warning** -> -> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. -> -> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/interfaces/mermaid.LayoutData.md](../../../../packages/mermaid/src/docs/config/setup/interfaces/mermaid.LayoutData.md). - -# Interface: LayoutData - -[mermaid](../modules/mermaid.md).LayoutData - -## Indexable - -โ–ช \[key: `string`]: `any` - -## Properties - -### config - -โ€ข **config**: [`MermaidConfig`](mermaid.MermaidConfig.md) - -#### Defined in - -[packages/mermaid/src/rendering-util/types.ts:148](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/types.ts#L148) - ---- - -### edges - -โ€ข **edges**: `Edge`\[] - -#### Defined in - -[packages/mermaid/src/rendering-util/types.ts:147](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/types.ts#L147) - ---- - -### nodes - -โ€ข **nodes**: `Node`\[] - -#### Defined in - -[packages/mermaid/src/rendering-util/types.ts:146](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/types.ts#L146) diff --git a/docs/config/setup/interfaces/mermaid.LayoutLoaderDefinition.md b/docs/config/setup/interfaces/mermaid.LayoutLoaderDefinition.md deleted file mode 100644 index 90a64187c..000000000 --- a/docs/config/setup/interfaces/mermaid.LayoutLoaderDefinition.md +++ /dev/null @@ -1,39 +0,0 @@ -> **Warning** -> -> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. -> -> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/interfaces/mermaid.LayoutLoaderDefinition.md](../../../../packages/mermaid/src/docs/config/setup/interfaces/mermaid.LayoutLoaderDefinition.md). - -# Interface: LayoutLoaderDefinition - -[mermaid](../modules/mermaid.md).LayoutLoaderDefinition - -## Properties - -### algorithm - -โ€ข `Optional` **algorithm**: `string` - -#### Defined in - -[packages/mermaid/src/rendering-util/render.ts:24](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/render.ts#L24) - ---- - -### loader - -โ€ข **loader**: `LayoutLoader` - -#### Defined in - -[packages/mermaid/src/rendering-util/render.ts:23](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/render.ts#L23) - ---- - -### name - -โ€ข **name**: `string` - -#### Defined in - -[packages/mermaid/src/rendering-util/render.ts:22](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/render.ts#L22) diff --git a/docs/config/setup/interfaces/mermaid.Mermaid.md b/docs/config/setup/interfaces/mermaid.Mermaid.md deleted file mode 100644 index f4e9eb4ec..000000000 --- a/docs/config/setup/interfaces/mermaid.Mermaid.md +++ /dev/null @@ -1,388 +0,0 @@ -> **Warning** -> -> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. -> -> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/interfaces/mermaid.Mermaid.md](../../../../packages/mermaid/src/docs/config/setup/interfaces/mermaid.Mermaid.md). - -# Interface: Mermaid - -[mermaid](../modules/mermaid.md).Mermaid - -## Properties - -### contentLoaded - -โ€ข **contentLoaded**: () => `void` - -#### Type declaration - -โ–ธ (): `void` - -\##contentLoaded Callback function that is called when page is loaded. This functions fetches -configuration for mermaid rendering and calls init for rendering the mermaid diagrams on the -page. - -##### Returns - -`void` - -#### Defined in - -[packages/mermaid/src/mermaid.ts:436](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L436) - ---- - -### detectType - -โ€ข **detectType**: (`text`: `string`, `config?`: [`MermaidConfig`](mermaid.MermaidConfig.md)) => `string` - -#### Type declaration - -โ–ธ (`text`, `config?`): `string` - -Detects the type of the graph text. - -Takes into consideration the possible existence of an `%%init` directive - -##### Parameters - -| Name | Type | Description | -| :-------- | :------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `text` | `string` | The text defining the graph. For example: `mermaid %%{initialize: {"startOnLoad": true, logLevel: "fatal" }}%% graph LR a-->b b-->c c-->d d-->e e-->f f-->g g-->h ` | -| `config?` | [`MermaidConfig`](mermaid.MermaidConfig.md) | The mermaid config. | - -##### Returns - -`string` - -A graph definition key - -#### Defined in - -[packages/mermaid/src/mermaid.ts:438](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L438) - ---- - -### init - -โ€ข **init**: (`config?`: [`MermaidConfig`](mermaid.MermaidConfig.md), `nodes?`: `string` | `HTMLElement` | `NodeListOf`<`HTMLElement`>, `callback?`: (`id`: `string`) => `unknown`) => `Promise`<`void`> - -**`Deprecated`** - -Use [initialize](mermaid.Mermaid.md#initialize) and [run](mermaid.Mermaid.md#run) instead. - -#### Type declaration - -โ–ธ (`config?`, `nodes?`, `callback?`): `Promise`<`void`> - -##### Parameters - -| Name | Type | -| :---------- | :------------------------------------------------------- | -| `config?` | [`MermaidConfig`](mermaid.MermaidConfig.md) | -| `nodes?` | `string` \| `HTMLElement` \| `NodeListOf`<`HTMLElement`> | -| `callback?` | (`id`: `string`) => `unknown` | - -##### Returns - -`Promise`<`void`> - -#### Defined in - -[packages/mermaid/src/mermaid.ts:431](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L431) - ---- - -### initialize - -โ€ข **initialize**: (`config`: [`MermaidConfig`](mermaid.MermaidConfig.md)) => `void` - -#### Type declaration - -โ–ธ (`config`): `void` - -Used to set configurations for mermaid. -This function should be called before the run function. - -##### Parameters - -| Name | Type | Description | -| :------- | :------------------------------------------ | :-------------------------------- | -| `config` | [`MermaidConfig`](mermaid.MermaidConfig.md) | Configuration object for mermaid. | - -##### Returns - -`void` - -#### Defined in - -[packages/mermaid/src/mermaid.ts:435](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L435) - ---- - -### mermaidAPI - -โ€ข **mermaidAPI**: `Readonly`<{ `defaultConfig`: [`MermaidConfig`](mermaid.MermaidConfig.md) = configApi.defaultConfig; `getConfig`: () => [`MermaidConfig`](mermaid.MermaidConfig.md) = configApi.getConfig; `getDiagramFromText`: (`text`: `string`, `metadata`: `Pick`<`DiagramMetadata`, `"title"`>) => `Promise`<`Diagram`> ; `getSiteConfig`: () => [`MermaidConfig`](mermaid.MermaidConfig.md) = configApi.getSiteConfig; `globalReset`: () => `void` ; `initialize`: (`userOptions`: [`MermaidConfig`](mermaid.MermaidConfig.md)) => `void` ; `parse`: (`text`: `string`, `parseOptions`: [`ParseOptions`](mermaid.ParseOptions.md) & { `suppressErrors`: `true` }) => `Promise`<[`ParseResult`](mermaid.ParseResult.md) | `false`>(`text`: `string`, `parseOptions?`: [`ParseOptions`](mermaid.ParseOptions.md)) => `Promise`<[`ParseResult`](mermaid.ParseResult.md)> ; `render`: (`id`: `string`, `text`: `string`, `svgContainingElement?`: `Element`) => `Promise`<[`RenderResult`](mermaid.RenderResult.md)> ; `reset`: () => `void` ; `setConfig`: (`conf`: [`MermaidConfig`](mermaid.MermaidConfig.md)) => [`MermaidConfig`](mermaid.MermaidConfig.md) = configApi.setConfig; `updateSiteConfig`: (`conf`: [`MermaidConfig`](mermaid.MermaidConfig.md)) => [`MermaidConfig`](mermaid.MermaidConfig.md) = configApi.updateSiteConfig }> - -**`Deprecated`** - -Use [parse](mermaid.Mermaid.md#parse) and [render](mermaid.Mermaid.md#render) instead. Please [open a discussion](https://github.com/mermaid-js/mermaid/discussions) if your use case does not fit the new API. - -#### Defined in - -[packages/mermaid/src/mermaid.ts:425](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L425) - ---- - -### parse - -โ€ข **parse**: (`text`: `string`, `parseOptions`: [`ParseOptions`](mermaid.ParseOptions.md) & { `suppressErrors`: `true` }) => `Promise`<[`ParseResult`](mermaid.ParseResult.md) | `false`>(`text`: `string`, `parseOptions?`: [`ParseOptions`](mermaid.ParseOptions.md)) => `Promise`<[`ParseResult`](mermaid.ParseResult.md)> - -#### Type declaration - -โ–ธ (`text`, `parseOptions`): `Promise`<[`ParseResult`](mermaid.ParseResult.md) | `false`> - -Parse the text and validate the syntax. - -##### Parameters - -| Name | Type | Description | -| :------------- | :----------------------------------------------------------------------- | :------------------------------ | -| `text` | `string` | The mermaid diagram definition. | -| `parseOptions` | [`ParseOptions`](mermaid.ParseOptions.md) & { `suppressErrors`: `true` } | Options for parsing. | - -##### Returns - -`Promise`<[`ParseResult`](mermaid.ParseResult.md) | `false`> - -An object with the `diagramType` set to type of the diagram if valid. Otherwise `false` if parseOptions.suppressErrors is `true`. - -**`See`** - -[ParseOptions](mermaid.ParseOptions.md) - -**`Throws`** - -Error if the diagram is invalid and parseOptions.suppressErrors is false or not set. - -โ–ธ (`text`, `parseOptions?`): `Promise`<[`ParseResult`](mermaid.ParseResult.md)> - -##### Parameters - -| Name | Type | -| :-------------- | :---------------------------------------- | -| `text` | `string` | -| `parseOptions?` | [`ParseOptions`](mermaid.ParseOptions.md) | - -##### Returns - -`Promise`<[`ParseResult`](mermaid.ParseResult.md)> - -#### Defined in - -[packages/mermaid/src/mermaid.ts:426](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L426) - ---- - -### parseError - -โ€ข `Optional` **parseError**: [`ParseErrorFunction`](../modules/mermaid.md#parseerrorfunction) - -#### Defined in - -[packages/mermaid/src/mermaid.ts:420](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L420) - ---- - -### registerExternalDiagrams - -โ€ข **registerExternalDiagrams**: (`diagrams`: [`ExternalDiagramDefinition`](mermaid.ExternalDiagramDefinition.md)\[], `opts`: { `lazyLoad?`: `boolean` = true }) => `Promise`<`void`> - -#### Type declaration - -โ–ธ (`diagrams`, `opts?`): `Promise`<`void`> - -Used to register external diagram types. - -##### Parameters - -| Name | Type | Default value | Description | -| :--------------- | :--------------------------------------------------------------------- | :------------ | :-------------------------------------------------------------------------- | -| `diagrams` | [`ExternalDiagramDefinition`](mermaid.ExternalDiagramDefinition.md)\[] | `undefined` | Array of [ExternalDiagramDefinition](mermaid.ExternalDiagramDefinition.md). | -| `opts` | `Object` | `{}` | If opts.lazyLoad is false, the diagrams will be loaded immediately. | -| `opts.lazyLoad?` | `boolean` | `true` | - | - -##### Returns - -`Promise`<`void`> - -#### Defined in - -[packages/mermaid/src/mermaid.ts:434](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L434) - ---- - -### registerIconPacks - -โ€ข **registerIconPacks**: (`iconLoaders`: `IconLoader`\[]) => `void` - -#### Type declaration - -โ–ธ (`iconLoaders`): `void` - -##### Parameters - -| Name | Type | -| :------------ | :-------------- | -| `iconLoaders` | `IconLoader`\[] | - -##### Returns - -`void` - -#### Defined in - -[packages/mermaid/src/mermaid.ts:439](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L439) - ---- - -### registerLayoutLoaders - -โ€ข **registerLayoutLoaders**: (`loaders`: [`LayoutLoaderDefinition`](mermaid.LayoutLoaderDefinition.md)\[]) => `void` - -#### Type declaration - -โ–ธ (`loaders`): `void` - -##### Parameters - -| Name | Type | -| :-------- | :--------------------------------------------------------------- | -| `loaders` | [`LayoutLoaderDefinition`](mermaid.LayoutLoaderDefinition.md)\[] | - -##### Returns - -`void` - -#### Defined in - -[packages/mermaid/src/mermaid.ts:433](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L433) - ---- - -### render - -โ€ข **render**: (`id`: `string`, `text`: `string`, `svgContainingElement?`: `Element`) => `Promise`<[`RenderResult`](mermaid.RenderResult.md)> - -#### Type declaration - -โ–ธ (`id`, `text`, `svgContainingElement?`): `Promise`<[`RenderResult`](mermaid.RenderResult.md)> - -##### Parameters - -| Name | Type | -| :---------------------- | :-------- | -| `id` | `string` | -| `text` | `string` | -| `svgContainingElement?` | `Element` | - -##### Returns - -`Promise`<[`RenderResult`](mermaid.RenderResult.md)> - -#### Defined in - -[packages/mermaid/src/mermaid.ts:427](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L427) - ---- - -### run - -โ€ข **run**: (`options`: [`RunOptions`](mermaid.RunOptions.md)) => `Promise`<`void`> - -#### Type declaration - -โ–ธ (`options?`): `Promise`<`void`> - -## run - -Function that goes through the document to find the chart definitions in there and render them. - -The function tags the processed attributes with the attribute data-processed and ignores found -elements with the attribute already set. This way the init function can be triggered several -times. - -```mermaid-example -graph LR; - a(Find elements)-->b{Processed} - b-->|Yes|c(Leave element) - b-->|No |d(Transform) -``` - -```mermaid -graph LR; - a(Find elements)-->b{Processed} - b-->|Yes|c(Leave element) - b-->|No |d(Transform) -``` - -Renders the mermaid diagrams - -##### Parameters - -| Name | Type | Description | -| :-------- | :------------------------------------ | :----------------------- | -| `options` | [`RunOptions`](mermaid.RunOptions.md) | Optional runtime configs | - -##### Returns - -`Promise`<`void`> - -#### Defined in - -[packages/mermaid/src/mermaid.ts:432](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L432) - ---- - -### setParseErrorHandler - -โ€ข **setParseErrorHandler**: (`parseErrorHandler`: (`err`: `any`, `hash`: `any`) => `void`) => `void` - -#### Type declaration - -โ–ธ (`parseErrorHandler`): `void` - -## setParseErrorHandler Alternative to directly setting parseError using: - -```js -mermaid.parseError = function (err, hash) { - forExampleDisplayErrorInGui(err); // do something with the error -}; -``` - -This is provided for environments where the mermaid object can't directly have a new member added -to it (eg. dart interop wrapper). (Initially there is no parseError member of mermaid). - -##### Parameters - -| Name | Type | Description | -| :------------------ | :-------------------------------------- | :------------------------- | -| `parseErrorHandler` | (`err`: `any`, `hash`: `any`) => `void` | New parseError() callback. | - -##### Returns - -`void` - -#### Defined in - -[packages/mermaid/src/mermaid.ts:437](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L437) - ---- - -### startOnLoad - -โ€ข **startOnLoad**: `boolean` - -#### Defined in - -[packages/mermaid/src/mermaid.ts:419](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L419) diff --git a/docs/config/setup/interfaces/mermaid.MermaidConfig.md b/docs/config/setup/interfaces/mermaid.MermaidConfig.md deleted file mode 100644 index 14c348145..000000000 --- a/docs/config/setup/interfaces/mermaid.MermaidConfig.md +++ /dev/null @@ -1,541 +0,0 @@ -> **Warning** -> -> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. -> -> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/interfaces/mermaid.MermaidConfig.md](../../../../packages/mermaid/src/docs/config/setup/interfaces/mermaid.MermaidConfig.md). - -# Interface: MermaidConfig - -[mermaid](../modules/mermaid.md).MermaidConfig - -## Properties - -### altFontFamily - -โ€ข `Optional` **altFontFamily**: `string` - -#### Defined in - -[packages/mermaid/src/config.type.ts:122](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L122) - ---- - -### architecture - -โ€ข `Optional` **architecture**: `ArchitectureDiagramConfig` - -#### Defined in - -[packages/mermaid/src/config.type.ts:194](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L194) - ---- - -### arrowMarkerAbsolute - -โ€ข `Optional` **arrowMarkerAbsolute**: `boolean` - -Controls whether or arrow markers in html code are absolute paths or anchors. -This matters if you are using base tag settings. - -#### Defined in - -[packages/mermaid/src/config.type.ts:141](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L141) - ---- - -### block - -โ€ข `Optional` **block**: `BlockDiagramConfig` - -#### Defined in - -[packages/mermaid/src/config.type.ts:201](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L201) - ---- - -### c4 - -โ€ข `Optional` **c4**: `C4DiagramConfig` - -#### Defined in - -[packages/mermaid/src/config.type.ts:198](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L198) - ---- - -### class - -โ€ข `Optional` **class**: `ClassDiagramConfig` - -#### Defined in - -[packages/mermaid/src/config.type.ts:187](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L187) - ---- - -### darkMode - -โ€ข `Optional` **darkMode**: `boolean` - -#### Defined in - -[packages/mermaid/src/config.type.ts:113](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L113) - ---- - -### deterministicIDSeed - -โ€ข `Optional` **deterministicIDSeed**: `string` - -This option is the optional seed for deterministic ids. -If set to `undefined` but deterministicIds is `true`, a simple number iterator is used. -You can set this attribute to base the seed on a static string. - -#### Defined in - -[packages/mermaid/src/config.type.ts:181](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L181) - ---- - -### deterministicIds - -โ€ข `Optional` **deterministicIds**: `boolean` - -This option controls if the generated ids of nodes in the SVG are -generated randomly or based on a seed. -If set to `false`, the IDs are generated based on the current date and -thus are not deterministic. This is the default behavior. - -This matters if your files are checked into source control e.g. git and -should not change unless content is changed. - -#### Defined in - -[packages/mermaid/src/config.type.ts:174](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L174) - ---- - -### dompurifyConfig - -โ€ข `Optional` **dompurifyConfig**: `Config` - -#### Defined in - -[packages/mermaid/src/config.type.ts:202](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L202) - ---- - -### elk - -โ€ข `Optional` **elk**: `Object` - -#### Type declaration - -| Name | Type | Description | -| :----------------------- | :-------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cycleBreakingStrategy?` | `"GREEDY"` \| `"DEPTH_FIRST"` \| `"INTERACTIVE"` \| `"MODEL_ORDER"` \| `"GREEDY_MODEL_ORDER"` | This strategy decides how to find cycles in the graph and deciding which edges need adjustment to break loops. | -| `mergeEdges?` | `boolean` | Elk specific option that allows edges to share path where it convenient. It can make for pretty diagrams but can also make it harder to read the diagram. | -| `nodePlacementStrategy?` | `"SIMPLE"` \| `"NETWORK_SIMPLEX"` \| `"LINEAR_SEGMENTS"` \| `"BRANDES_KOEPF"` | Elk specific option affecting how nodes are placed. | - -#### Defined in - -[packages/mermaid/src/config.type.ts:91](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L91) - ---- - -### er - -โ€ข `Optional` **er**: `ErDiagramConfig` - -#### Defined in - -[packages/mermaid/src/config.type.ts:189](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L189) - ---- - -### flowchart - -โ€ข `Optional` **flowchart**: `FlowchartDiagramConfig` - -#### Defined in - -[packages/mermaid/src/config.type.ts:182](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L182) - ---- - -### fontFamily - -โ€ข `Optional` **fontFamily**: `string` - -Specifies the font to be used in the rendered diagrams. -Can be any possible CSS `font-family`. -See - -#### Defined in - -[packages/mermaid/src/config.type.ts:121](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L121) - ---- - -### fontSize - -โ€ข `Optional` **fontSize**: `number` - -#### Defined in - -[packages/mermaid/src/config.type.ts:204](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L204) - ---- - -### forceLegacyMathML - -โ€ข `Optional` **forceLegacyMathML**: `boolean` - -This option forces Mermaid to rely on KaTeX's own stylesheet for rendering MathML. Due to differences between OS -fonts and browser's MathML implementation, this option is recommended if consistent rendering is important. -If set to true, ignores legacyMathML. - -#### Defined in - -[packages/mermaid/src/config.type.ts:163](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L163) - ---- - -### gantt - -โ€ข `Optional` **gantt**: `GanttDiagramConfig` - -#### Defined in - -[packages/mermaid/src/config.type.ts:184](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L184) - ---- - -### gitGraph - -โ€ข `Optional` **gitGraph**: `GitGraphDiagramConfig` - -#### Defined in - -[packages/mermaid/src/config.type.ts:197](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L197) - ---- - -### handDrawnSeed - -โ€ข `Optional` **handDrawnSeed**: `number` - -Defines the seed to be used when using handDrawn look. This is important for the automated tests as they will always find differences without the seed. The default value is 0 which gives a random seed. - -#### Defined in - -[packages/mermaid/src/config.type.ts:76](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L76) - ---- - -### htmlLabels - -โ€ข `Optional` **htmlLabels**: `boolean` - -#### Defined in - -[packages/mermaid/src/config.type.ts:114](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L114) - ---- - -### journey - -โ€ข `Optional` **journey**: `JourneyDiagramConfig` - -#### Defined in - -[packages/mermaid/src/config.type.ts:185](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L185) - ---- - -### kanban - -โ€ข `Optional` **kanban**: `KanbanDiagramConfig` - -#### Defined in - -[packages/mermaid/src/config.type.ts:196](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L196) - ---- - -### layout - -โ€ข `Optional` **layout**: `string` - -Defines which layout algorithm to use for rendering the diagram. - -#### Defined in - -[packages/mermaid/src/config.type.ts:81](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L81) - ---- - -### legacyMathML - -โ€ข `Optional` **legacyMathML**: `boolean` - -This option specifies if Mermaid can expect the dependent to include KaTeX stylesheets for browsers -without their own MathML implementation. If this option is disabled and MathML is not supported, the math -equations are replaced with a warning. If this option is enabled and MathML is not supported, Mermaid will -fall back to legacy rendering for KaTeX. - -#### Defined in - -[packages/mermaid/src/config.type.ts:156](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L156) - ---- - -### logLevel - -โ€ข `Optional` **logLevel**: `0` | `2` | `1` | `"trace"` | `"debug"` | `"info"` | `"warn"` | `"error"` | `"fatal"` | `3` | `4` | `5` - -This option decides the amount of logging to be used by mermaid. - -#### Defined in - -[packages/mermaid/src/config.type.ts:127](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L127) - ---- - -### look - -โ€ข `Optional` **look**: `"classic"` | `"handDrawn"` - -Defines which main look to use for the diagram. - -#### Defined in - -[packages/mermaid/src/config.type.ts:71](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L71) - ---- - -### markdownAutoWrap - -โ€ข `Optional` **markdownAutoWrap**: `boolean` - -#### Defined in - -[packages/mermaid/src/config.type.ts:205](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L205) - ---- - -### maxEdges - -โ€ข `Optional` **maxEdges**: `number` - -Defines the maximum number of edges that can be drawn in a graph. - -#### Defined in - -[packages/mermaid/src/config.type.ts:90](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L90) - ---- - -### maxTextSize - -โ€ข `Optional` **maxTextSize**: `number` - -The maximum allowed size of the users text diagram - -#### Defined in - -[packages/mermaid/src/config.type.ts:85](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L85) - ---- - -### mindmap - -โ€ข `Optional` **mindmap**: `MindmapDiagramConfig` - -#### Defined in - -[packages/mermaid/src/config.type.ts:195](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L195) - ---- - -### packet - -โ€ข `Optional` **packet**: `PacketDiagramConfig` - -#### Defined in - -[packages/mermaid/src/config.type.ts:200](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L200) - ---- - -### pie - -โ€ข `Optional` **pie**: `PieDiagramConfig` - -#### Defined in - -[packages/mermaid/src/config.type.ts:190](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L190) - ---- - -### quadrantChart - -โ€ข `Optional` **quadrantChart**: `QuadrantChartConfig` - -#### Defined in - -[packages/mermaid/src/config.type.ts:191](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L191) - ---- - -### requirement - -โ€ข `Optional` **requirement**: `RequirementDiagramConfig` - -#### Defined in - -[packages/mermaid/src/config.type.ts:193](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L193) - ---- - -### sankey - -โ€ข `Optional` **sankey**: `SankeyDiagramConfig` - -#### Defined in - -[packages/mermaid/src/config.type.ts:199](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L199) - ---- - -### secure - -โ€ข `Optional` **secure**: `string`\[] - -This option controls which `currentConfig` keys are considered secure and -can only be changed via call to `mermaid.initialize`. -This prevents malicious graph directives from overriding a site's default security. - -#### Defined in - -[packages/mermaid/src/config.type.ts:148](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L148) - ---- - -### securityLevel - -โ€ข `Optional` **securityLevel**: `"strict"` | `"loose"` | `"antiscript"` | `"sandbox"` - -Level of trust for parsed diagram - -#### Defined in - -[packages/mermaid/src/config.type.ts:131](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L131) - ---- - -### sequence - -โ€ข `Optional` **sequence**: `SequenceDiagramConfig` - -#### Defined in - -[packages/mermaid/src/config.type.ts:183](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L183) - ---- - -### startOnLoad - -โ€ข `Optional` **startOnLoad**: `boolean` - -Dictates whether mermaid starts on Page load - -#### Defined in - -[packages/mermaid/src/config.type.ts:135](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L135) - ---- - -### state - -โ€ข `Optional` **state**: `StateDiagramConfig` - -#### Defined in - -[packages/mermaid/src/config.type.ts:188](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L188) - ---- - -### suppressErrorRendering - -โ€ข `Optional` **suppressErrorRendering**: `boolean` - -Suppresses inserting 'Syntax error' diagram in the DOM. -This is useful when you want to control how to handle syntax errors in your application. - -#### Defined in - -[packages/mermaid/src/config.type.ts:211](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L211) - ---- - -### theme - -โ€ข `Optional` **theme**: `"default"` | `"base"` | `"dark"` | `"forest"` | `"neutral"` | `"null"` - -Theme, the CSS style sheet. -You may also use `themeCSS` to override this value. - -#### Defined in - -[packages/mermaid/src/config.type.ts:64](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L64) - ---- - -### themeCSS - -โ€ข `Optional` **themeCSS**: `string` - -#### Defined in - -[packages/mermaid/src/config.type.ts:66](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L66) - ---- - -### themeVariables - -โ€ข `Optional` **themeVariables**: `any` - -#### Defined in - -[packages/mermaid/src/config.type.ts:65](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L65) - ---- - -### timeline - -โ€ข `Optional` **timeline**: `TimelineDiagramConfig` - -#### Defined in - -[packages/mermaid/src/config.type.ts:186](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L186) - ---- - -### wrap - -โ€ข `Optional` **wrap**: `boolean` - -#### Defined in - -[packages/mermaid/src/config.type.ts:203](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L203) - ---- - -### xyChart - -โ€ข `Optional` **xyChart**: `XYChartConfig` - -#### Defined in - -[packages/mermaid/src/config.type.ts:192](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L192) diff --git a/docs/config/setup/interfaces/mermaid.ParseOptions.md b/docs/config/setup/interfaces/mermaid.ParseOptions.md deleted file mode 100644 index bac54b8ca..000000000 --- a/docs/config/setup/interfaces/mermaid.ParseOptions.md +++ /dev/null @@ -1,22 +0,0 @@ -> **Warning** -> -> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. -> -> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/interfaces/mermaid.ParseOptions.md](../../../../packages/mermaid/src/docs/config/setup/interfaces/mermaid.ParseOptions.md). - -# Interface: ParseOptions - -[mermaid](../modules/mermaid.md).ParseOptions - -## Properties - -### suppressErrors - -โ€ข `Optional` **suppressErrors**: `boolean` - -If `true`, parse will return `false` instead of throwing error when the diagram is invalid. -The `parseError` function will not be called. - -#### Defined in - -[packages/mermaid/src/types.ts:64](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L64) diff --git a/docs/config/setup/interfaces/mermaid.ParseResult.md b/docs/config/setup/interfaces/mermaid.ParseResult.md deleted file mode 100644 index e2eb5df50..000000000 --- a/docs/config/setup/interfaces/mermaid.ParseResult.md +++ /dev/null @@ -1,33 +0,0 @@ -> **Warning** -> -> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. -> -> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/interfaces/mermaid.ParseResult.md](../../../../packages/mermaid/src/docs/config/setup/interfaces/mermaid.ParseResult.md). - -# Interface: ParseResult - -[mermaid](../modules/mermaid.md).ParseResult - -## Properties - -### config - -โ€ข **config**: [`MermaidConfig`](mermaid.MermaidConfig.md) - -The config passed as YAML frontmatter or directives - -#### Defined in - -[packages/mermaid/src/types.ts:75](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L75) - ---- - -### diagramType - -โ€ข **diagramType**: `string` - -The diagram type, e.g. 'flowchart', 'sequence', etc. - -#### Defined in - -[packages/mermaid/src/types.ts:71](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L71) diff --git a/docs/config/setup/interfaces/mermaid.RenderOptions.md b/docs/config/setup/interfaces/mermaid.RenderOptions.md deleted file mode 100644 index 9319cb3b1..000000000 --- a/docs/config/setup/interfaces/mermaid.RenderOptions.md +++ /dev/null @@ -1,19 +0,0 @@ -> **Warning** -> -> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. -> -> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/interfaces/mermaid.RenderOptions.md](../../../../packages/mermaid/src/docs/config/setup/interfaces/mermaid.RenderOptions.md). - -# Interface: RenderOptions - -[mermaid](../modules/mermaid.md).RenderOptions - -## Properties - -### algorithm - -โ€ข `Optional` **algorithm**: `string` - -#### Defined in - -[packages/mermaid/src/rendering-util/render.ts:8](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/render.ts#L8) diff --git a/docs/config/setup/interfaces/mermaid.RenderResult.md b/docs/config/setup/interfaces/mermaid.RenderResult.md deleted file mode 100644 index cce7f6928..000000000 --- a/docs/config/setup/interfaces/mermaid.RenderResult.md +++ /dev/null @@ -1,66 +0,0 @@ -> **Warning** -> -> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. -> -> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/interfaces/mermaid.RenderResult.md](../../../../packages/mermaid/src/docs/config/setup/interfaces/mermaid.RenderResult.md). - -# Interface: RenderResult - -[mermaid](../modules/mermaid.md).RenderResult - -## Properties - -### bindFunctions - -โ€ข `Optional` **bindFunctions**: (`element`: `Element`) => `void` - -Bind function to be called after the svg has been inserted into the DOM. -This is necessary for adding event listeners to the elements in the svg. - -```js -const { svg, bindFunctions } = await mermaid.render('id1', 'graph TD;A-->B'); -div.innerHTML = svg; -bindFunctions?.(div); // To call bindFunctions only if it's present. -``` - -#### Type declaration - -โ–ธ (`element`): `void` - -##### Parameters - -| Name | Type | -| :-------- | :-------- | -| `element` | `Element` | - -##### Returns - -`void` - -#### Defined in - -[packages/mermaid/src/types.ts:103](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L103) - ---- - -### diagramType - -โ€ข **diagramType**: `string` - -The diagram type, e.g. 'flowchart', 'sequence', etc. - -#### Defined in - -[packages/mermaid/src/types.ts:93](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L93) - ---- - -### svg - -โ€ข **svg**: `string` - -The svg code for the rendered graph. - -#### Defined in - -[packages/mermaid/src/types.ts:89](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L89) diff --git a/docs/config/setup/interfaces/mermaid.RunOptions.md b/docs/config/setup/interfaces/mermaid.RunOptions.md deleted file mode 100644 index 0bcfc2356..000000000 --- a/docs/config/setup/interfaces/mermaid.RunOptions.md +++ /dev/null @@ -1,71 +0,0 @@ -> **Warning** -> -> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. -> -> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/interfaces/mermaid.RunOptions.md](../../../../packages/mermaid/src/docs/config/setup/interfaces/mermaid.RunOptions.md). - -# Interface: RunOptions - -[mermaid](../modules/mermaid.md).RunOptions - -## Properties - -### nodes - -โ€ข `Optional` **nodes**: `ArrayLike`<`HTMLElement`> - -The nodes to render. If this is set, `querySelector` will be ignored. - -#### Defined in - -[packages/mermaid/src/mermaid.ts:49](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L49) - ---- - -### postRenderCallback - -โ€ข `Optional` **postRenderCallback**: (`id`: `string`) => `unknown` - -A callback to call after each diagram is rendered. - -#### Type declaration - -โ–ธ (`id`): `unknown` - -##### Parameters - -| Name | Type | -| :--- | :------- | -| `id` | `string` | - -##### Returns - -`unknown` - -#### Defined in - -[packages/mermaid/src/mermaid.ts:53](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L53) - ---- - -### querySelector - -โ€ข `Optional` **querySelector**: `string` - -The query selector to use when finding elements to render. Default: `".mermaid"`. - -#### Defined in - -[packages/mermaid/src/mermaid.ts:45](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L45) - ---- - -### suppressErrors - -โ€ข `Optional` **suppressErrors**: `boolean` - -If `true`, errors will be logged to the console, but not thrown. Default: `false` - -#### Defined in - -[packages/mermaid/src/mermaid.ts:57](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L57) diff --git a/docs/config/setup/mermaid/README.md b/docs/config/setup/mermaid/README.md new file mode 100644 index 000000000..3e2cd7a28 --- /dev/null +++ b/docs/config/setup/mermaid/README.md @@ -0,0 +1,40 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/mermaid/README.md](../../../../packages/mermaid/src/docs/config/setup/mermaid/README.md). + +[**mermaid**](../README.md) + +--- + +# mermaid + +## Classes + +- [UnknownDiagramError](classes/UnknownDiagramError.md) + +## Interfaces + +- [DetailedError](interfaces/DetailedError.md) +- [ExternalDiagramDefinition](interfaces/ExternalDiagramDefinition.md) +- [LayoutData](interfaces/LayoutData.md) +- [LayoutLoaderDefinition](interfaces/LayoutLoaderDefinition.md) +- [Mermaid](interfaces/Mermaid.md) +- [MermaidConfig](interfaces/MermaidConfig.md) +- [ParseOptions](interfaces/ParseOptions.md) +- [ParseResult](interfaces/ParseResult.md) +- [RenderOptions](interfaces/RenderOptions.md) +- [RenderResult](interfaces/RenderResult.md) +- [RunOptions](interfaces/RunOptions.md) + +## Type Aliases + +- [InternalHelpers](type-aliases/InternalHelpers.md) +- [ParseErrorFunction](type-aliases/ParseErrorFunction.md) +- [SVG](type-aliases/SVG.md) +- [SVGGroup](type-aliases/SVGGroup.md) + +## Variables + +- [default](variables/default.md) diff --git a/docs/config/setup/mermaid/classes/UnknownDiagramError.md b/docs/config/setup/mermaid/classes/UnknownDiagramError.md new file mode 100644 index 000000000..c077f0e34 --- /dev/null +++ b/docs/config/setup/mermaid/classes/UnknownDiagramError.md @@ -0,0 +1,159 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/mermaid/classes/UnknownDiagramError.md](../../../../../packages/mermaid/src/docs/config/setup/mermaid/classes/UnknownDiagramError.md). + +[**mermaid**](../../README.md) + +--- + +# Class: UnknownDiagramError + +Defined in: [packages/mermaid/src/errors.ts:1](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/errors.ts#L1) + +## Extends + +- `Error` + +## Constructors + +### new UnknownDiagramError() + +> **new UnknownDiagramError**(`message`): [`UnknownDiagramError`](UnknownDiagramError.md) + +Defined in: [packages/mermaid/src/errors.ts:2](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/errors.ts#L2) + +#### Parameters + +##### message + +`string` + +#### Returns + +[`UnknownDiagramError`](UnknownDiagramError.md) + +#### Overrides + +`Error.constructor` + +## Properties + +### cause? + +> `optional` **cause**: `unknown` + +Defined in: node_modules/.pnpm/typescript\@5.7.3/node_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +`Error.cause` + +--- + +### message + +> **message**: `string` + +Defined in: node_modules/.pnpm/typescript\@5.7.3/node_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +`Error.message` + +--- + +### name + +> **name**: `string` + +Defined in: node_modules/.pnpm/typescript\@5.7.3/node_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +`Error.name` + +--- + +### stack? + +> `optional` **stack**: `string` + +Defined in: node_modules/.pnpm/typescript\@5.7.3/node_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +`Error.stack` + +--- + +### prepareStackTrace()? + +> `static` `optional` **prepareStackTrace**: (`err`, `stackTraces`) => `any` + +Defined in: node_modules/.pnpm/@types+node\@22.13.5/node_modules/@types/node/globals.d.ts:143 + +Optional override for formatting stack traces + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`\[] + +#### Returns + +`any` + +#### See + + + +#### Inherited from + +`Error.prepareStackTrace` + +--- + +### stackTraceLimit + +> `static` **stackTraceLimit**: `number` + +Defined in: node_modules/.pnpm/@types+node\@22.13.5/node_modules/@types/node/globals.d.ts:145 + +#### Inherited from + +`Error.stackTraceLimit` + +## Methods + +### captureStackTrace() + +> `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void` + +Defined in: node_modules/.pnpm/@types+node\@22.13.5/node_modules/@types/node/globals.d.ts:136 + +Create .stack property on a target object + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +`Error.captureStackTrace` diff --git a/docs/config/setup/mermaid/interfaces/DetailedError.md b/docs/config/setup/mermaid/interfaces/DetailedError.md new file mode 100644 index 000000000..3954f3340 --- /dev/null +++ b/docs/config/setup/mermaid/interfaces/DetailedError.md @@ -0,0 +1,45 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/mermaid/interfaces/DetailedError.md](../../../../../packages/mermaid/src/docs/config/setup/mermaid/interfaces/DetailedError.md). + +[**mermaid**](../../README.md) + +--- + +# Interface: DetailedError + +Defined in: [packages/mermaid/src/utils.ts:783](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/utils.ts#L783) + +## Properties + +### error? + +> `optional` **error**: `any` + +Defined in: [packages/mermaid/src/utils.ts:788](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/utils.ts#L788) + +--- + +### hash + +> **hash**: `any` + +Defined in: [packages/mermaid/src/utils.ts:786](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/utils.ts#L786) + +--- + +### message? + +> `optional` **message**: `string` + +Defined in: [packages/mermaid/src/utils.ts:789](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/utils.ts#L789) + +--- + +### str + +> **str**: `string` + +Defined in: [packages/mermaid/src/utils.ts:784](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/utils.ts#L784) diff --git a/docs/config/setup/mermaid/interfaces/ExternalDiagramDefinition.md b/docs/config/setup/mermaid/interfaces/ExternalDiagramDefinition.md new file mode 100644 index 000000000..34e475388 --- /dev/null +++ b/docs/config/setup/mermaid/interfaces/ExternalDiagramDefinition.md @@ -0,0 +1,37 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/mermaid/interfaces/ExternalDiagramDefinition.md](../../../../../packages/mermaid/src/docs/config/setup/mermaid/interfaces/ExternalDiagramDefinition.md). + +[**mermaid**](../../README.md) + +--- + +# Interface: ExternalDiagramDefinition + +Defined in: [packages/mermaid/src/diagram-api/types.ts:99](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/diagram-api/types.ts#L99) + +## Properties + +### detector + +> **detector**: `DiagramDetector` + +Defined in: [packages/mermaid/src/diagram-api/types.ts:101](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/diagram-api/types.ts#L101) + +--- + +### id + +> **id**: `string` + +Defined in: [packages/mermaid/src/diagram-api/types.ts:100](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/diagram-api/types.ts#L100) + +--- + +### loader + +> **loader**: `DiagramLoader` + +Defined in: [packages/mermaid/src/diagram-api/types.ts:102](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/diagram-api/types.ts#L102) diff --git a/docs/config/setup/mermaid/interfaces/LayoutData.md b/docs/config/setup/mermaid/interfaces/LayoutData.md new file mode 100644 index 000000000..b4c88454e --- /dev/null +++ b/docs/config/setup/mermaid/interfaces/LayoutData.md @@ -0,0 +1,41 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/mermaid/interfaces/LayoutData.md](../../../../../packages/mermaid/src/docs/config/setup/mermaid/interfaces/LayoutData.md). + +[**mermaid**](../../README.md) + +--- + +# Interface: LayoutData + +Defined in: [packages/mermaid/src/rendering-util/types.ts:145](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/types.ts#L145) + +## Indexable + +\[`key`: `string`]: `any` + +## Properties + +### config + +> **config**: [`MermaidConfig`](MermaidConfig.md) + +Defined in: [packages/mermaid/src/rendering-util/types.ts:148](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/types.ts#L148) + +--- + +### edges + +> **edges**: `Edge`\[] + +Defined in: [packages/mermaid/src/rendering-util/types.ts:147](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/types.ts#L147) + +--- + +### nodes + +> **nodes**: `Node`\[] + +Defined in: [packages/mermaid/src/rendering-util/types.ts:146](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/types.ts#L146) diff --git a/docs/config/setup/mermaid/interfaces/LayoutLoaderDefinition.md b/docs/config/setup/mermaid/interfaces/LayoutLoaderDefinition.md new file mode 100644 index 000000000..aac23f764 --- /dev/null +++ b/docs/config/setup/mermaid/interfaces/LayoutLoaderDefinition.md @@ -0,0 +1,37 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/mermaid/interfaces/LayoutLoaderDefinition.md](../../../../../packages/mermaid/src/docs/config/setup/mermaid/interfaces/LayoutLoaderDefinition.md). + +[**mermaid**](../../README.md) + +--- + +# Interface: LayoutLoaderDefinition + +Defined in: [packages/mermaid/src/rendering-util/render.ts:21](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/render.ts#L21) + +## Properties + +### algorithm? + +> `optional` **algorithm**: `string` + +Defined in: [packages/mermaid/src/rendering-util/render.ts:24](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/render.ts#L24) + +--- + +### loader + +> **loader**: `LayoutLoader` + +Defined in: [packages/mermaid/src/rendering-util/render.ts:23](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/render.ts#L23) + +--- + +### name + +> **name**: `string` + +Defined in: [packages/mermaid/src/rendering-util/render.ts:22](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/render.ts#L22) diff --git a/docs/config/setup/mermaid/interfaces/Mermaid.md b/docs/config/setup/mermaid/interfaces/Mermaid.md new file mode 100644 index 000000000..2e5cc3571 --- /dev/null +++ b/docs/config/setup/mermaid/interfaces/Mermaid.md @@ -0,0 +1,427 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/mermaid/interfaces/Mermaid.md](../../../../../packages/mermaid/src/docs/config/setup/mermaid/interfaces/Mermaid.md). + +[**mermaid**](../../README.md) + +--- + +# Interface: Mermaid + +Defined in: [packages/mermaid/src/mermaid.ts:418](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L418) + +## Properties + +### contentLoaded() + +> **contentLoaded**: () => `void` + +Defined in: [packages/mermaid/src/mermaid.ts:436](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L436) + +\##contentLoaded Callback function that is called when page is loaded. This functions fetches +configuration for mermaid rendering and calls init for rendering the mermaid diagrams on the +page. + +#### Returns + +`void` + +--- + +### detectType() + +> **detectType**: (`text`, `config`?) => `string` + +Defined in: [packages/mermaid/src/mermaid.ts:438](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L438) + +Detects the type of the graph text. + +Takes into consideration the possible existence of an `%%init` directive + +#### Parameters + +##### text + +`string` + +The text defining the graph. For example: + +```mermaid-example + %%{initialize: {"startOnLoad": true, logLevel: "fatal" }}%% + graph LR + a-->b + b-->c + c-->d + d-->e + e-->f + f-->g + g-->h +``` + +```mermaid + %%{initialize: {"startOnLoad": true, logLevel: "fatal" }}%% + graph LR + a-->b + b-->c + c-->d + d-->e + e-->f + f-->g + g-->h +``` + +##### config? + +[`MermaidConfig`](MermaidConfig.md) + +The mermaid config. + +#### Returns + +`string` + +A graph definition key + +--- + +### ~~init()~~ + +> **init**: (`config`?, `nodes`?, `callback`?) => `Promise`<`void`> + +Defined in: [packages/mermaid/src/mermaid.ts:431](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L431) + +## init + +#### Parameters + +##### config? + +[`MermaidConfig`](MermaidConfig.md) + +**Deprecated**, please set configuration in [initialize](Mermaid.md#initialize). + +##### nodes? + +**Default**: `.mermaid`. One of the following: + +- A DOM Node +- An array of DOM nodes (as would come from a jQuery selector) +- A W3C selector, a la `.mermaid` + +`string` | `HTMLElement` | `NodeListOf`<`HTMLElement`> + +##### callback? + +(`id`) => `unknown` + +Called once for each rendered diagram's id. + +#### Returns + +`Promise`<`void`> + +#### Deprecated + +Use [initialize](Mermaid.md#initialize) and [run](Mermaid.md#run) instead. + +Renders the mermaid diagrams + +#### Deprecated + +Use [initialize](Mermaid.md#initialize) and [run](Mermaid.md#run) instead. + +--- + +### initialize() + +> **initialize**: (`config`) => `void` + +Defined in: [packages/mermaid/src/mermaid.ts:435](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L435) + +Used to set configurations for mermaid. +This function should be called before the run function. + +#### Parameters + +##### config + +[`MermaidConfig`](MermaidConfig.md) + +Configuration object for mermaid. + +#### Returns + +`void` + +--- + +### ~~mermaidAPI~~ + +> **mermaidAPI**: `Readonly`<{ `defaultConfig`: [`MermaidConfig`](MermaidConfig.md); `getConfig`: () => [`MermaidConfig`](MermaidConfig.md); `getDiagramFromText`: (`text`, `metadata`) => `Promise`<`Diagram`>; `getSiteConfig`: () => [`MermaidConfig`](MermaidConfig.md); `globalReset`: () => `void`; `initialize`: (`userOptions`) => `void`; `parse`: (`text`, `parseOptions`) => `Promise`<`false` | [`ParseResult`](ParseResult.md)>(`text`, `parseOptions`?) => `Promise`<[`ParseResult`](ParseResult.md)>; `render`: (`id`, `text`, `svgContainingElement`?) => `Promise`<[`RenderResult`](RenderResult.md)>; `reset`: () => `void`; `setConfig`: (`conf`) => [`MermaidConfig`](MermaidConfig.md); `updateSiteConfig`: (`conf`) => [`MermaidConfig`](MermaidConfig.md); }> + +Defined in: [packages/mermaid/src/mermaid.ts:425](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L425) + +**`Internal`** + +#### Deprecated + +Use [parse](Mermaid.md#parse) and [render](Mermaid.md#render) instead. Please [open a discussion](https://github.com/mermaid-js/mermaid/discussions) if your use case does not fit the new API. + +--- + +### parse() + +> **parse**: (`text`, `parseOptions`) => `Promise`<`false` | [`ParseResult`](ParseResult.md)>(`text`, `parseOptions`?) => `Promise`<[`ParseResult`](ParseResult.md)> + +Defined in: [packages/mermaid/src/mermaid.ts:426](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L426) + +Parse the text and validate the syntax. + +#### Parameters + +##### text + +`string` + +The mermaid diagram definition. + +##### parseOptions + +[`ParseOptions`](ParseOptions.md) & `object` + +Options for parsing. + +#### Returns + +`Promise`<`false` | [`ParseResult`](ParseResult.md)> + +An object with the `diagramType` set to type of the diagram if valid. Otherwise `false` if parseOptions.suppressErrors is `true`. + +#### See + +[ParseOptions](ParseOptions.md) + +#### Throws + +Error if the diagram is invalid and parseOptions.suppressErrors is false or not set. + +Parse the text and validate the syntax. + +#### Parameters + +##### text + +`string` + +The mermaid diagram definition. + +##### parseOptions? + +[`ParseOptions`](ParseOptions.md) + +Options for parsing. + +#### Returns + +`Promise`<[`ParseResult`](ParseResult.md)> + +An object with the `diagramType` set to type of the diagram if valid. Otherwise `false` if parseOptions.suppressErrors is `true`. + +#### See + +[ParseOptions](ParseOptions.md) + +#### Throws + +Error if the diagram is invalid and parseOptions.suppressErrors is false or not set. + +--- + +### parseError? + +> `optional` **parseError**: [`ParseErrorFunction`](../type-aliases/ParseErrorFunction.md) + +Defined in: [packages/mermaid/src/mermaid.ts:420](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L420) + +--- + +### registerExternalDiagrams() + +> **registerExternalDiagrams**: (`diagrams`, `opts`) => `Promise`<`void`> + +Defined in: [packages/mermaid/src/mermaid.ts:434](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L434) + +Used to register external diagram types. + +#### Parameters + +##### diagrams + +[`ExternalDiagramDefinition`](ExternalDiagramDefinition.md)\[] + +Array of [ExternalDiagramDefinition](ExternalDiagramDefinition.md). + +##### opts + +If opts.lazyLoad is false, the diagrams will be loaded immediately. + +###### lazyLoad? + +`boolean` = `true` + +#### Returns + +`Promise`<`void`> + +--- + +### registerIconPacks() + +> **registerIconPacks**: (`iconLoaders`) => `void` + +Defined in: [packages/mermaid/src/mermaid.ts:439](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L439) + +#### Parameters + +##### iconLoaders + +`IconLoader`\[] + +#### Returns + +`void` + +--- + +### registerLayoutLoaders() + +> **registerLayoutLoaders**: (`loaders`) => `void` + +Defined in: [packages/mermaid/src/mermaid.ts:433](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L433) + +#### Parameters + +##### loaders + +[`LayoutLoaderDefinition`](LayoutLoaderDefinition.md)\[] + +#### Returns + +`void` + +--- + +### render() + +> **render**: (`id`, `text`, `svgContainingElement`?) => `Promise`<[`RenderResult`](RenderResult.md)> + +Defined in: [packages/mermaid/src/mermaid.ts:427](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L427) + +#### Parameters + +##### id + +`string` + +##### text + +`string` + +##### svgContainingElement? + +`Element` + +#### Returns + +`Promise`<[`RenderResult`](RenderResult.md)> + +#### Deprecated + +- use the `mermaid.render` function instead of `mermaid.mermaidAPI.render` + +Deprecated for external use. + +--- + +### run() + +> **run**: (`options`) => `Promise`<`void`> + +Defined in: [packages/mermaid/src/mermaid.ts:432](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L432) + +## run + +Function that goes through the document to find the chart definitions in there and render them. + +The function tags the processed attributes with the attribute data-processed and ignores found +elements with the attribute already set. This way the init function can be triggered several +times. + +```mermaid-example +graph LR; + a(Find elements)-->b{Processed} + b-->|Yes|c(Leave element) + b-->|No |d(Transform) +``` + +```mermaid +graph LR; + a(Find elements)-->b{Processed} + b-->|Yes|c(Leave element) + b-->|No |d(Transform) +``` + +Renders the mermaid diagrams + +#### Parameters + +##### options + +[`RunOptions`](RunOptions.md) = `...` + +Optional runtime configs + +#### Returns + +`Promise`<`void`> + +--- + +### setParseErrorHandler() + +> **setParseErrorHandler**: (`parseErrorHandler`) => `void` + +Defined in: [packages/mermaid/src/mermaid.ts:437](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L437) + +## setParseErrorHandler Alternative to directly setting parseError using: + +```js +mermaid.parseError = function (err, hash) { + forExampleDisplayErrorInGui(err); // do something with the error +}; +``` + +This is provided for environments where the mermaid object can't directly have a new member added +to it (eg. dart interop wrapper). (Initially there is no parseError member of mermaid). + +#### Parameters + +##### parseErrorHandler + +(`err`, `hash`) => `void` + +New parseError() callback. + +#### Returns + +`void` + +--- + +### startOnLoad + +> **startOnLoad**: `boolean` + +Defined in: [packages/mermaid/src/mermaid.ts:419](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L419) diff --git a/docs/config/setup/mermaid/interfaces/MermaidConfig.md b/docs/config/setup/mermaid/interfaces/MermaidConfig.md new file mode 100644 index 000000000..d08533713 --- /dev/null +++ b/docs/config/setup/mermaid/interfaces/MermaidConfig.md @@ -0,0 +1,469 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/mermaid/interfaces/MermaidConfig.md](../../../../../packages/mermaid/src/docs/config/setup/mermaid/interfaces/MermaidConfig.md). + +[**mermaid**](../../README.md) + +--- + +# Interface: MermaidConfig + +Defined in: [packages/mermaid/src/config.type.ts:58](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L58) + +## Properties + +### altFontFamily? + +> `optional` **altFontFamily**: `string` + +Defined in: [packages/mermaid/src/config.type.ts:122](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L122) + +--- + +### architecture? + +> `optional` **architecture**: `ArchitectureDiagramConfig` + +Defined in: [packages/mermaid/src/config.type.ts:194](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L194) + +--- + +### arrowMarkerAbsolute? + +> `optional` **arrowMarkerAbsolute**: `boolean` + +Defined in: [packages/mermaid/src/config.type.ts:141](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L141) + +Controls whether or arrow markers in html code are absolute paths or anchors. +This matters if you are using base tag settings. + +--- + +### block? + +> `optional` **block**: `BlockDiagramConfig` + +Defined in: [packages/mermaid/src/config.type.ts:201](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L201) + +--- + +### c4? + +> `optional` **c4**: `C4DiagramConfig` + +Defined in: [packages/mermaid/src/config.type.ts:198](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L198) + +--- + +### class? + +> `optional` **class**: `ClassDiagramConfig` + +Defined in: [packages/mermaid/src/config.type.ts:187](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L187) + +--- + +### darkMode? + +> `optional` **darkMode**: `boolean` + +Defined in: [packages/mermaid/src/config.type.ts:113](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L113) + +--- + +### deterministicIds? + +> `optional` **deterministicIds**: `boolean` + +Defined in: [packages/mermaid/src/config.type.ts:174](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L174) + +This option controls if the generated ids of nodes in the SVG are +generated randomly or based on a seed. +If set to `false`, the IDs are generated based on the current date and +thus are not deterministic. This is the default behavior. + +This matters if your files are checked into source control e.g. git and +should not change unless content is changed. + +--- + +### deterministicIDSeed? + +> `optional` **deterministicIDSeed**: `string` + +Defined in: [packages/mermaid/src/config.type.ts:181](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L181) + +This option is the optional seed for deterministic ids. +If set to `undefined` but deterministicIds is `true`, a simple number iterator is used. +You can set this attribute to base the seed on a static string. + +--- + +### dompurifyConfig? + +> `optional` **dompurifyConfig**: `Config` + +Defined in: [packages/mermaid/src/config.type.ts:203](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L203) + +--- + +### elk? + +> `optional` **elk**: `object` + +Defined in: [packages/mermaid/src/config.type.ts:91](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L91) + +#### cycleBreakingStrategy? + +> `optional` **cycleBreakingStrategy**: `"GREEDY"` | `"DEPTH_FIRST"` | `"INTERACTIVE"` | `"MODEL_ORDER"` | `"GREEDY_MODEL_ORDER"` + +This strategy decides how to find cycles in the graph and deciding which edges need adjustment to break loops. + +#### mergeEdges? + +> `optional` **mergeEdges**: `boolean` + +Elk specific option that allows edges to share path where it convenient. It can make for pretty diagrams but can also make it harder to read the diagram. + +#### nodePlacementStrategy? + +> `optional` **nodePlacementStrategy**: `"SIMPLE"` | `"NETWORK_SIMPLEX"` | `"LINEAR_SEGMENTS"` | `"BRANDES_KOEPF"` + +Elk specific option affecting how nodes are placed. + +--- + +### er? + +> `optional` **er**: `ErDiagramConfig` + +Defined in: [packages/mermaid/src/config.type.ts:189](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L189) + +--- + +### flowchart? + +> `optional` **flowchart**: `FlowchartDiagramConfig` + +Defined in: [packages/mermaid/src/config.type.ts:182](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L182) + +--- + +### fontFamily? + +> `optional` **fontFamily**: `string` + +Defined in: [packages/mermaid/src/config.type.ts:121](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L121) + +Specifies the font to be used in the rendered diagrams. +Can be any possible CSS `font-family`. +See + +--- + +### fontSize? + +> `optional` **fontSize**: `number` + +Defined in: [packages/mermaid/src/config.type.ts:205](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L205) + +--- + +### forceLegacyMathML? + +> `optional` **forceLegacyMathML**: `boolean` + +Defined in: [packages/mermaid/src/config.type.ts:163](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L163) + +This option forces Mermaid to rely on KaTeX's own stylesheet for rendering MathML. Due to differences between OS +fonts and browser's MathML implementation, this option is recommended if consistent rendering is important. +If set to true, ignores legacyMathML. + +--- + +### gantt? + +> `optional` **gantt**: `GanttDiagramConfig` + +Defined in: [packages/mermaid/src/config.type.ts:184](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L184) + +--- + +### gitGraph? + +> `optional` **gitGraph**: `GitGraphDiagramConfig` + +Defined in: [packages/mermaid/src/config.type.ts:197](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L197) + +--- + +### handDrawnSeed? + +> `optional` **handDrawnSeed**: `number` + +Defined in: [packages/mermaid/src/config.type.ts:76](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L76) + +Defines the seed to be used when using handDrawn look. This is important for the automated tests as they will always find differences without the seed. The default value is 0 which gives a random seed. + +--- + +### htmlLabels? + +> `optional` **htmlLabels**: `boolean` + +Defined in: [packages/mermaid/src/config.type.ts:114](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L114) + +--- + +### journey? + +> `optional` **journey**: `JourneyDiagramConfig` + +Defined in: [packages/mermaid/src/config.type.ts:185](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L185) + +--- + +### kanban? + +> `optional` **kanban**: `KanbanDiagramConfig` + +Defined in: [packages/mermaid/src/config.type.ts:196](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L196) + +--- + +### layout? + +> `optional` **layout**: `string` + +Defined in: [packages/mermaid/src/config.type.ts:81](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L81) + +Defines which layout algorithm to use for rendering the diagram. + +--- + +### legacyMathML? + +> `optional` **legacyMathML**: `boolean` + +Defined in: [packages/mermaid/src/config.type.ts:156](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L156) + +This option specifies if Mermaid can expect the dependent to include KaTeX stylesheets for browsers +without their own MathML implementation. If this option is disabled and MathML is not supported, the math +equations are replaced with a warning. If this option is enabled and MathML is not supported, Mermaid will +fall back to legacy rendering for KaTeX. + +--- + +### logLevel? + +> `optional` **logLevel**: `0` | `2` | `1` | `"trace"` | `"debug"` | `"info"` | `"warn"` | `"error"` | `"fatal"` | `3` | `4` | `5` + +Defined in: [packages/mermaid/src/config.type.ts:127](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L127) + +This option decides the amount of logging to be used by mermaid. + +--- + +### look? + +> `optional` **look**: `"classic"` | `"handDrawn"` + +Defined in: [packages/mermaid/src/config.type.ts:71](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L71) + +Defines which main look to use for the diagram. + +--- + +### markdownAutoWrap? + +> `optional` **markdownAutoWrap**: `boolean` + +Defined in: [packages/mermaid/src/config.type.ts:206](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L206) + +--- + +### maxEdges? + +> `optional` **maxEdges**: `number` + +Defined in: [packages/mermaid/src/config.type.ts:90](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L90) + +Defines the maximum number of edges that can be drawn in a graph. + +--- + +### maxTextSize? + +> `optional` **maxTextSize**: `number` + +Defined in: [packages/mermaid/src/config.type.ts:85](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L85) + +The maximum allowed size of the users text diagram + +--- + +### mindmap? + +> `optional` **mindmap**: `MindmapDiagramConfig` + +Defined in: [packages/mermaid/src/config.type.ts:195](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L195) + +--- + +### packet? + +> `optional` **packet**: `PacketDiagramConfig` + +Defined in: [packages/mermaid/src/config.type.ts:200](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L200) + +--- + +### pie? + +> `optional` **pie**: `PieDiagramConfig` + +Defined in: [packages/mermaid/src/config.type.ts:190](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L190) + +--- + +### quadrantChart? + +> `optional` **quadrantChart**: `QuadrantChartConfig` + +Defined in: [packages/mermaid/src/config.type.ts:191](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L191) + +--- + +### radar? + +> `optional` **radar**: `RadarDiagramConfig` + +Defined in: [packages/mermaid/src/config.type.ts:202](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L202) + +--- + +### requirement? + +> `optional` **requirement**: `RequirementDiagramConfig` + +Defined in: [packages/mermaid/src/config.type.ts:193](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L193) + +--- + +### sankey? + +> `optional` **sankey**: `SankeyDiagramConfig` + +Defined in: [packages/mermaid/src/config.type.ts:199](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L199) + +--- + +### secure? + +> `optional` **secure**: `string`\[] + +Defined in: [packages/mermaid/src/config.type.ts:148](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L148) + +This option controls which `currentConfig` keys are considered secure and +can only be changed via call to `mermaid.initialize`. +This prevents malicious graph directives from overriding a site's default security. + +--- + +### securityLevel? + +> `optional` **securityLevel**: `"strict"` | `"loose"` | `"antiscript"` | `"sandbox"` + +Defined in: [packages/mermaid/src/config.type.ts:131](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L131) + +Level of trust for parsed diagram + +--- + +### sequence? + +> `optional` **sequence**: `SequenceDiagramConfig` + +Defined in: [packages/mermaid/src/config.type.ts:183](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L183) + +--- + +### startOnLoad? + +> `optional` **startOnLoad**: `boolean` + +Defined in: [packages/mermaid/src/config.type.ts:135](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L135) + +Dictates whether mermaid starts on Page load + +--- + +### state? + +> `optional` **state**: `StateDiagramConfig` + +Defined in: [packages/mermaid/src/config.type.ts:188](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L188) + +--- + +### suppressErrorRendering? + +> `optional` **suppressErrorRendering**: `boolean` + +Defined in: [packages/mermaid/src/config.type.ts:212](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L212) + +Suppresses inserting 'Syntax error' diagram in the DOM. +This is useful when you want to control how to handle syntax errors in your application. + +--- + +### theme? + +> `optional` **theme**: `"default"` | `"base"` | `"dark"` | `"forest"` | `"neutral"` | `"null"` + +Defined in: [packages/mermaid/src/config.type.ts:64](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L64) + +Theme, the CSS style sheet. +You may also use `themeCSS` to override this value. + +--- + +### themeCSS? + +> `optional` **themeCSS**: `string` + +Defined in: [packages/mermaid/src/config.type.ts:66](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L66) + +--- + +### themeVariables? + +> `optional` **themeVariables**: `any` + +Defined in: [packages/mermaid/src/config.type.ts:65](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L65) + +--- + +### timeline? + +> `optional` **timeline**: `TimelineDiagramConfig` + +Defined in: [packages/mermaid/src/config.type.ts:186](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L186) + +--- + +### wrap? + +> `optional` **wrap**: `boolean` + +Defined in: [packages/mermaid/src/config.type.ts:204](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L204) + +--- + +### xyChart? + +> `optional` **xyChart**: `XYChartConfig` + +Defined in: [packages/mermaid/src/config.type.ts:192](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L192) diff --git a/docs/config/setup/mermaid/interfaces/ParseOptions.md b/docs/config/setup/mermaid/interfaces/ParseOptions.md new file mode 100644 index 000000000..e3a968378 --- /dev/null +++ b/docs/config/setup/mermaid/interfaces/ParseOptions.md @@ -0,0 +1,24 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/mermaid/interfaces/ParseOptions.md](../../../../../packages/mermaid/src/docs/config/setup/mermaid/interfaces/ParseOptions.md). + +[**mermaid**](../../README.md) + +--- + +# Interface: ParseOptions + +Defined in: [packages/mermaid/src/types.ts:59](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L59) + +## Properties + +### suppressErrors? + +> `optional` **suppressErrors**: `boolean` + +Defined in: [packages/mermaid/src/types.ts:64](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L64) + +If `true`, parse will return `false` instead of throwing error when the diagram is invalid. +The `parseError` function will not be called. diff --git a/docs/config/setup/mermaid/interfaces/ParseResult.md b/docs/config/setup/mermaid/interfaces/ParseResult.md new file mode 100644 index 000000000..95d662b42 --- /dev/null +++ b/docs/config/setup/mermaid/interfaces/ParseResult.md @@ -0,0 +1,33 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/mermaid/interfaces/ParseResult.md](../../../../../packages/mermaid/src/docs/config/setup/mermaid/interfaces/ParseResult.md). + +[**mermaid**](../../README.md) + +--- + +# Interface: ParseResult + +Defined in: [packages/mermaid/src/types.ts:67](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L67) + +## Properties + +### config + +> **config**: [`MermaidConfig`](MermaidConfig.md) + +Defined in: [packages/mermaid/src/types.ts:75](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L75) + +The config passed as YAML frontmatter or directives + +--- + +### diagramType + +> **diagramType**: `string` + +Defined in: [packages/mermaid/src/types.ts:71](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L71) + +The diagram type, e.g. 'flowchart', 'sequence', etc. diff --git a/docs/config/setup/mermaid/interfaces/RenderOptions.md b/docs/config/setup/mermaid/interfaces/RenderOptions.md new file mode 100644 index 000000000..e3a9483f2 --- /dev/null +++ b/docs/config/setup/mermaid/interfaces/RenderOptions.md @@ -0,0 +1,21 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/mermaid/interfaces/RenderOptions.md](../../../../../packages/mermaid/src/docs/config/setup/mermaid/interfaces/RenderOptions.md). + +[**mermaid**](../../README.md) + +--- + +# Interface: RenderOptions + +Defined in: [packages/mermaid/src/rendering-util/render.ts:7](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/render.ts#L7) + +## Properties + +### algorithm? + +> `optional` **algorithm**: `string` + +Defined in: [packages/mermaid/src/rendering-util/render.ts:8](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/render.ts#L8) diff --git a/docs/config/setup/mermaid/interfaces/RenderResult.md b/docs/config/setup/mermaid/interfaces/RenderResult.md new file mode 100644 index 000000000..c6dc3cf08 --- /dev/null +++ b/docs/config/setup/mermaid/interfaces/RenderResult.md @@ -0,0 +1,60 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/mermaid/interfaces/RenderResult.md](../../../../../packages/mermaid/src/docs/config/setup/mermaid/interfaces/RenderResult.md). + +[**mermaid**](../../README.md) + +--- + +# Interface: RenderResult + +Defined in: [packages/mermaid/src/types.ts:85](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L85) + +## Properties + +### bindFunctions()? + +> `optional` **bindFunctions**: (`element`) => `void` + +Defined in: [packages/mermaid/src/types.ts:103](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L103) + +Bind function to be called after the svg has been inserted into the DOM. +This is necessary for adding event listeners to the elements in the svg. + +```js +const { svg, bindFunctions } = await mermaid.render('id1', 'graph TD;A-->B'); +div.innerHTML = svg; +bindFunctions?.(div); // To call bindFunctions only if it's present. +``` + +#### Parameters + +##### element + +`Element` + +#### Returns + +`void` + +--- + +### diagramType + +> **diagramType**: `string` + +Defined in: [packages/mermaid/src/types.ts:93](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L93) + +The diagram type, e.g. 'flowchart', 'sequence', etc. + +--- + +### svg + +> **svg**: `string` + +Defined in: [packages/mermaid/src/types.ts:89](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L89) + +The svg code for the rendered graph. diff --git a/docs/config/setup/mermaid/interfaces/RunOptions.md b/docs/config/setup/mermaid/interfaces/RunOptions.md new file mode 100644 index 000000000..ecd679aa5 --- /dev/null +++ b/docs/config/setup/mermaid/interfaces/RunOptions.md @@ -0,0 +1,63 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/mermaid/interfaces/RunOptions.md](../../../../../packages/mermaid/src/docs/config/setup/mermaid/interfaces/RunOptions.md). + +[**mermaid**](../../README.md) + +--- + +# Interface: RunOptions + +Defined in: [packages/mermaid/src/mermaid.ts:41](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L41) + +## Properties + +### nodes? + +> `optional` **nodes**: `ArrayLike`<`HTMLElement`> + +Defined in: [packages/mermaid/src/mermaid.ts:49](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L49) + +The nodes to render. If this is set, `querySelector` will be ignored. + +--- + +### postRenderCallback()? + +> `optional` **postRenderCallback**: (`id`) => `unknown` + +Defined in: [packages/mermaid/src/mermaid.ts:53](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L53) + +A callback to call after each diagram is rendered. + +#### Parameters + +##### id + +`string` + +#### Returns + +`unknown` + +--- + +### querySelector? + +> `optional` **querySelector**: `string` + +Defined in: [packages/mermaid/src/mermaid.ts:45](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L45) + +The query selector to use when finding elements to render. Default: `".mermaid"`. + +--- + +### suppressErrors? + +> `optional` **suppressErrors**: `boolean` + +Defined in: [packages/mermaid/src/mermaid.ts:57](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L57) + +If `true`, errors will be logged to the console, but not thrown. Default: `false` diff --git a/docs/config/setup/mermaid/type-aliases/InternalHelpers.md b/docs/config/setup/mermaid/type-aliases/InternalHelpers.md new file mode 100644 index 000000000..6baf786fe --- /dev/null +++ b/docs/config/setup/mermaid/type-aliases/InternalHelpers.md @@ -0,0 +1,15 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/mermaid/type-aliases/InternalHelpers.md](../../../../../packages/mermaid/src/docs/config/setup/mermaid/type-aliases/InternalHelpers.md). + +[**mermaid**](../../README.md) + +--- + +# Type Alias: InternalHelpers + +> **InternalHelpers**: _typeof_ `internalHelpers` + +Defined in: [packages/mermaid/src/internals.ts:33](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/internals.ts#L33) diff --git a/docs/config/setup/mermaid/type-aliases/ParseErrorFunction.md b/docs/config/setup/mermaid/type-aliases/ParseErrorFunction.md new file mode 100644 index 000000000..78f27854c --- /dev/null +++ b/docs/config/setup/mermaid/type-aliases/ParseErrorFunction.md @@ -0,0 +1,29 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/mermaid/type-aliases/ParseErrorFunction.md](../../../../../packages/mermaid/src/docs/config/setup/mermaid/type-aliases/ParseErrorFunction.md). + +[**mermaid**](../../README.md) + +--- + +# Type Alias: ParseErrorFunction() + +> **ParseErrorFunction**: (`err`, `hash`?) => `void` + +Defined in: [packages/mermaid/src/Diagram.ts:10](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/Diagram.ts#L10) + +## Parameters + +### err + +`string` | [`DetailedError`](../interfaces/DetailedError.md) | `unknown` + +### hash? + +`any` + +## Returns + +`void` diff --git a/docs/config/setup/mermaid/type-aliases/SVG.md b/docs/config/setup/mermaid/type-aliases/SVG.md new file mode 100644 index 000000000..2c72882ae --- /dev/null +++ b/docs/config/setup/mermaid/type-aliases/SVG.md @@ -0,0 +1,15 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/mermaid/type-aliases/SVG.md](../../../../../packages/mermaid/src/docs/config/setup/mermaid/type-aliases/SVG.md). + +[**mermaid**](../../README.md) + +--- + +# Type Alias: SVG + +> **SVG**: `d3.Selection`<`SVGSVGElement`, `unknown`, `Element` | `null`, `unknown`> + +Defined in: [packages/mermaid/src/diagram-api/types.ts:130](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/diagram-api/types.ts#L130) diff --git a/docs/config/setup/mermaid/type-aliases/SVGGroup.md b/docs/config/setup/mermaid/type-aliases/SVGGroup.md new file mode 100644 index 000000000..30ada9928 --- /dev/null +++ b/docs/config/setup/mermaid/type-aliases/SVGGroup.md @@ -0,0 +1,15 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/mermaid/type-aliases/SVGGroup.md](../../../../../packages/mermaid/src/docs/config/setup/mermaid/type-aliases/SVGGroup.md). + +[**mermaid**](../../README.md) + +--- + +# Type Alias: SVGGroup + +> **SVGGroup**: `d3.Selection`<`SVGGElement`, `unknown`, `Element` | `null`, `unknown`> + +Defined in: [packages/mermaid/src/diagram-api/types.ts:132](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/diagram-api/types.ts#L132) diff --git a/docs/config/setup/mermaid/variables/default.md b/docs/config/setup/mermaid/variables/default.md new file mode 100644 index 000000000..24ec84128 --- /dev/null +++ b/docs/config/setup/mermaid/variables/default.md @@ -0,0 +1,15 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/mermaid/variables/default.md](../../../../../packages/mermaid/src/docs/config/setup/mermaid/variables/default.md). + +[**mermaid**](../../README.md) + +--- + +# Variable: default + +> `const` **default**: [`Mermaid`](../interfaces/Mermaid.md) + +Defined in: [packages/mermaid/src/mermaid.ts:442](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L442) diff --git a/docs/config/setup/modules/config.md b/docs/config/setup/modules/config.md deleted file mode 100644 index 78a301bf0..000000000 --- a/docs/config/setup/modules/config.md +++ /dev/null @@ -1,276 +0,0 @@ -> **Warning** -> -> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. -> -> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/modules/config.md](../../../../packages/mermaid/src/docs/config/setup/modules/config.md). - -# Module: config - -## Variables - -### defaultConfig - -โ€ข `Const` **defaultConfig**: [`MermaidConfig`](../interfaces/mermaid.MermaidConfig.md) - -#### Defined in - -[packages/mermaid/src/config.ts:8](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L8) - -## Functions - -### addDirective - -โ–ธ **addDirective**(`directive`): `void` - -Pushes in a directive to the configuration - -#### Parameters - -| Name | Type | Description | -| :---------- | :-------------------------------------------------------- | :----------------------- | -| `directive` | [`MermaidConfig`](../interfaces/mermaid.MermaidConfig.md) | The directive to push in | - -#### Returns - -`void` - -#### Defined in - -[packages/mermaid/src/config.ts:188](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L188) - ---- - -### getConfig - -โ–ธ **getConfig**(): [`MermaidConfig`](../interfaces/mermaid.MermaidConfig.md) - -## getConfig - -| Function | Description | Type | Return Values | -| --------- | ------------------------- | ----------- | ------------------------------ | -| getConfig | Obtains the currentConfig | Get Request | Any Values from current Config | - -**Notes**: Avoid calling this function repeatedly. Instead, store the result in a variable and use it, and pass it down to function calls. - -#### Returns - -[`MermaidConfig`](../interfaces/mermaid.MermaidConfig.md) - -The currentConfig - -#### Defined in - -[packages/mermaid/src/config.ts:131](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L131) - ---- - -### getSiteConfig - -โ–ธ **getSiteConfig**(): [`MermaidConfig`](../interfaces/mermaid.MermaidConfig.md) - -## getSiteConfig - -| Function | Description | Type | Values | -| ------------- | ------------------------------------------------- | ----------- | -------------------------------- | -| setSiteConfig | Returns the current siteConfig base configuration | Get Request | Returns Any Values in siteConfig | - -**Notes**: Returns **any** values in siteConfig. - -#### Returns - -[`MermaidConfig`](../interfaces/mermaid.MermaidConfig.md) - -The siteConfig - -#### Defined in - -[packages/mermaid/src/config.ts:96](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L96) - ---- - -### reset - -โ–ธ **reset**(`config?`): `void` - -## reset - -| Function | Description | Type | Required | Values | -| -------- | ---------------------------- | ----------- | -------- | ------ | -| reset | Resets currentConfig to conf | Put Request | Required | None | - -## conf - -| Parameter | Description | Type | Required | Values | -| --------- | -------------------------------------------------------------- | ---------- | -------- | -------------------------------------------- | -| conf | base set of values, which currentConfig could be **reset** to. | Dictionary | Required | Any Values, with respect to the secure Array | - -**Notes**: (default: current siteConfig ) (optional, default `getSiteConfig()`) - -#### Parameters - -| Name | Type | Default value | Description | -| :------- | :-------------------------------------------------------- | :------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `config` | [`MermaidConfig`](../interfaces/mermaid.MermaidConfig.md) | `siteConfig` | base set of values, which currentConfig could be **reset** to. Defaults to the current siteConfig (e.g returned by [getSiteConfig](config.md#getsiteconfig)). | - -#### Returns - -`void` - -#### Defined in - -[packages/mermaid/src/config.ts:221](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L221) - ---- - -### sanitize - -โ–ธ **sanitize**(`options`): `void` - -## sanitize - -| Function | Description | Type | Values | -| -------- | -------------------------------------- | ----------- | ------ | -| sanitize | Sets the siteConfig to desired values. | Put Request | None | - -Ensures options parameter does not attempt to override siteConfig secure keys **Notes**: modifies -options in-place - -#### Parameters - -| Name | Type | Description | -| :-------- | :---- | :-------------------------------- | -| `options` | `any` | The potential setConfig parameter | - -#### Returns - -`void` - -#### Defined in - -[packages/mermaid/src/config.ts:146](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L146) - ---- - -### saveConfigFromInitialize - -โ–ธ **saveConfigFromInitialize**(`conf`): `void` - -#### Parameters - -| Name | Type | -| :----- | :-------------------------------------------------------- | -| `conf` | [`MermaidConfig`](../interfaces/mermaid.MermaidConfig.md) | - -#### Returns - -`void` - -#### Defined in - -[packages/mermaid/src/config.ts:75](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L75) - ---- - -### setConfig - -โ–ธ **setConfig**(`conf`): [`MermaidConfig`](../interfaces/mermaid.MermaidConfig.md) - -## setConfig - -| Function | Description | Type | Values | -| ------------- | ------------------------------------- | ----------- | --------------------------------------- | -| setSiteConfig | Sets the siteConfig to desired values | Put Request | Any Values, except ones in secure array | - -**Notes**: Sets the currentConfig. The parameter conf is sanitized based on the siteConfig.secure -keys. Any values found in conf with key found in siteConfig.secure will be replaced with the -corresponding siteConfig value. - -#### Parameters - -| Name | Type | Description | -| :----- | :-------------------------------------------------------- | :-------------------------- | -| `conf` | [`MermaidConfig`](../interfaces/mermaid.MermaidConfig.md) | The potential currentConfig | - -#### Returns - -[`MermaidConfig`](../interfaces/mermaid.MermaidConfig.md) - -The currentConfig merged with the sanitized conf - -#### Defined in - -[packages/mermaid/src/config.ts:113](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L113) - ---- - -### setSiteConfig - -โ–ธ **setSiteConfig**(`conf`): [`MermaidConfig`](../interfaces/mermaid.MermaidConfig.md) - -## setSiteConfig - -| Function | Description | Type | Values | -| ------------- | ------------------------------------- | ----------- | --------------------------------------- | -| setSiteConfig | Sets the siteConfig to desired values | Put Request | Any Values, except ones in secure array | - -**Notes:** Sets the siteConfig. The siteConfig is a protected configuration for repeat use. Calls -to reset() will reset the currentConfig to siteConfig. Calls to reset(configApi.defaultConfig) -will reset siteConfig and currentConfig to the defaultConfig Note: currentConfig is set in this -function _Default value: At default, will mirror Global Config_ - -#### Parameters - -| Name | Type | Description | -| :----- | :-------------------------------------------------------- | :------------------------------------------ | -| `conf` | [`MermaidConfig`](../interfaces/mermaid.MermaidConfig.md) | The base currentConfig to use as siteConfig | - -#### Returns - -[`MermaidConfig`](../interfaces/mermaid.MermaidConfig.md) - -The new siteConfig - -#### Defined in - -[packages/mermaid/src/config.ts:61](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L61) - ---- - -### updateCurrentConfig - -โ–ธ **updateCurrentConfig**(`siteCfg`, `_directives`): [`MermaidConfig`](../interfaces/mermaid.MermaidConfig.md) - -#### Parameters - -| Name | Type | -| :------------ | :----------------------------------------------------------- | -| `siteCfg` | [`MermaidConfig`](../interfaces/mermaid.MermaidConfig.md) | -| `_directives` | [`MermaidConfig`](../interfaces/mermaid.MermaidConfig.md)\[] | - -#### Returns - -[`MermaidConfig`](../interfaces/mermaid.MermaidConfig.md) - -#### Defined in - -[packages/mermaid/src/config.ts:15](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L15) - ---- - -### updateSiteConfig - -โ–ธ **updateSiteConfig**(`conf`): [`MermaidConfig`](../interfaces/mermaid.MermaidConfig.md) - -#### Parameters - -| Name | Type | -| :----- | :-------------------------------------------------------- | -| `conf` | [`MermaidConfig`](../interfaces/mermaid.MermaidConfig.md) | - -#### Returns - -[`MermaidConfig`](../interfaces/mermaid.MermaidConfig.md) - -#### Defined in - -[packages/mermaid/src/config.ts:79](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L79) diff --git a/docs/config/setup/modules/defaultConfig.md b/docs/config/setup/modules/defaultConfig.md deleted file mode 100644 index b4cf55dd1..000000000 --- a/docs/config/setup/modules/defaultConfig.md +++ /dev/null @@ -1,33 +0,0 @@ -> **Warning** -> -> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. -> -> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/modules/defaultConfig.md](../../../../packages/mermaid/src/docs/config/setup/modules/defaultConfig.md). - -# Module: defaultConfig - -## Variables - -### configKeys - -โ€ข `Const` **configKeys**: `Set`<`string`> - -#### Defined in - -[packages/mermaid/src/defaultConfig.ts:270](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/defaultConfig.ts#L270) - ---- - -### default - -โ€ข `Const` **default**: `RequiredDeep`<[`MermaidConfig`](../interfaces/mermaid.MermaidConfig.md)> - -Default mermaid configuration options. - -Please see the Mermaid config JSON Schema for the default JSON values. -Non-JSON JS default values are listed in this file, e.g. functions, or -`undefined` (explicitly set so that `configKeys` finds them). - -#### Defined in - -[packages/mermaid/src/defaultConfig.ts:18](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/defaultConfig.ts#L18) diff --git a/docs/config/setup/modules/mermaid.md b/docs/config/setup/modules/mermaid.md deleted file mode 100644 index 60c219f2d..000000000 --- a/docs/config/setup/modules/mermaid.md +++ /dev/null @@ -1,90 +0,0 @@ -> **Warning** -> -> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. -> -> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/modules/mermaid.md](../../../../packages/mermaid/src/docs/config/setup/modules/mermaid.md). - -# Module: mermaid - -## Classes - -- [UnknownDiagramError](../classes/mermaid.UnknownDiagramError.md) - -## Interfaces - -- [DetailedError](../interfaces/mermaid.DetailedError.md) -- [ExternalDiagramDefinition](../interfaces/mermaid.ExternalDiagramDefinition.md) -- [LayoutData](../interfaces/mermaid.LayoutData.md) -- [LayoutLoaderDefinition](../interfaces/mermaid.LayoutLoaderDefinition.md) -- [Mermaid](../interfaces/mermaid.Mermaid.md) -- [MermaidConfig](../interfaces/mermaid.MermaidConfig.md) -- [ParseOptions](../interfaces/mermaid.ParseOptions.md) -- [ParseResult](../interfaces/mermaid.ParseResult.md) -- [RenderOptions](../interfaces/mermaid.RenderOptions.md) -- [RenderResult](../interfaces/mermaid.RenderResult.md) -- [RunOptions](../interfaces/mermaid.RunOptions.md) - -## Type Aliases - -### InternalHelpers - -ฦฌ **InternalHelpers**: typeof `internalHelpers` - -#### Defined in - -[packages/mermaid/src/internals.ts:33](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/internals.ts#L33) - ---- - -### ParseErrorFunction - -ฦฌ **ParseErrorFunction**: (`err`: `string` | [`DetailedError`](../interfaces/mermaid.DetailedError.md) | `unknown`, `hash?`: `any`) => `void` - -#### Type declaration - -โ–ธ (`err`, `hash?`): `void` - -##### Parameters - -| Name | Type | -| :------ | :--------------------------------------------------------------------------------- | -| `err` | `string` \| [`DetailedError`](../interfaces/mermaid.DetailedError.md) \| `unknown` | -| `hash?` | `any` | - -##### Returns - -`void` - -#### Defined in - -[packages/mermaid/src/Diagram.ts:10](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/Diagram.ts#L10) - ---- - -### SVG - -ฦฌ **SVG**: `d3.Selection`<`SVGSVGElement`, `unknown`, `Element` | `null`, `unknown`> - -#### Defined in - -[packages/mermaid/src/diagram-api/types.ts:130](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/diagram-api/types.ts#L130) - ---- - -### SVGGroup - -ฦฌ **SVGGroup**: `d3.Selection`<`SVGGElement`, `unknown`, `Element` | `null`, `unknown`> - -#### Defined in - -[packages/mermaid/src/diagram-api/types.ts:132](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/diagram-api/types.ts#L132) - -## Variables - -### default - -โ€ข `Const` **default**: [`Mermaid`](../interfaces/mermaid.Mermaid.md) - -#### Defined in - -[packages/mermaid/src/mermaid.ts:442](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L442) diff --git a/docs/ecosystem/integrations-community.md b/docs/ecosystem/integrations-community.md index 101252303..dd497f760 100644 --- a/docs/ecosystem/integrations-community.md +++ b/docs/ecosystem/integrations-community.md @@ -40,6 +40,7 @@ To add an integration to this list, see the [Integrations - create page](./integ - [Mermaid Charts & Diagrams for Jira](https://marketplace.atlassian.com/apps/1224537/) - [Mermaid for Jira Cloud - Draw UML diagrams easily](https://marketplace.atlassian.com/apps/1223053/mermaid-for-jira-cloud-draw-uml-diagrams-easily?hosting=cloud&tab=overview) - [CloudScript.io Mermaid Addon](https://marketplace.atlassian.com/apps/1219878/cloudscript-io-mermaid-addon?hosting=cloud&tab=overview) + - [Mermaid plus for Confluence](https://marketplace.atlassian.com/apps/1236814/mermaid-plus-for-confluence?hosting=cloud&tab=overview) - [Azure Devops](https://learn.microsoft.com/en-us/azure/devops/project/wiki/markdown-guidance?view=azure-devops#add-mermaid-diagrams-to-a-wiki-page) โœ… - [Deepdwn](https://billiam.itch.io/deepdwn) โœ… - [Doctave](https://www.doctave.com/) โœ… @@ -70,6 +71,7 @@ To add an integration to this list, see the [Integrations - create page](./integ - [Notion](https://notion.so) โœ… - [Observable](https://observablehq.com/@observablehq/mermaid) โœ… - [Obsidian](https://help.obsidian.md/Editing+and+formatting/Advanced+formatting+syntax#Diagram) โœ… +- [Outline](https://docs.getoutline.com/s/guide/doc/diagrams-KQiKoT4wzK) โœ… - [Redmine](https://redmine.org) - [Mermaid Macro](https://www.redmine.org/plugins/redmine_mermaid_macro) - [Markdown for mermaid plugin](https://github.com/jamieh-mongolian/markdown-for-mermaid-plugin) @@ -266,7 +268,5 @@ Communication tools and platforms - [reveal.js-mermaid-plugin](https://github.com/ludwick/reveal.js-mermaid-plugin) - [Reveal CK](https://github.com/jedcn/reveal-ck) - [reveal-ck-mermaid-plugin](https://github.com/tmtm/reveal-ck-mermaid-plugin) -- [mermaid-isomorphic](https://github.com/remcohaszing/mermaid-isomorphic) -- [mermaid-server: Generate diagrams using a HTTP request](https://github.com/TomWright/mermaid-server) diff --git a/docs/ecosystem/integrations-create.md b/docs/ecosystem/integrations-create.md index f5e938d4d..921368406 100644 --- a/docs/ecosystem/integrations-create.md +++ b/docs/ecosystem/integrations-create.md @@ -24,7 +24,7 @@ Currently pending [IANA](https://www.iana.org/) recognition. ### Mermaid Discord workspace -We would love to see what you create with Mermaid. Please share your creations with us in our [Discord](https://discord.gg/AgrbSrBer3) server [#showcase](https://discord.com/channels/1079455296289788015/1079502635054399649) channel. +We would love to see what you create with Mermaid. Please share your creations with us in our [Discord](https://discord.gg/sKeNQX4Wtj) server [#showcase](https://discord.com/channels/1079455296289788015/1079502635054399649) channel. ### Add to Mermaid Ecosystem diff --git a/docs/ecosystem/mermaid-chart.md b/docs/ecosystem/mermaid-chart.md index 1348219c1..79fe3c788 100644 --- a/docs/ecosystem/mermaid-chart.md +++ b/docs/ecosystem/mermaid-chart.md @@ -48,7 +48,7 @@ Try the Ultimate AI, Mermaid, and Visual Diagramming Suite by creating an accoun ## Plans -- **Free** - A free plan that includes five diagrams. +- **Free** - A free plan that includes three diagrams. - **Pro** - A paid plan that includes unlimited diagrams, access to the collaboration feature, and more. @@ -56,7 +56,7 @@ Try the Ultimate AI, Mermaid, and Visual Diagramming Suite by creating an accoun To learn more, visit our [Pricing](https://mermaidchart.com/pricing) page. -Mermaid Chart is currently offering a 14-day free trial on our Pro and Enterprise tiers. Sign up for a free account at [Mermaid Chart](https://www.mermaidchart.com/app/sign-up). +Mermaid Chart is currently offering a 7-day free trial on our Pro and Enterprise tiers. Sign up for a free account at [Mermaid Chart](https://www.mermaidchart.com/app/sign-up). ## Mermaid JS contributions diff --git a/docs/intro/index.md b/docs/intro/index.md index 35707ee8f..0b9ace410 100644 --- a/docs/intro/index.md +++ b/docs/intro/index.md @@ -22,7 +22,7 @@ It is a JavaScript based diagramming and charting tool that renders Markdown-ins [![Coverage Status](https://coveralls.io/repos/github/mermaid-js/mermaid/badge.svg?branch=master)](https://coveralls.io/github/mermaid-js/mermaid?branch=master) [![CDN Status](https://img.shields.io/jsdelivr/npm/hm/mermaid)](https://www.jsdelivr.com/package/npm/mermaid) [![NPM](https://img.shields.io/npm/dm/mermaid)](https://www.npmjs.com/package/mermaid) -[![Join our Discord!](https://img.shields.io/static/v1?message=join%20chat&color=9cf&logo=discord&label=discord)](https://discord.gg/AgrbSrBer3) +[![Join our Discord!](https://img.shields.io/static/v1?message=join%20chat&color=9cf&logo=discord&label=discord)](https://discord.gg/sKeNQX4Wtj) [![Twitter Follow](https://img.shields.io/twitter/follow/mermaidjs_?style=social)](https://twitter.com/mermaidjs_) diff --git a/docs/news/blog.md b/docs/news/blog.md index 70a31e5c0..c9808505b 100644 --- a/docs/news/blog.md +++ b/docs/news/blog.md @@ -6,18 +6,36 @@ # Blog -## [Mermaid 11.4 is out: New Features and Kanban Diagramming](https://www.mermaidchart.com/blog/posts/mermaid-11-4-is-out-new-features-and-kanban-diagramming) +## [GUI for editing Mermaid Class Diagrams](https://docs.mermaidchart.com/blog/posts/gui-for-editing-mermaid-class-diagrams) -Mermaid 11.4 brings enhanced functionality with the introduction of Kanban diagrams, allowing users to create visual workflows with status columns and task details. +1/17/2025 โ€ข 5 mins + +Discover how the latest update to the Mermaid Visual Editor transforms class diagramming. With new intuitive tools for creating and editing diagrams, dynamic relationship management, and customizable layouts, this feature-packed enhancement streamlines your diagramming experience like never before. + +## [7 ER Diagram Examples For Database Modeling from Mermaid AI](https://docs.mermaidchart.com/blog/posts/7-er-diagram-examples-for-database-modeling-from-mermaid-ai) + +1/16/2025 โ€ข 6 mins + +Entity relationship (ER) diagrams are a cornerstone of database design, providing a blueprint for modeling your database and enabling clear communication across functions in your organization. As data volumes continue to soar and as AI models demand clean, well-organized data, ER diagrams have become more vital than ever. You can now quickly build ER diagrams with Mermaid Chart, Mermaid AI to Kickstart and fine tune your diagrams . From e-commerce payment flows to social media interactions and healthcare systems, ER diagrams are powering modern, data-driven environments. + +## [Mermaid Whiteboard: Visual Collaboration Made Universal](https://docs.mermaidchart.com/blog/posts/mermaid-whiteboard-visual-collaboration-made-universal) + +12/6/2024 โ€ข 2 mins + +The Mermaid Whiteboard combines Mermaid syntax with a drag-and-drop interface, making it easier for teams to create, edit, and refine diagrams together. Whether you prefer working with code, visuals, Mermaid AI or all three, this tool adapts to your needs while keeping everything tied to Mermaidโ€™s syntax. Key Features 1. Dual-Mode Editing Switch seamlessly between \[โ€ฆ] + +## [Mermaid 11.4 is out: New Features and Kanban Diagramming](https://www.mermaidchart.com/blog/posts/mermaid-11-4-is-out-new-features-and-kanban-diagramming) October 31, 2024 ยท 2 mins +Mermaid 11.4 brings enhanced functionality with the introduction of Kanban diagrams, allowing users to create visual workflows with status columns and task details. + ## [How To Build an ER Diagram with Mermaid Chart](https://www.mermaidchart.com/blog/posts/how-to-build-an-er-diagram-with-mermaid-chart) -An entity relationship (ER) diagram acts like a blueprint for your database. This makes ER diagrams effective tools for anyone dealing with complex databases, data modeling, and AI model training. - October 24, 2024 ยท 4 mins +An entity relationship (ER) diagram acts like a blueprint for your database. This makes ER diagrams effective tools for anyone dealing with complex databases, data modeling, and AI model training. + ## [Expanding the Horizons of Mermaid Flowcharts: Introducing 30 New Shapes!](https://www.mermaidchart.com/blog/posts/new-mermaid-flowchart-shapes/) 24 September 2024 ยท 5 mins diff --git a/docs/syntax/entityRelationshipDiagram.md b/docs/syntax/entityRelationshipDiagram.md index 693cb53c7..4ec776c10 100644 --- a/docs/syntax/entityRelationshipDiagram.md +++ b/docs/syntax/entityRelationshipDiagram.md @@ -92,7 +92,7 @@ Mermaid syntax for ER diagrams is compatible with PlantUML, with an extension to Where: -- `first-entity` is the name of an entity. Names must begin with an alphabetic character or an underscore (from v10.5.0+), and may also contain digits and hyphens. +- `first-entity` is the name of an entity. Names support any unicode characters and can include spaces if surrounded by double quotes (e.g. "name with space"). - `relationship` describes the way that both entities inter-relate. See below. - `second-entity` is the name of the other entity. - `relationship-label` describes the relationship from the perspective of the first entity. @@ -107,6 +107,34 @@ This statement can be read as _a property contains one or more rooms, and a room Only the `first-entity` part of a statement is mandatory. This makes it possible to show an entity with no relationships, which can be useful during iterative construction of diagrams. If any other parts of a statement are specified, then all parts are mandatory. +#### Unicode text + +Entity names, relationships, and attributes all support unicode text. + +```mermaid-example +erDiagram + "This โค Unicode" +``` + +```mermaid +erDiagram + "This โค Unicode" +``` + +#### Markdown formatting + +Markdown formatting and text is also supported. + +```mermaid-example +erDiagram + "This **is** _Markdown_" +``` + +```mermaid +erDiagram + "This **is** _Markdown_" +``` + ### Relationship Syntax The `relationship` part of each statement can be broken down into three sub-components: @@ -145,6 +173,11 @@ Cardinality is a property that describes how many elements of another entity can Relationships may be classified as either _identifying_ or _non-identifying_ and these are rendered with either solid or dashed lines respectively. This is relevant when one of the entities in question can not have independent existence without the other. For example a firm that insures people to drive cars might need to store data on `NAMED-DRIVER`s. In modelling this we might start out by observing that a `CAR` can be driven by many `PERSON` instances, and a `PERSON` can drive many `CAR`s - both entities can exist without the other, so this is a non-identifying relationship that we might specify in Mermaid as: `PERSON }|..|{ CAR : "driver"`. Note the two dots in the middle of the relationship that will result in a dashed line being drawn between the two entities. But when this many-to-many relationship is resolved into two one-to-many relationships, we observe that a `NAMED-DRIVER` cannot exist without both a `PERSON` and a `CAR` - the relationships become identifying and would be specified using hyphens, which translate to a solid line: +| Value | Alias for | +| :---: | :---------------: | +| -- | _identifying_ | +| .. | _non-identifying_ | + **Aliases** | Value | Alias for | @@ -155,13 +188,25 @@ Relationships may be classified as either _identifying_ or _non-identifying_ and ```mermaid-example erDiagram CAR ||--o{ NAMED-DRIVER : allows - PERSON ||--o{ NAMED-DRIVER : is + PERSON }o..o{ NAMED-DRIVER : is ``` ```mermaid erDiagram CAR ||--o{ NAMED-DRIVER : allows - PERSON ||--o{ NAMED-DRIVER : is + PERSON }o..o{ NAMED-DRIVER : is +``` + +```mermaid-example +erDiagram + CAR 1 to zero or more NAMED-DRIVER : allows + PERSON many(0) optionally to 0+ NAMED-DRIVER : is +``` + +```mermaid +erDiagram + CAR 1 to zero or more NAMED-DRIVER : allows + PERSON many(0) optionally to 0+ NAMED-DRIVER : is ``` ### Attributes @@ -202,9 +247,9 @@ erDiagram The `type` values must begin with an alphabetic character and may contain digits, hyphens, underscores, parentheses and square brackets. The `name` values follow a similar format to `type`, but may start with an asterisk as another option to indicate an attribute is a primary key. Other than that, there are no restrictions, and there is no implicit set of valid data types. -### Entity Name Aliases (v10.5.0+) +### Entity Name Aliases -An alias can be added to an entity using square brackets. If provided, the alias will be showed in the diagram instead of the entity name. +An alias can be added to an entity using square brackets. If provided, the alias will be showed in the diagram instead of the entity name. Alias names follow all of the same rules as entity names. ```mermaid-example erDiagram @@ -232,7 +277,7 @@ erDiagram #### Attribute Keys and Comments -Attributes may also have a `key` or comment defined. Keys can be `PK`, `FK` or `UK`, for Primary Key, Foreign Key or Unique Key. To specify multiple key constraints on a single attribute, separate them with a comma (e.g., `PK, FK`). A `comment` is defined by double quotes at the end of an attribute. Comments themselves cannot have double-quote characters in them. +Attributes may also have a `key` or comment defined. Keys can be `PK`, `FK` or `UK`, for Primary Key, Foreign Key or Unique Key (markdown formatting and unicode is not supported for keys). To specify multiple key constraints on a single attribute, separate them with a comma (e.g., `PK, FK`). A `comment` is defined by double quotes at the end of an attribute. Comments themselves cannot have double-quote characters in them. ```mermaid-example erDiagram @@ -282,35 +327,344 @@ erDiagram MANUFACTURER only one to zero or more CAR : makes ``` -### Other Things +### Direction -- If you want the relationship label to be more than one word, you must use double quotes around the phrase -- If you don't want a label at all on a relationship, you must use an empty double-quoted string -- (v11.1.0+) If you want a multi-line label on a relationship, use `
    ` between the two lines (`"first line
    second line"`) +The direction statement declares the direction of the diagram. -## Styling +This declares that the diagram is oriented from top to bottom (`TB`). This can be reversed to be oriented from bottom to top (`BT`). -### Config options +```mermaid-example +erDiagram + direction TB + CUSTOMER ||--o{ ORDER : places + CUSTOMER { + string name + string custNumber + string sector + } + ORDER ||--|{ LINE-ITEM : contains + ORDER { + int orderNumber + string deliveryAddress + } + LINE-ITEM { + string productCode + int quantity + float pricePerUnit + } +``` -For simple color customization: +```mermaid +erDiagram + direction TB + CUSTOMER ||--o{ ORDER : places + CUSTOMER { + string name + string custNumber + string sector + } + ORDER ||--|{ LINE-ITEM : contains + ORDER { + int orderNumber + string deliveryAddress + } + LINE-ITEM { + string productCode + int quantity + float pricePerUnit + } +``` -| Name | Used as | -| :------- | :------------------------------------------------------------------- | -| `fill` | Background color of an entity or attribute | -| `stroke` | Border color of an entity or attribute, line color of a relationship | +This declares that the diagram is oriented from left to right (`LR`). This can be reversed to be oriented from right to left (`RL`). -### Classes used +```mermaid-example +erDiagram + direction LR + CUSTOMER ||--o{ ORDER : places + CUSTOMER { + string name + string custNumber + string sector + } + ORDER ||--|{ LINE-ITEM : contains + ORDER { + int orderNumber + string deliveryAddress + } + LINE-ITEM { + string productCode + int quantity + float pricePerUnit + } +``` -The following CSS class selectors are available for richer styling: +```mermaid +erDiagram + direction LR + CUSTOMER ||--o{ ORDER : places + CUSTOMER { + string name + string custNumber + string sector + } + ORDER ||--|{ LINE-ITEM : contains + ORDER { + int orderNumber + string deliveryAddress + } + LINE-ITEM { + string productCode + int quantity + float pricePerUnit + } +``` -| Selector | Description | -| :------------------------- | :---------------------------------------------------- | -| `.er.attributeBoxEven` | The box containing attributes on even-numbered rows | -| `.er.attributeBoxOdd` | The box containing attributes on odd-numbered rows | -| `.er.entityBox` | The box representing an entity | -| `.er.entityLabel` | The label for an entity | -| `.er.relationshipLabel` | The label for a relationship | -| `.er.relationshipLabelBox` | The box surrounding a relationship label | -| `.er.relationshipLine` | The line representing a relationship between entities | +Possible diagram orientations are: + +- TB - Top to bottom +- BT - Bottom to top +- RL - Right to left +- LR - Left to right + +### Styling a node + +It is possible to apply specific styles such as a thicker border or a different background color to a node. + +```mermaid-example +erDiagram + id1||--||id2 : label + style id1 fill:#f9f,stroke:#333,stroke-width:4px + style id2 fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5 +``` + +```mermaid +erDiagram + id1||--||id2 : label + style id1 fill:#f9f,stroke:#333,stroke-width:4px + style id2 fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5 +``` + +It is also possible to attach styles to a list of nodes in one statement: + +``` + style nodeId1,nodeId2 styleList +``` + +#### Classes + +More convenient than defining the style every time is to define a class of styles and attach this class to the nodes that +should have a different look. + +A class definition looks like the example below: + +``` + classDef className fill:#f9f,stroke:#333,stroke-width:4px +``` + +It is also possible to define multiple classes in one statement: + +``` + classDef firstClassName,secondClassName font-size:12pt +``` + +Attachment of a class to a node is done as per below: + +``` + class nodeId1 className +``` + +It is also possible to attach a class to a list of nodes in one statement: + +``` + class nodeId1,nodeId2 className +``` + +Multiple classes can be attached at the same time as well: + +``` + class nodeId1,nodeId2 className1,className2 +``` + +A shorter form of adding a class is to attach the classname to the node using the `:::`operator as per below: + +```mermaid-example +erDiagram + direction TB + CAR:::someclass { + string registrationNumber + string make + string model + } + PERSON:::someclass { + string firstName + string lastName + int age + } + HOUSE:::someclass + + classDef someclass fill:#f96 +``` + +```mermaid +erDiagram + direction TB + CAR:::someclass { + string registrationNumber + string make + string model + } + PERSON:::someclass { + string firstName + string lastName + int age + } + HOUSE:::someclass + + classDef someclass fill:#f96 +``` + +This form can be used when declaring relationships between entities: + +```mermaid-example +erDiagram + CAR { + string registrationNumber + string make + string model + } + PERSON { + string firstName + string lastName + int age + } + PERSON:::foo ||--|| CAR : owns + PERSON o{--|| HOUSE:::bar : has + + classDef foo stroke:#f00 + classDef bar stroke:#0f0 + classDef foobar stroke:#00f +``` + +```mermaid +erDiagram + CAR { + string registrationNumber + string make + string model + } + PERSON { + string firstName + string lastName + int age + } + PERSON:::foo ||--|| CAR : owns + PERSON o{--|| HOUSE:::bar : has + + classDef foo stroke:#f00 + classDef bar stroke:#0f0 + classDef foobar stroke:#00f +``` + +Similar to the class statement, the shorthand syntax can also apply multiple classes at once: + +``` + nodeId:::className1,className2 +``` + +### Default class + +If a class is named default it will be assigned to all classes without specific class definitions. + +``` + classDef default fill:#f9f,stroke:#333,stroke-width:4px; +``` + +> **Note:** Custom styles from style or other class statements take priority and will overwrite the default styles. (e.g. The `default` class gives nodes a background color of pink but the `blue` class will give that node a background color of blue if applied.) + +```mermaid-example +erDiagram + CAR { + string registrationNumber + string make + string model + } + PERSON { + string firstName + string lastName + int age + } + PERSON:::foo ||--|| CAR : owns + PERSON o{--|| HOUSE:::bar : has + + classDef default fill:#f9f,stroke-width:4px + classDef foo stroke:#f00 + classDef bar stroke:#0f0 + classDef foobar stroke:#00f +``` + +```mermaid +erDiagram + CAR { + string registrationNumber + string make + string model + } + PERSON { + string firstName + string lastName + int age + } + PERSON:::foo ||--|| CAR : owns + PERSON o{--|| HOUSE:::bar : has + + classDef default fill:#f9f,stroke-width:4px + classDef foo stroke:#f00 + classDef bar stroke:#0f0 + classDef foobar stroke:#00f +``` + +## Configuration + +### Layout + +The layout of the diagram is handled by [`render()`](../config/setup/mermaid/interfaces/Mermaid.md#render). The default layout is dagre. + +For larger or more-complex diagrams, you can alternatively apply the ELK (Eclipse Layout Kernel) layout using your YAML frontmatter's `config`. For more information, see [Customizing ELK Layout](../intro/syntax-reference.md#customizing-elk-layout). + +```yaml +--- +config: + layout: elk +--- +``` + +Your Mermaid code should be similar to the following: + +```mermaid-example +--- +title: Order example +config: + layout: elk +--- +erDiagram + CUSTOMER ||--o{ ORDER : places + ORDER ||--|{ LINE-ITEM : contains + CUSTOMER }|..|{ DELIVERY-ADDRESS : uses +``` + +```mermaid +--- +title: Order example +config: + layout: elk +--- +erDiagram + CUSTOMER ||--o{ ORDER : places + ORDER ||--|{ LINE-ITEM : contains + CUSTOMER }|..|{ DELIVERY-ADDRESS : uses +``` + +> **Note** +> Note that the site needs to use mermaid version 9.4+ for this to work and have this featured enabled in the lazy-loading configuration. diff --git a/docs/syntax/flowchart.md b/docs/syntax/flowchart.md index 7bc3fd370..df528ca59 100644 --- a/docs/syntax/flowchart.md +++ b/docs/syntax/flowchart.md @@ -1193,12 +1193,12 @@ To give an edge an ID, prepend the edge syntax with the ID followed by an `@` ch ```mermaid-example flowchart LR - A e1@โ€“> B + A e1@--> B ``` ```mermaid flowchart LR - A e1@โ€“> B + A e1@--> B ``` In this example, `e1` is the ID of the edge connecting `A` to `B`. You can then use this ID in later definitions or style statements, just like with nodes. @@ -1229,13 +1229,13 @@ In the initial version, two animation speeds are supported: `fast` and `slow`. S ```mermaid-example flowchart LR - A e1@โ€“> B + A e1@--> B e1@{ animation: fast } ``` ```mermaid flowchart LR - A e1@โ€“> B + A e1@--> B e1@{ animation: fast } ``` @@ -1247,14 +1247,14 @@ You can also animate edges by assigning a class to them and then defining animat ```mermaid-example flowchart LR - A e1@โ€“> B + A e1@--> B classDef animate stroke-dasharray: 9,5,stroke-dashoffset: 900,animation: dash 25s linear infinite; class e1 animate ``` ```mermaid flowchart LR - A e1@โ€“> B + A e1@--> B classDef animate stroke-dasharray: 9,5,stroke-dashoffset: 900,animation: dash 25s linear infinite; class e1 animate ``` diff --git a/docs/syntax/radar.md b/docs/syntax/radar.md new file mode 100644 index 000000000..f8eabf3e6 --- /dev/null +++ b/docs/syntax/radar.md @@ -0,0 +1,253 @@ +> **Warning** +> +> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. +> +> ## Please edit the corresponding file in [/packages/mermaid/src/docs/syntax/radar.md](../../packages/mermaid/src/docs/syntax/radar.md). + +# Radar Diagram (v11.6.0+) + +## Introduction + +A radar diagram is a simple way to plot low-dimensional data in a circular format. + +It is also known as a **radar chart**, **spider chart**, **star chart**, **cobweb chart**, **polar chart**, or **Kiviat diagram**. + +## Usage + +This diagram type is particularly useful for developers, data scientists, and engineers who require a clear and concise way to represent data in a circular format. + +It is commonly used to graphically summarize and compare the performance of multiple entities across multiple dimensions. + +## Syntax + +```md +radar-beta +axis A, B, C, D, E +curve c1{1,2,3,4,5} +curve c2{5,4,3,2,1} +... More Fields ... +``` + +## Examples + +```mermaid-example +--- +title: "Grades" +--- +radar-beta + axis m["Math"], s["Science"], e["English"] + axis h["History"], g["Geography"], a["Art"] + curve a["Alice"]{85, 90, 80, 70, 75, 90} + curve b["Bob"]{70, 75, 85, 80, 90, 85} + + max 100 + min 0 +``` + +```mermaid +--- +title: "Grades" +--- +radar-beta + axis m["Math"], s["Science"], e["English"] + axis h["History"], g["Geography"], a["Art"] + curve a["Alice"]{85, 90, 80, 70, 75, 90} + curve b["Bob"]{70, 75, 85, 80, 90, 85} + + max 100 + min 0 +``` + +```mermaid-example +radar-beta + title Restaurant Comparison + axis food["Food Quality"], service["Service"], price["Price"] + axis ambiance["Ambiance"], + + curve a["Restaurant A"]{4, 3, 2, 4} + curve b["Restaurant B"]{3, 4, 3, 3} + curve c["Restaurant C"]{2, 3, 4, 2} + curve d["Restaurant D"]{2, 2, 4, 3} + + graticule polygon + max 5 + +``` + +```mermaid +radar-beta + title Restaurant Comparison + axis food["Food Quality"], service["Service"], price["Price"] + axis ambiance["Ambiance"], + + curve a["Restaurant A"]{4, 3, 2, 4} + curve b["Restaurant B"]{3, 4, 3, 3} + curve c["Restaurant C"]{2, 3, 4, 2} + curve d["Restaurant D"]{2, 2, 4, 3} + + graticule polygon + max 5 + +``` + +## Details of Syntax + +### Title + +`title`: The title is an optional field that allows to render a title at the top of the radar diagram. + +``` +radar-beta + title Title of the Radar Diagram + ... +``` + +### Axis + +`axis`: The axis keyword is used to define the axes of the radar diagram. + +Each axis is represented by an ID and an optional label. + +Multiple axes can be defined in a single line. + +``` +radar-beta + axis id1["Label1"] + axis id2["Label2"], id3["Label3"] + ... +``` + +### Curve + +`curve`: The curve keyword is used to define the data points for a curve in the radar diagram. + +Each curve is represented by an ID, an optional label, and a list of values. + +Values can be defined by a list of numbers or a list of key-value pairs. If key-value pairs are used, the key represents the axis ID and the value represents the data point. Else, the data points are assumed to be in the order of the axes defined. + +Multiple curves can be defined in a single line. + +``` +radar-beta + axis axis1, axis2, axis3 + curve id1["Label1"]{1, 2, 3} + curve id2["Label2"]{4, 5, 6}, id3{7, 8, 9} + curve id4{ axis3: 30, axis1: 20, axis2: 10 } + ... +``` + +### Options + +- `showLegend`: The showLegend keyword is used to show or hide the legend in the radar diagram. The legend is shown by default. +- `max`: The maximum value for the radar diagram. This is used to scale the radar diagram. If not provided, the maximum value is calculated from the data points. +- `min`: The minimum value for the radar diagram. This is used to scale the radar diagram. If not provided, the minimum value is `0`. +- `graticule`: The graticule keyword is used to define the type of graticule to be rendered in the radar diagram. The graticule can be `circle` or `polygon`. If not provided, the default graticule is `circle`. +- `ticks`: The ticks keyword is used to define the number of ticks on the graticule. It is the number of concentric circles or polygons drawn to indicate the scale of the radar diagram. If not provided, the default number of ticks is `5`. + +``` +radar-beta + ... + showLegend true + max 100 + min 0 + graticule circle + ticks 5 + ... +``` + +## Configuration + +Please refer to the [configuration](/config/schema-docs/config-defs-radar-diagram-config.html) guide for details. + +| Parameter | Description | Default Value | +| --------------- | ---------------------------------------- | ------------- | +| width | Width of the radar diagram | `600` | +| height | Height of the radar diagram | `600` | +| marginTop | Top margin of the radar diagram | `50` | +| marginBottom | Bottom margin of the radar diagram | `50` | +| marginLeft | Left margin of the radar diagram | `50` | +| marginRight | Right margin of the radar diagram | `50` | +| axisScaleFactor | Scale factor for the axis | `1` | +| axisLabelFactor | Factor to adjust the axis label position | `1.05` | +| curveTension | Tension for the rounded curves | `0.17` | + +## Theme Variables + +### Global Theme Variables + +> **Note** +> The default values for these variables depend on the theme used. To override the default values, set the desired values in the themeVariables section of the configuration: +> %%{init: {"themeVariables": {"cScale0": "#FF0000", "cScale1": "#00FF00"}} }%% + +Radar charts support the color scales `cScale${i}` where `i` is a number from `0` to the theme's maximum number of colors in its color scale. Usually, the maximum number of colors is `12`. + +| Property | Description | +| ---------- | ------------------------------ | +| fontSize | Font size of the title | +| titleColor | Color of the title | +| cScale${i} | Color scale for the i-th curve | + +### Radar Style Options + +> **Note** +> Specific variables for radar resides inside the `radar` key. To set the radar style options, use this syntax. +> %%{init: {"themeVariables": {"radar": {"axisColor": "#FF0000"}} } }%% + +| Property | Description | Default Value | +| -------------------- | ---------------------------- | ------------- | +| axisColor | Color of the axis lines | `black` | +| axisStrokeWidth | Width of the axis lines | `1` | +| axisLabelFontSize | Font size of the axis labels | `12px` | +| curveOpacity | Opacity of the curves | `0.7` | +| curveStrokeWidth | Width of the curves | `2` | +| graticuleColor | Color of the graticule | `black` | +| graticuleOpacity | Opacity of the graticule | `0.5` | +| graticuleStrokeWidth | Width of the graticule | `1` | +| legendBoxSize | Size of the legend box | `10` | +| legendFontSize | Font size of the legend | `14px` | + +## Example on config and theme + +```mermaid-example +--- +config: + radar: + axisScaleFactor: 0.25 + curveTension: 0.1 + theme: base + themeVariables: + cScale0: "#FF0000" + cScale1: "#00FF00" + cScale2: "#0000FF" + radar: + curveOpacity: 0 +--- +radar-beta + axis A, B, C, D, E + curve c1{1,2,3,4,5} + curve c2{5,4,3,2,1} + curve c3{3,3,3,3,3} +``` + +```mermaid +--- +config: + radar: + axisScaleFactor: 0.25 + curveTension: 0.1 + theme: base + themeVariables: + cScale0: "#FF0000" + cScale1: "#00FF00" + cScale2: "#0000FF" + radar: + curveOpacity: 0 +--- +radar-beta + axis A, B, C, D, E + curve c1{1,2,3,4,5} + curve c2{5,4,3,2,1} + curve c3{3,3,3,3,3} +``` + + diff --git a/docs/syntax/requirementDiagram.md b/docs/syntax/requirementDiagram.md index 01fdf1944..4dd7d16d9 100644 --- a/docs/syntax/requirementDiagram.md +++ b/docs/syntax/requirementDiagram.md @@ -84,6 +84,37 @@ element user_defined_name { } ``` +### Markdown Formatting + +In places where user defined text is possible (like names, requirement text, element docref, etc.), you can: + +- Surround the text in quotes: `"example text"` +- Use markdown formatting inside quotes: `"**bold text** and *italics*"` + +Example: + +```mermaid-example +requirementDiagram + +requirement "__test_req__" { + id: 1 + text: "*italicized text* **bold text**" + risk: high + verifymethod: test +} +``` + +```mermaid +requirementDiagram + +requirement "__test_req__" { + id: 1 + text: "*italicized text* **bold text**" + risk: high + verifymethod: test +} +``` + ### Relationship Relationships are comprised of a source node, destination node, and relationship type. @@ -250,4 +281,215 @@ This example uses all features of the diagram. test_req <- copies - test_entity2 ``` +## Direction + +The diagram can be rendered in different directions using the `direction` statement. Valid values are: + +- `TB` - Top to Bottom (default) +- `BT` - Bottom to Top +- `LR` - Left to Right +- `RL` - Right to Left + +Example: + +```mermaid-example +requirementDiagram + +direction LR + +requirement test_req { + id: 1 + text: the test text. + risk: high + verifymethod: test +} + +element test_entity { + type: simulation +} + +test_entity - satisfies -> test_req +``` + +```mermaid +requirementDiagram + +direction LR + +requirement test_req { + id: 1 + text: the test text. + risk: high + verifymethod: test +} + +element test_entity { + type: simulation +} + +test_entity - satisfies -> test_req +``` + +## Styling + +Requirements and elements can be styled using direct styling or classes. As a rule of thumb, when applying styles or classes, it accepts a list of requirement or element names and a list of class names allowing multiple assignments at a time (The only exception is the shorthand syntax `:::` which can assign multiple classes but only to one requirement or element at a time). + +### Direct Styling + +Use the `style` keyword to apply CSS styles directly: + +```mermaid-example +requirementDiagram + +requirement test_req { + id: 1 + text: styling example + risk: low + verifymethod: test +} + +element test_entity { + type: simulation +} + +style test_req fill:#ffa,stroke:#000, color: green +style test_entity fill:#f9f,stroke:#333, color: blue +``` + +```mermaid +requirementDiagram + +requirement test_req { + id: 1 + text: styling example + risk: low + verifymethod: test +} + +element test_entity { + type: simulation +} + +style test_req fill:#ffa,stroke:#000, color: green +style test_entity fill:#f9f,stroke:#333, color: blue +``` + +### Class Definitions + +Define reusable styles using `classDef`: + +```mermaid-example +requirementDiagram + +requirement test_req { + id: 1 + text: "class styling example" + risk: low + verifymethod: test +} + +element test_entity { + type: simulation +} + +classDef important fill:#f96,stroke:#333,stroke-width:4px +classDef test fill:#ffa,stroke:#000 +``` + +```mermaid +requirementDiagram + +requirement test_req { + id: 1 + text: "class styling example" + risk: low + verifymethod: test +} + +element test_entity { + type: simulation +} + +classDef important fill:#f96,stroke:#333,stroke-width:4px +classDef test fill:#ffa,stroke:#000 +``` + +### Default class + +If a class is named default it will be applied to all nodes. Specific styles and classes should be defined afterwards to override the applied default styling. + +``` +classDef default fill:#f9f,stroke:#333,stroke-width:4px; +``` + +### Applying Classes + +Classes can be applied in two ways: + +1. Using the `class` keyword: + +``` +class test_req,test_entity important +``` + +2. Using the shorthand syntax with `:::` either during the definition or afterwards: + +``` +requirement test_req:::important { + id: 1 + text: class styling example + risk: low + verifymethod: test +} +``` + +``` +element test_elem { +} + +test_elem:::myClass +``` + +### Combined Example + +```mermaid-example +requirementDiagram + +requirement test_req:::important { + id: 1 + text: "class styling example" + risk: low + verifymethod: test +} + +element test_entity { + type: simulation +} + +classDef important font-weight:bold + +class test_entity important +style test_entity fill:#f9f,stroke:#333 +``` + +```mermaid +requirementDiagram + +requirement test_req:::important { + id: 1 + text: "class styling example" + risk: low + verifymethod: test +} + +element test_entity { + type: simulation +} + +classDef important font-weight:bold + +class test_entity important +style test_entity fill:#f9f,stroke:#333 +``` + diff --git a/package.json b/package.json index b34b492d0..df7e36ade 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "version": "10.2.4", "description": "Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.", "type": "module", - "packageManager": "pnpm@9.9.0+sha512.60c18acd138bff695d339be6ad13f7e936eea6745660d4cc4a776d5247c540d0edee1a563695c183a66eb917ef88f2b4feb1fc25f32a7adcadc7aaf3438e99c1", + "packageManager": "pnpm@10.4.1+sha512.c753b6c3ad7afa13af388fa6d808035a008e30ea9993f58c6663e2bc5ff21679aa834db094987129aa4d488b86df57f7b634981b2f827cdcacc698cc0cfb88af", "keywords": [ "diagram", "markdown", @@ -63,73 +63,73 @@ ] }, "devDependencies": { - "@applitools/eyes-cypress": "^3.44.4", - "@argos-ci/cypress": "^2.2.2", - "@changesets/changelog-github": "^0.5.0", - "@changesets/cli": "^2.27.7", - "@cspell/eslint-plugin": "^8.8.4", - "@cypress/code-coverage": "^3.12.30", - "@eslint/js": "^9.4.0", - "@rollup/plugin-typescript": "^11.1.6", + "@applitools/eyes-cypress": "^3.44.9", + "@argos-ci/cypress": "^3.2.0", + "@changesets/changelog-github": "^0.5.1", + "@changesets/cli": "^2.27.12", + "@cspell/eslint-plugin": "^8.18.1", + "@cypress/code-coverage": "^3.12.49", + "@eslint/js": "^9.24.0", + "@rollup/plugin-typescript": "^12.1.2", "@types/cors": "^2.8.17", - "@types/express": "^4.17.21", + "@types/express": "^5.0.0", "@types/js-yaml": "^4.0.9", - "@types/jsdom": "^21.1.6", - "@types/lodash": "^4.17.0", - "@types/mdast": "^4.0.3", - "@types/node": "^20.11.30", - "@types/rollup-plugin-visualizer": "^4.2.4", - "@vitest/coverage-v8": "^1.4.0", - "@vitest/spy": "^1.4.0", - "@vitest/ui": "^1.4.0", - "ajv": "^8.12.0", + "@types/jsdom": "^21.1.7", + "@types/lodash": "^4.17.15", + "@types/mdast": "^4.0.4", + "@types/node": "^22.13.5", + "@types/rollup-plugin-visualizer": "^5.0.3", + "@vitest/coverage-v8": "^3.0.6", + "@vitest/spy": "^3.0.6", + "@vitest/ui": "^3.0.6", + "ajv": "^8.17.1", "chokidar": "^3.6.0", - "concurrently": "^8.2.2", + "concurrently": "^9.1.2", "cors": "^2.8.5", "cpy-cli": "^5.0.0", "cross-env": "^7.0.3", - "cspell": "^8.6.0", - "cypress": "^13.14.1", + "cspell": "^8.6.1", + "cypress": "^14.0.3", "cypress-image-snapshot": "^4.0.1", - "cypress-split": "^1.24.0", + "cypress-split": "^1.24.14", "esbuild": "^0.25.0", - "eslint": "^9.4.0", - "eslint-config-prettier": "^10.0.0", - "eslint-plugin-cypress": "^4.0.0", - "eslint-plugin-html": "^8.1.1", - "eslint-plugin-jest": "^28.6.0", - "eslint-plugin-jsdoc": "^50.0.0", - "eslint-plugin-json": "^4.0.0", + "eslint": "^9.24.0", + "eslint-config-prettier": "^10.1.1", + "eslint-plugin-cypress": "^4.2.1", + "eslint-plugin-html": "^8.1.2", + "eslint-plugin-jest": "^28.11.0", + "eslint-plugin-jsdoc": "^50.6.9", + "eslint-plugin-json": "^4.0.1", "eslint-plugin-lodash": "^8.0.0", - "eslint-plugin-markdown": "^5.0.0", - "eslint-plugin-no-only-tests": "^3.1.0", + "eslint-plugin-markdown": "^5.1.0", + "eslint-plugin-no-only-tests": "^3.3.0", "eslint-plugin-tsdoc": "^0.4.0", - "eslint-plugin-unicorn": "^57.0.0", - "express": "^4.19.1", - "globals": "^15.4.0", - "globby": "^14.0.1", - "husky": "^9.0.11", + "eslint-plugin-unicorn": "^58.0.0", + "express": "^4.19.2", + "globals": "^16.0.0", + "globby": "^14.0.2", + "husky": "^9.1.7", "jest": "^29.7.0", "jison": "^0.4.18", "js-yaml": "^4.1.0", - "jsdom": "^24.0.0", - "langium-cli": "3.0.3", - "lint-staged": "^15.2.2", - "markdown-table": "^3.0.3", - "nyc": "^15.1.0", + "jsdom": "^26.0.0", + "langium-cli": "3.3.0", + "lint-staged": "^15.2.11", + "markdown-table": "^3.0.4", + "nyc": "^17.1.0", "path-browserify": "^1.0.1", - "prettier": "^3.2.5", - "prettier-plugin-jsdoc": "^1.3.0", - "rimraf": "^5.0.5", - "rollup-plugin-visualizer": "^5.12.0", - "start-server-and-test": "^2.0.3", + "prettier": "^3.5.2", + "prettier-plugin-jsdoc": "^1.3.2", + "rimraf": "^6.0.1", + "rollup-plugin-visualizer": "^5.14.0", + "start-server-and-test": "^2.0.10", "tslib": "^2.8.1", - "tsx": "^4.7.1", - "typescript": "~5.4.5", - "typescript-eslint": "^8.0.0-alpha.34", - "vite": "^5.2.3", - "vite-plugin-istanbul": "^6.0.0", - "vitest": "^1.4.0" + "tsx": "^4.7.3", + "typescript": "~5.7.3", + "typescript-eslint": "^8.29.1", + "vite": "^6.1.1", + "vite-plugin-istanbul": "^7.0.0", + "vitest": "^3.0.6" }, "nyc": { "report-dir": "coverage/cypress" @@ -137,6 +137,10 @@ "pnpm": { "patchedDependencies": { "roughjs": "patches/roughjs.patch" - } + }, + "onlyBuiltDependencies": [ + "cypress", + "esbuild" + ] } } diff --git a/packages/mermaid-example-diagram/package.json b/packages/mermaid-example-diagram/package.json index 28cb54b9e..75eaa498e 100644 --- a/packages/mermaid-example-diagram/package.json +++ b/packages/mermaid-example-diagram/package.json @@ -37,14 +37,14 @@ ] }, "dependencies": { - "@braintree/sanitize-url": "^7.0.0", + "@braintree/sanitize-url": "^7.0.4", "d3": "^7.9.0", "khroma": "^2.1.0" }, "devDependencies": { - "concurrently": "^8.2.2", + "concurrently": "^9.1.2", "mermaid": "workspace:*", - "rimraf": "^5.0.5" + "rimraf": "^6.0.1" }, "files": [ "dist" diff --git a/packages/mermaid-layout-elk/package.json b/packages/mermaid-layout-elk/package.json index a043d4c38..2ce9bc278 100644 --- a/packages/mermaid-layout-elk/package.json +++ b/packages/mermaid-layout-elk/package.json @@ -37,7 +37,7 @@ "mermaid": "workspace:^" }, "peerDependencies": { - "mermaid": "^11.0.0" + "mermaid": "^11.0.2" }, "files": [ "dist" diff --git a/packages/mermaid-zenuml/package.json b/packages/mermaid-zenuml/package.json index 192f4e0c4..7a419c433 100644 --- a/packages/mermaid-zenuml/package.json +++ b/packages/mermaid-zenuml/package.json @@ -33,7 +33,7 @@ ], "license": "MIT", "dependencies": { - "@zenuml/core": "^3.23.27" + "@zenuml/core": "^3.23.28" }, "devDependencies": { "mermaid": "workspace:^" diff --git a/packages/mermaid/CHANGELOG.md b/packages/mermaid/CHANGELOG.md index 221d7c735..0c8f66aca 100644 --- a/packages/mermaid/CHANGELOG.md +++ b/packages/mermaid/CHANGELOG.md @@ -1,5 +1,68 @@ # mermaid +## 11.6.0 + +### Minor Changes + +- [#6408](https://github.com/mermaid-js/mermaid/pull/6408) [`ad65313`](https://github.com/mermaid-js/mermaid/commit/ad653138e16765d095613a6e5de86dc5e52ac8f0) Thanks [@ashishjain0512](https://github.com/ashishjain0512)! - fix: restore curve type configuration functionality for flowcharts. This fixes the issue where curve type settings were not being applied when configured through any of the following methods: + + - Config + - Init directive (%%{ init: { 'flowchart': { 'curve': '...' } } }%%) + - LinkStyle command (linkStyle default interpolate ...) + +- [#6381](https://github.com/mermaid-js/mermaid/pull/6381) [`95d73bc`](https://github.com/mermaid-js/mermaid/commit/95d73bc3f064dbf261a06483f94a7ef4d0bb52eb) Thanks [@thomascizeron](https://github.com/thomascizeron)! - Add Radar Chart + +### Patch Changes + +- [#2](https://github.com/calvinvette/mermaid/pull/2) [`16d9b63`](https://github.com/mermaid-js/mermaid/commit/16d9b6345749ab5f24d5b8433efc3635d4913863) Thanks [@calvinvette](https://github.com/calvinvette)! - - [#6388](https://github.com/mermaid-js/mermaid/pull/6386) + Thanks [@bollwyvl](https://github.com/bollwyvl) - Fix requirement diagram containment arrow +- Updated dependencies [[`95d73bc`](https://github.com/mermaid-js/mermaid/commit/95d73bc3f064dbf261a06483f94a7ef4d0bb52eb)]: + - @mermaid-js/parser@0.4.0 + +## 11.5.0 + +### Minor Changes + +- [#6187](https://github.com/mermaid-js/mermaid/pull/6187) [`7809b5a`](https://github.com/mermaid-js/mermaid/commit/7809b5a93fae127f45727071f5ff14325222c518) Thanks [@ashishjain0512](https://github.com/ashishjain0512)! - Flowchart new syntax for node metadata bugs + + - Incorrect label mapping for nodes when using `&` + - Syntax error when `}` with trailing spaces before new line + +- [#6136](https://github.com/mermaid-js/mermaid/pull/6136) [`ec0d9c3`](https://github.com/mermaid-js/mermaid/commit/ec0d9c389aa6018043187654044c1e0b5aa4f600) Thanks [@knsv](https://github.com/knsv)! - Adding support for animation of flowchart edges + +- [#6373](https://github.com/mermaid-js/mermaid/pull/6373) [`05bdf0e`](https://github.com/mermaid-js/mermaid/commit/05bdf0e20e2629fe77513218fbd4e28e65f75882) Thanks [@ashishjain0512](https://github.com/ashishjain0512)! - Upgrade Requirement and ER diagram to use the common renderer flow + + - Added support for directions + - Added support for hand drawn look + +- [#6371](https://github.com/mermaid-js/mermaid/pull/6371) [`4d25cab`](https://github.com/mermaid-js/mermaid/commit/4d25caba8e65df078966a283e7e0ae1200bef595) Thanks [@knsv](https://github.com/knsv)! - The arrowhead color should match the color of the edge. Creates a unique clone of the arrow marker with the appropriate color. + +### Patch Changes + +- [#6064](https://github.com/mermaid-js/mermaid/pull/6064) [`2a91849`](https://github.com/mermaid-js/mermaid/commit/2a91849a38641e97ed6b20cb60aa4506d1b63177) Thanks [@NicolasNewman](https://github.com/NicolasNewman)! - fix: architecture diagrams no longer grow to extreme heights due to conflicting alignments + +- [#6198](https://github.com/mermaid-js/mermaid/pull/6198) [`963efa6`](https://github.com/mermaid-js/mermaid/commit/963efa64c794466dcd0f06bad6de6ba554d05a54) Thanks [@ferozmht](https://github.com/ferozmht)! - Fixes for consistent edge id creation & handling edge cases for animate edge feature + +- [#6196](https://github.com/mermaid-js/mermaid/pull/6196) [`127bac1`](https://github.com/mermaid-js/mermaid/commit/127bac1147034d8a8588cc8f7870abe92ebc945e) Thanks [@knsv](https://github.com/knsv)! - Fix for issue #6195 - allowing @ signs inside node labels + +- [#6212](https://github.com/mermaid-js/mermaid/pull/6212) [`90bbf90`](https://github.com/mermaid-js/mermaid/commit/90bbf90a83bf5da53fc8030cf1370bc8238fa4aa) Thanks [@saurabhg772244](https://github.com/saurabhg772244)! - fix: `mermaidAPI.getDiagramFromText()` now returns a new different db for each class diagram + +- [#6218](https://github.com/mermaid-js/mermaid/pull/6218) [`232e60c`](https://github.com/mermaid-js/mermaid/commit/232e60c8cbaea804e6d98aa90f90d1ce76730e17) Thanks [@saurabhg772244](https://github.com/saurabhg772244)! - fix: revert state db to resolve getData returning empty nodes and edges + +- [#6250](https://github.com/mermaid-js/mermaid/pull/6250) [`9cad3c7`](https://github.com/mermaid-js/mermaid/commit/9cad3c7aea3bbbc61495b23225ccff76d312783f) Thanks [@saurabhg772244](https://github.com/saurabhg772244)! - `mermaidAPI.getDiagramFromText()` now returns a new db instance on each call for state diagrams + +- [#6293](https://github.com/mermaid-js/mermaid/pull/6293) [`cfd84e5`](https://github.com/mermaid-js/mermaid/commit/cfd84e54d502f4d36a35b50478121558cfbef2c4) Thanks [@saurabhg772244](https://github.com/saurabhg772244)! - Added versioning to StateDB and updated tests and diagrams to use it. + +- [#6161](https://github.com/mermaid-js/mermaid/pull/6161) [`6cc31b7`](https://github.com/mermaid-js/mermaid/commit/6cc31b74530baa6d0f527346ab1395b0896bb3c2) Thanks [@saurabhg772244](https://github.com/saurabhg772244)! - fix: `mermaidAPI.getDiagramFromText()` now returns a new different db for each flowchart + +- [#6272](https://github.com/mermaid-js/mermaid/pull/6272) [`ffa7804`](https://github.com/mermaid-js/mermaid/commit/ffa7804af0701b3d044d6794e36bd9132d6c7e8d) Thanks [@saurabhg772244](https://github.com/saurabhg772244)! - fix: `mermaidAPI.getDiagramFromText()` now returns a new different db for each sequence diagram. Added unique IDs for messages. + +- [#6205](https://github.com/mermaid-js/mermaid/pull/6205) [`32a68d4`](https://github.com/mermaid-js/mermaid/commit/32a68d489ed83a5b79f516d6b2fb3a7505c5eb24) Thanks [@saurabhg772244](https://github.com/saurabhg772244)! - fix: Gantt, Sankey and User Journey diagram are now able to pick font-family from mermaid config. + +- [#6295](https://github.com/mermaid-js/mermaid/pull/6295) [`da6361f`](https://github.com/mermaid-js/mermaid/commit/da6361f6527918b4b6a9c07cc9558cf2e2c709d2) Thanks [@omkarht](https://github.com/omkarht)! - fix: `getDirection` and `setDirection` in `stateDb` refactored to return and set actual direction + +- [#6185](https://github.com/mermaid-js/mermaid/pull/6185) [`3e32332`](https://github.com/mermaid-js/mermaid/commit/3e32332814c659e7ed1bb73d4a26ed4e61b77d59) Thanks [@saurabhg772244](https://github.com/saurabhg772244)! - `mermaidAPI.getDiagramFromText()` now returns a new different db for each state diagram + ## 11.4.1 ### Patch Changes diff --git a/packages/mermaid/package.json b/packages/mermaid/package.json index 71abdfdb4..7f8230229 100644 --- a/packages/mermaid/package.json +++ b/packages/mermaid/package.json @@ -1,6 +1,6 @@ { "name": "mermaid", - "version": "11.4.1", + "version": "11.6.0", "description": "Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.", "type": "module", "module": "./dist/mermaid.core.mjs", @@ -67,68 +67,67 @@ ] }, "dependencies": { - "@braintree/sanitize-url": "^7.0.1", - "@iconify/utils": "^2.1.32", + "@braintree/sanitize-url": "^7.0.4", + "@iconify/utils": "^2.1.33", "@mermaid-js/parser": "workspace:^", "@types/d3": "^7.4.3", - "cytoscape": "^3.29.2", + "cytoscape": "^3.29.3", "cytoscape-cose-bilkent": "^4.1.0", "cytoscape-fcose": "^2.2.0", "d3": "^7.9.0", "d3-sankey": "^0.12.3", "dagre-d3-es": "7.0.11", - "dayjs": "^1.11.10", - "dompurify": "^3.2.1", + "dayjs": "^1.11.13", + "dompurify": "^3.2.5", "katex": "^0.16.9", "khroma": "^2.1.0", "lodash-es": "^4.17.21", - "marked": "^13.0.2", + "marked": "^15.0.7", "roughjs": "^4.6.6", - "stylis": "^4.3.1", + "stylis": "^4.3.6", "ts-dedent": "^2.2.0", - "uuid": "^9.0.1" + "uuid": "^11.1.0" }, "devDependencies": { - "@adobe/jsonschema2md": "^8.0.0", + "@adobe/jsonschema2md": "^8.0.2", "@iconify/types": "^2.0.0", - "@types/cytoscape": "^3.21.4", + "@types/cytoscape": "^3.21.9", "@types/cytoscape-fcose": "^2.2.4", "@types/d3-sankey": "^0.12.4", - "@types/d3-scale": "^4.0.8", - "@types/d3-scale-chromatic": "^3.0.3", - "@types/d3-selection": "^3.0.10", - "@types/d3-shape": "^3.1.6", - "@types/jsdom": "^21.1.6", + "@types/d3-scale": "^4.0.9", + "@types/d3-scale-chromatic": "^3.1.0", + "@types/d3-selection": "^3.0.11", + "@types/d3-shape": "^3.1.7", + "@types/jsdom": "^21.1.7", "@types/katex": "^0.16.7", "@types/lodash-es": "^4.17.12", - "@types/micromatch": "^4.0.6", - "@types/prettier": "^3.0.0", - "@types/stylis": "^4.2.5", - "@types/uuid": "^9.0.8", - "ajv": "^8.12.0", - "chokidar": "^3.6.0", - "concurrently": "^8.2.2", - "csstree-validator": "^3.0.0", - "globby": "^14.0.1", + "@types/micromatch": "^4.0.9", + "@types/stylis": "^4.2.7", + "@types/uuid": "^10.0.0", + "ajv": "^8.17.1", + "chokidar": "^4.0.3", + "concurrently": "^9.1.2", + "csstree-validator": "^4.0.1", + "globby": "^14.0.2", "jison": "^0.4.18", "js-base64": "^3.7.7", - "jsdom": "^24.0.0", - "json-schema-to-typescript": "^13.1.2", - "micromatch": "^4.0.5", + "jsdom": "^26.0.0", + "json-schema-to-typescript": "^15.0.4", + "micromatch": "^4.0.8", "path-browserify": "^1.0.1", - "prettier": "^3.2.5", + "prettier": "^3.5.2", "remark": "^15.0.1", "remark-frontmatter": "^5.0.0", - "remark-gfm": "^4.0.0", - "rimraf": "^5.0.5", - "start-server-and-test": "^2.0.3", - "type-fest": "^4.13.1", - "typedoc": "^0.25.12", - "typedoc-plugin-markdown": "^3.17.1", - "typescript": "~5.4.3", + "remark-gfm": "^4.0.1", + "rimraf": "^6.0.1", + "start-server-and-test": "^2.0.10", + "type-fest": "^4.35.0", + "typedoc": "^0.27.8", + "typedoc-plugin-markdown": "^4.4.2", + "typescript": "~5.7.3", "unist-util-flatmap": "^1.0.0", "unist-util-visit": "^5.0.0", - "vitepress": "^1.0.1", + "vitepress": "^1.0.2", "vitepress-plugin-search": "1.0.4-alpha.22" }, "files": [ diff --git a/packages/mermaid/src/config.type.ts b/packages/mermaid/src/config.type.ts index 86281cd52..5c34ff462 100644 --- a/packages/mermaid/src/config.type.ts +++ b/packages/mermaid/src/config.type.ts @@ -199,6 +199,7 @@ export interface MermaidConfig { sankey?: SankeyDiagramConfig; packet?: PacketDiagramConfig; block?: BlockDiagramConfig; + radar?: RadarDiagramConfig; dompurifyConfig?: DOMPurifyConfiguration; wrap?: boolean; fontSize?: number; @@ -261,7 +262,19 @@ export interface FlowchartDiagramConfig extends BaseDiagramConfig { * Defines how mermaid renders curves for flowcharts. * */ - curve?: 'basis' | 'linear' | 'cardinal'; + curve?: + | 'basis' + | 'bumpX' + | 'bumpY' + | 'cardinal' + | 'catmullRom' + | 'linear' + | 'monotoneX' + | 'monotoneY' + | 'natural' + | 'step' + | 'stepAfter' + | 'stepBefore'; /** * Represents the padding between the labels and the shape * @@ -546,6 +559,10 @@ export interface JourneyDiagramConfig extends BaseDiagramConfig { * Margin between actors */ leftMargin?: number; + /** + * Maximum width of actor labels + */ + maxLabelWidth?: number; /** * Width of actor boxes */ @@ -795,6 +812,8 @@ export interface ErDiagramConfig extends BaseDiagramConfig { * */ entityPadding?: number; + nodeSpacing?: number; + rankSpacing?: number; /** * Stroke color of box edges and lines. */ @@ -1524,6 +1543,50 @@ export interface PacketDiagramConfig extends BaseDiagramConfig { export interface BlockDiagramConfig extends BaseDiagramConfig { padding?: number; } +/** + * The object containing configurations specific for radar diagrams. + * + * This interface was referenced by `MermaidConfig`'s JSON-Schema + * via the `definition` "RadarDiagramConfig". + */ +export interface RadarDiagramConfig extends BaseDiagramConfig { + /** + * The size of the radar diagram. + */ + width?: number; + /** + * The size of the radar diagram. + */ + height?: number; + /** + * The margin from the top of the radar diagram. + */ + marginTop?: number; + /** + * The margin from the right of the radar diagram. + */ + marginRight?: number; + /** + * The margin from the bottom of the radar diagram. + */ + marginBottom?: number; + /** + * The margin from the left of the radar diagram. + */ + marginLeft?: number; + /** + * The scale factor of the axis. + */ + axisScaleFactor?: number; + /** + * The scale factor of the axis label. + */ + axisLabelFactor?: number; + /** + * The tension factor for the Catmull-Rom spline conversion to cubic Bรฉzier curves. + */ + curveTension?: number; +} /** * This interface was referenced by `MermaidConfig`'s JSON-Schema * via the `definition` "FontConfig". diff --git a/packages/mermaid/src/defaultConfig.ts b/packages/mermaid/src/defaultConfig.ts index a3dab2ddb..2e4e20f50 100644 --- a/packages/mermaid/src/defaultConfig.ts +++ b/packages/mermaid/src/defaultConfig.ts @@ -255,8 +255,12 @@ const config: RequiredDeep = { packet: { ...defaultConfigJson.packet, }, + radar: { + ...defaultConfigJson.radar, + }, }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any const keyify = (obj: any, prefix = ''): string[] => Object.keys(obj).reduce((res: string[], el): string[] => { if (Array.isArray(obj[el])) { diff --git a/packages/mermaid/src/diagram-api/diagram-orchestration.ts b/packages/mermaid/src/diagram-api/diagram-orchestration.ts index 5b8cfc3fe..8f2b76abb 100644 --- a/packages/mermaid/src/diagram-api/diagram-orchestration.ts +++ b/packages/mermaid/src/diagram-api/diagram-orchestration.ts @@ -22,6 +22,7 @@ import mindmap from '../diagrams/mindmap/detector.js'; import kanban from '../diagrams/kanban/detector.js'; import sankey from '../diagrams/sankey/sankeyDetector.js'; import { packet } from '../diagrams/packet/detector.js'; +import { radar } from '../diagrams/radar/detector.js'; import block from '../diagrams/block/blockDetector.js'; import architecture from '../diagrams/architecture/architectureDetector.js'; import { registerLazyLoadedDiagrams } from './detectType.js'; @@ -94,6 +95,7 @@ export const addDiagrams = () => { packet, xychart, block, - architecture + architecture, + radar ); }; diff --git a/packages/mermaid/src/diagrams/architecture/architecture.spec.ts b/packages/mermaid/src/diagrams/architecture/architecture.spec.ts new file mode 100644 index 000000000..45c19e23e --- /dev/null +++ b/packages/mermaid/src/diagrams/architecture/architecture.spec.ts @@ -0,0 +1,70 @@ +import { it, describe, expect } from 'vitest'; +import { db } from './architectureDb.js'; +import { parser } from './architectureParser.js'; + +const { + clear, + getDiagramTitle, + getAccTitle, + getAccDescription, + getServices, + getGroups, + getEdges, + getJunctions, +} = db; + +describe('architecture diagrams', () => { + beforeEach(() => { + clear(); + }); + + describe('architecture diagram definitions', () => { + it('should handle the architecture keyword', async () => { + const str = `architecture-beta`; + await expect(parser.parse(str)).resolves.not.toThrow(); + }); + + it('should handle an simple radar definition', async () => { + const str = `architecture-beta + service db + `; + await expect(parser.parse(str)).resolves.not.toThrow(); + }); + }); + + describe('should handle TitleAndAccessibilities', () => { + it('should handle title on the first line', async () => { + const str = `architecture-beta title Simple Architecture Diagram`; + await expect(parser.parse(str)).resolves.not.toThrow(); + expect(getDiagramTitle()).toBe('Simple Architecture Diagram'); + }); + + it('should handle title on another line', async () => { + const str = `architecture-beta + title Simple Architecture Diagram + `; + await expect(parser.parse(str)).resolves.not.toThrow(); + expect(getDiagramTitle()).toBe('Simple Architecture Diagram'); + }); + + it('should handle accessibility title and description', async () => { + const str = `architecture-beta + accTitle: Accessibility Title + accDescr: Accessibility Description + `; + await expect(parser.parse(str)).resolves.not.toThrow(); + expect(getAccTitle()).toBe('Accessibility Title'); + expect(getAccDescription()).toBe('Accessibility Description'); + }); + + it('should handle multiline accessibility description', async () => { + const str = `architecture-beta + accDescr { + Accessibility Description + } + `; + await expect(parser.parse(str)).resolves.not.toThrow(); + expect(getAccDescription()).toBe('Accessibility Description'); + }); + }); +}); diff --git a/packages/mermaid/src/diagrams/architecture/architectureDb.ts b/packages/mermaid/src/diagrams/architecture/architectureDb.ts index 2174ebe19..c7bd64e21 100644 --- a/packages/mermaid/src/diagrams/architecture/architectureDb.ts +++ b/packages/mermaid/src/diagrams/architecture/architectureDb.ts @@ -1,6 +1,6 @@ import type { ArchitectureDiagramConfig } from '../../config.type.js'; import DEFAULT_CONFIG from '../../defaultConfig.js'; -import { getConfig } from '../../diagram-api/diagramAPI.js'; +import { getConfig as commonGetConfig } from '../../config.js'; import type { D3Element } from '../../types.js'; import { ImperativeState } from '../../utils/imperativeState.js'; import { @@ -33,6 +33,7 @@ import { isArchitectureService, shiftPositionByArchitectureDirectionPair, } from './architectureTypes.js'; +import { cleanAndMerge } from '../../utils.js'; const DEFAULT_ARCHITECTURE_CONFIG: Required = DEFAULT_CONFIG.architecture; @@ -316,6 +317,14 @@ const setElementForId = (id: string, element: D3Element) => { }; const getElementById = (id: string) => state.records.elements[id]; +const getConfig = (): Required => { + const config = cleanAndMerge({ + ...DEFAULT_ARCHITECTURE_CONFIG, + ...commonGetConfig().architecture, + }); + return config; +}; + export const db: ArchitectureDB = { clear, setDiagramTitle, @@ -324,6 +333,7 @@ export const db: ArchitectureDB = { getAccTitle, setAccDescription, getAccDescription, + getConfig, addService, getServices, @@ -348,9 +358,5 @@ export const db: ArchitectureDB = { export function getConfigField( field: T ): Required[T] { - const arch = getConfig().architecture; - if (arch?.[field]) { - return arch[field] as Required[T]; - } - return DEFAULT_ARCHITECTURE_CONFIG[field]; + return getConfig()[field]; } diff --git a/packages/mermaid/src/diagrams/architecture/architectureRenderer.ts b/packages/mermaid/src/diagrams/architecture/architectureRenderer.ts index 768c174b0..9479e5108 100644 --- a/packages/mermaid/src/diagrams/architecture/architectureRenderer.ts +++ b/packages/mermaid/src/diagrams/architecture/architectureRenderer.ts @@ -500,6 +500,8 @@ function layoutArchitecture( } export const draw: DrawDefinition = async (text, id, _version, diagObj: Diagram) => { + // TODO: Add title support for architecture diagrams + const db = diagObj.db as ArchitectureDB; const services = db.getServices(); diff --git a/packages/mermaid/src/diagrams/architecture/architectureTypes.ts b/packages/mermaid/src/diagrams/architecture/architectureTypes.ts index a7af33ca7..c61df11ff 100644 --- a/packages/mermaid/src/diagrams/architecture/architectureTypes.ts +++ b/packages/mermaid/src/diagrams/architecture/architectureTypes.ts @@ -1,4 +1,4 @@ -import type { DiagramDB } from '../../diagram-api/types.js'; +import type { DiagramDBBase } from '../../diagram-api/types.js'; import type { ArchitectureDiagramConfig } from '../../config.type.js'; import type { D3Element } from '../../types.js'; import type cytoscape from 'cytoscape'; @@ -242,7 +242,7 @@ export interface ArchitectureEdge
    { title?: string; } -export interface ArchitectureDB extends DiagramDB { +export interface ArchitectureDB extends DiagramDBBase { clear: () => void; addService: (service: Omit) => void; getServices: () => ArchitectureService[]; diff --git a/packages/mermaid/src/diagrams/er/erDb.js b/packages/mermaid/src/diagrams/er/erDb.js deleted file mode 100644 index f24f48198..000000000 --- a/packages/mermaid/src/diagrams/er/erDb.js +++ /dev/null @@ -1,103 +0,0 @@ -import { log } from '../../logger.js'; -import { getConfig } from '../../diagram-api/diagramAPI.js'; - -import { - setAccTitle, - getAccTitle, - getAccDescription, - setAccDescription, - clear as commonClear, - setDiagramTitle, - getDiagramTitle, -} from '../common/commonDb.js'; - -let entities = new Map(); -let relationships = []; - -const Cardinality = { - ZERO_OR_ONE: 'ZERO_OR_ONE', - ZERO_OR_MORE: 'ZERO_OR_MORE', - ONE_OR_MORE: 'ONE_OR_MORE', - ONLY_ONE: 'ONLY_ONE', - MD_PARENT: 'MD_PARENT', -}; - -const Identification = { - NON_IDENTIFYING: 'NON_IDENTIFYING', - IDENTIFYING: 'IDENTIFYING', -}; -/** - * Add entity - * @param {string} name - The name of the entity - * @param {string | undefined} alias - The alias of the entity - */ -const addEntity = function (name, alias = undefined) { - if (!entities.has(name)) { - entities.set(name, { attributes: [], alias }); - log.info('Added new entity :', name); - } else if (!entities.get(name).alias && alias) { - entities.get(name).alias = alias; - log.info(`Add alias '${alias}' to entity '${name}'`); - } - - return entities.get(name); -}; - -const getEntities = () => entities; - -const addAttributes = function (entityName, attribs) { - let entity = addEntity(entityName); // May do nothing (if entity has already been added) - - // Process attribs in reverse order due to effect of recursive construction (last attribute is first) - let i; - for (i = attribs.length - 1; i >= 0; i--) { - entity.attributes.push(attribs[i]); - log.debug('Added attribute ', attribs[i].attributeName); - } -}; - -/** - * Add a relationship - * - * @param entA The first entity in the relationship - * @param rolA The role played by the first entity in relation to the second - * @param entB The second entity in the relationship - * @param rSpec The details of the relationship between the two entities - */ -const addRelationship = function (entA, rolA, entB, rSpec) { - let rel = { - entityA: entA, - roleA: rolA, - entityB: entB, - relSpec: rSpec, - }; - - relationships.push(rel); - log.debug('Added new relationship :', rel); -}; - -const getRelationships = () => relationships; - -const clear = function () { - entities = new Map(); - relationships = []; - commonClear(); -}; - -export default { - Cardinality, - Identification, - getConfig: () => getConfig().er, - addEntity, - addAttributes, - getEntities, - addRelationship, - getRelationships, - clear, - setAccTitle, - getAccTitle, - setAccDescription, - getAccDescription, - setDiagramTitle, - getDiagramTitle, -}; diff --git a/packages/mermaid/src/diagrams/er/erDb.ts b/packages/mermaid/src/diagrams/er/erDb.ts new file mode 100644 index 000000000..95f2210b7 --- /dev/null +++ b/packages/mermaid/src/diagrams/er/erDb.ts @@ -0,0 +1,251 @@ +import { log } from '../../logger.js'; +import { getConfig } from '../../diagram-api/diagramAPI.js'; +import type { Edge, Node } from '../../rendering-util/types.js'; +import type { EntityNode, Attribute, Relationship, EntityClass, RelSpec } from './erTypes.js'; +import { + setAccTitle, + getAccTitle, + getAccDescription, + setAccDescription, + clear as commonClear, + setDiagramTitle, + getDiagramTitle, +} from '../common/commonDb.js'; +import { getEdgeId } from '../../utils.js'; +import type { DiagramDB } from '../../diagram-api/types.js'; + +export class ErDB implements DiagramDB { + private entities = new Map(); + private relationships: Relationship[] = []; + private classes = new Map(); + private direction = 'TB'; + + private Cardinality = { + ZERO_OR_ONE: 'ZERO_OR_ONE', + ZERO_OR_MORE: 'ZERO_OR_MORE', + ONE_OR_MORE: 'ONE_OR_MORE', + ONLY_ONE: 'ONLY_ONE', + MD_PARENT: 'MD_PARENT', + }; + + private Identification = { + NON_IDENTIFYING: 'NON_IDENTIFYING', + IDENTIFYING: 'IDENTIFYING', + }; + + constructor() { + this.clear(); + this.addEntity = this.addEntity.bind(this); + this.addAttributes = this.addAttributes.bind(this); + this.addRelationship = this.addRelationship.bind(this); + this.setDirection = this.setDirection.bind(this); + this.addCssStyles = this.addCssStyles.bind(this); + this.addClass = this.addClass.bind(this); + this.setClass = this.setClass.bind(this); + this.setAccTitle = this.setAccTitle.bind(this); + this.setAccDescription = this.setAccDescription.bind(this); + } + + /** + * Add entity + * @param name - The name of the entity + * @param alias - The alias of the entity + */ + public addEntity(name: string, alias = ''): EntityNode { + if (!this.entities.has(name)) { + this.entities.set(name, { + id: `entity-${name}-${this.entities.size}`, + label: name, + attributes: [], + alias, + shape: 'erBox', + look: getConfig().look ?? 'default', + cssClasses: 'default', + cssStyles: [], + }); + log.info('Added new entity :', name); + } else if (!this.entities.get(name)?.alias && alias) { + this.entities.get(name)!.alias = alias; + log.info(`Add alias '${alias}' to entity '${name}'`); + } + + return this.entities.get(name)!; + } + + public getEntity(name: string) { + return this.entities.get(name); + } + + public getEntities() { + return this.entities; + } + + public getClasses() { + return this.classes; + } + + public addAttributes(entityName: string, attribs: Attribute[]) { + const entity = this.addEntity(entityName); // May do nothing (if entity has already been added) + + // Process attribs in reverse order due to effect of recursive construction (last attribute is first) + let i; + for (i = attribs.length - 1; i >= 0; i--) { + if (!attribs[i].keys) { + attribs[i].keys = []; + } + if (!attribs[i].comment) { + attribs[i].comment = ''; + } + entity.attributes.push(attribs[i]); + log.debug('Added attribute ', attribs[i].name); + } + } + + /** + * Add a relationship + * + * @param entA - The first entity in the relationship + * @param rolA - The role played by the first entity in relation to the second + * @param entB - The second entity in the relationship + * @param rSpec - The details of the relationship between the two entities + */ + public addRelationship(entA: string, rolA: string, entB: string, rSpec: RelSpec) { + const entityA = this.entities.get(entA); + const entityB = this.entities.get(entB); + if (!entityA || !entityB) { + return; + } + + const rel = { + entityA: entityA.id, + roleA: rolA, + entityB: entityB.id, + relSpec: rSpec, + }; + + this.relationships.push(rel); + log.debug('Added new relationship :', rel); + } + + public getRelationships() { + return this.relationships; + } + + public getDirection() { + return this.direction; + } + + public setDirection(dir: string) { + this.direction = dir; + } + + private getCompiledStyles(classDefs: string[]) { + let compiledStyles: string[] = []; + for (const customClass of classDefs) { + const cssClass = this.classes.get(customClass); + if (cssClass?.styles) { + compiledStyles = [...compiledStyles, ...(cssClass.styles ?? [])].map((s) => s.trim()); + } + if (cssClass?.textStyles) { + compiledStyles = [...compiledStyles, ...(cssClass.textStyles ?? [])].map((s) => s.trim()); + } + } + return compiledStyles; + } + + public addCssStyles(ids: string[], styles: string[]) { + for (const id of ids) { + const entity = this.entities.get(id); + if (!styles || !entity) { + return; + } + for (const style of styles) { + entity.cssStyles!.push(style); + } + } + } + + public addClass(ids: string[], style: string[]) { + ids.forEach((id) => { + let classNode = this.classes.get(id); + if (classNode === undefined) { + classNode = { id, styles: [], textStyles: [] }; + this.classes.set(id, classNode); + } + + if (style) { + style.forEach(function (s) { + if (/color/.exec(s)) { + const newStyle = s.replace('fill', 'bgFill'); + classNode.textStyles.push(newStyle); + } + classNode.styles.push(s); + }); + } + }); + } + + public setClass(ids: string[], classNames: string[]) { + for (const id of ids) { + const entity = this.entities.get(id); + if (entity) { + for (const className of classNames) { + entity.cssClasses += ' ' + className; + } + } + } + } + + public clear() { + this.entities = new Map(); + this.classes = new Map(); + this.relationships = []; + commonClear(); + } + + public getData() { + const nodes: Node[] = []; + const edges: Edge[] = []; + const config = getConfig(); + + for (const entityKey of this.entities.keys()) { + const entityNode = this.entities.get(entityKey); + if (entityNode) { + entityNode.cssCompiledStyles = this.getCompiledStyles(entityNode.cssClasses!.split(' ')); + nodes.push(entityNode as unknown as Node); + } + } + + let count = 0; + for (const relationship of this.relationships) { + const edge: Edge = { + id: getEdgeId(relationship.entityA, relationship.entityB, { + prefix: 'id', + counter: count++, + }), + type: 'normal', + curve: 'basis', + start: relationship.entityA, + end: relationship.entityB, + label: relationship.roleA, + labelpos: 'c', + thickness: 'normal', + classes: 'relationshipLine', + arrowTypeStart: relationship.relSpec.cardB.toLowerCase(), + arrowTypeEnd: relationship.relSpec.cardA.toLowerCase(), + pattern: relationship.relSpec.relType == 'IDENTIFYING' ? 'solid' : 'dashed', + look: config.look, + }; + edges.push(edge); + } + return { nodes, edges, other: {}, config, direction: 'TB' }; + } + + public setAccTitle = setAccTitle; + public getAccTitle = getAccTitle; + public setAccDescription = setAccDescription; + public getAccDescription = getAccDescription; + public setDiagramTitle = setDiagramTitle; + public getDiagramTitle = getDiagramTitle; + public getConfig = () => getConfig().er; +} diff --git a/packages/mermaid/src/diagrams/er/erDiagram.ts b/packages/mermaid/src/diagrams/er/erDiagram.ts index adfa525fc..1e3f0a4e1 100644 --- a/packages/mermaid/src/diagrams/er/erDiagram.ts +++ b/packages/mermaid/src/diagrams/er/erDiagram.ts @@ -1,12 +1,14 @@ // @ts-ignore: TODO: Fix ts errors import erParser from './parser/erDiagram.jison'; -import erDb from './erDb.js'; -import erRenderer from './erRenderer.js'; +import { ErDB } from './erDb.js'; +import * as renderer from './erRenderer-unified.js'; import erStyles from './styles.js'; export const diagram = { parser: erParser, - db: erDb, - renderer: erRenderer, + get db() { + return new ErDB(); + }, + renderer, styles: erStyles, }; diff --git a/packages/mermaid/src/diagrams/er/erRenderer-unified.ts b/packages/mermaid/src/diagrams/er/erRenderer-unified.ts new file mode 100644 index 000000000..9735dd3bb --- /dev/null +++ b/packages/mermaid/src/diagrams/er/erRenderer-unified.ts @@ -0,0 +1,66 @@ +import { getConfig } from '../../diagram-api/diagramAPI.js'; +import { log } from '../../logger.js'; +import { getDiagramElement } from '../../rendering-util/insertElementsForSize.js'; +import { getRegisteredLayoutAlgorithm, render } from '../../rendering-util/render.js'; +import { setupViewPortForSVG } from '../../rendering-util/setupViewPortForSVG.js'; +import type { LayoutData } from '../../rendering-util/types.js'; +import utils from '../../utils.js'; +import { select } from 'd3'; + +export const draw = async function (text: string, id: string, _version: string, diag: any) { + log.info('REF0:'); + log.info('Drawing er diagram (unified)', id); + const { securityLevel, er: conf, layout } = getConfig(); + + // The getData method provided in all supported diagrams is used to extract the data from the parsed structure + // into the Layout data format + const data4Layout = diag.db.getData() as LayoutData; + + // Create the root SVG - the element is the div containing the SVG element + const svg = getDiagramElement(id, securityLevel); + + data4Layout.type = diag.type; + data4Layout.layoutAlgorithm = getRegisteredLayoutAlgorithm(layout); + + // Workaround as when rendering and setting up the graph it uses flowchart spacing before data4Layout spacing? + data4Layout.config.flowchart!.nodeSpacing = conf?.nodeSpacing || 140; + data4Layout.config.flowchart!.rankSpacing = conf?.rankSpacing || 80; + data4Layout.direction = diag.db.getDirection(); + + data4Layout.markers = ['only_one', 'zero_or_one', 'one_or_more', 'zero_or_more']; + data4Layout.diagramId = id; + await render(data4Layout, svg); + // Elk layout algorithm displays markers above nodes, so move edges to top so they are "painted" over by the nodes. + if (data4Layout.layoutAlgorithm === 'elk') { + svg.select('.edges').lower(); + } + + // Sets the background nodes to the same position as their original counterparts. + // Background nodes are created when the look is handDrawn so the ER diagram markers do not show underneath. + const backgroundNodes = svg.selectAll('[id*="-background"]'); + // eslint-disable-next-line unicorn/prefer-spread + if (Array.from(backgroundNodes).length > 0) { + backgroundNodes.each(function (this: SVGElement) { + const backgroundNode = select(this); + const backgroundId = backgroundNode.attr('id'); + + const nonBackgroundId = backgroundId.replace('-background', ''); + const nonBackgroundNode = svg.select(`#${CSS.escape(nonBackgroundId)}`); + + if (!nonBackgroundNode.empty()) { + const transform = nonBackgroundNode.attr('transform'); + backgroundNode.attr('transform', transform); + } + }); + } + + const padding = 8; + utils.insertTitle( + svg, + 'erDiagramTitleText', + conf?.titleTopMargin ?? 25, + diag.db.getDiagramTitle() + ); + + setupViewPortForSVG(svg, padding, 'erDiagram', conf?.useMaxWidth ?? true); +}; diff --git a/packages/mermaid/src/diagrams/er/erTypes.ts b/packages/mermaid/src/diagrams/er/erTypes.ts new file mode 100644 index 000000000..13f9b2669 --- /dev/null +++ b/packages/mermaid/src/diagrams/er/erTypes.ts @@ -0,0 +1,37 @@ +export interface EntityNode { + id: string; + label: string; + attributes: Attribute[]; + alias: string; + shape: string; + look?: string; + cssClasses?: string; + cssStyles?: string[]; + cssCompiledStyles?: string[]; +} + +export interface Attribute { + type: string; + name: string; + keys: ('PK' | 'FK' | 'UK')[]; + comment: string; +} + +export interface Relationship { + entityA: string; + roleA: string; + entityB: string; + relSpec: RelSpec; +} + +export interface RelSpec { + cardA: string; + cardB: string; + relType: string; +} + +export interface EntityClass { + id: string; + styles: string[]; + textStyles: string[]; +} diff --git a/packages/mermaid/src/diagrams/er/parser/erDiagram.jison b/packages/mermaid/src/diagrams/er/parser/erDiagram.jison index 135efc784..2b59309fb 100644 --- a/packages/mermaid/src/diagrams/er/parser/erDiagram.jison +++ b/packages/mermaid/src/diagrams/er/parser/erDiagram.jison @@ -5,6 +5,7 @@ %x acc_title %x acc_descr %x acc_descr_multiline +%x style %% accTitle\s*":"\s* { this.begin("acc_title");return 'acc_title'; } @@ -14,6 +15,10 @@ accDescr\s*":"\s* { this.begin("ac accDescr\s*"{"\s* { this.begin("acc_descr_multiline");} [\}] { this.popState(); } [^\}]* return "acc_descr_multiline_value"; +.*direction\s+TB[^\n]* return 'direction_tb'; +.*direction\s+BT[^\n]* return 'direction_bt'; +.*direction\s+RL[^\n]* return 'direction_rl'; +.*direction\s+LR[^\n]* return 'direction_lr'; [\n]+ return 'NEWLINE'; \s+ /* skip whitespace */ [\s]+ return 'SPACE'; @@ -21,11 +26,15 @@ accDescr\s*"{"\s* { this.begin("acc_descr_multili \"[^"]*\" return 'WORD'; "erDiagram" return 'ER_DIAGRAM'; "{" { this.begin("block"); return 'BLOCK_START'; } -"," return 'COMMA'; +\# return 'BRKT'; +"#" return 'BRKT'; +"," return 'COMMA'; +":::" return 'STYLE_SEPARATOR'; +":" return 'COLON'; \s+ /* skip whitespace in block */ \b((?:PK)|(?:FK)|(?:UK))\b return 'ATTRIBUTE_KEY' -(.*?)[~](.*?)*[~] return 'ATTRIBUTE_WORD'; -[\*A-Za-z_][A-Za-z0-9\-_\[\]\(\)]* return 'ATTRIBUTE_WORD' +([^\s]*)[~].*[~]([^\s]*) return 'ATTRIBUTE_WORD'; +([\*A-Za-z_\u00C0-\uFFFF][A-Za-z0-9\-\_\[\]\(\)\u00C0-\uFFFF\*]*) return 'ATTRIBUTE_WORD'; \"[^"]*\" return 'COMMENT'; [\n]+ /* nothing */ "}" { this.popState(); return 'BLOCK_STOP'; } @@ -33,6 +42,14 @@ accDescr\s*"{"\s* { this.begin("acc_descr_multili "[" return 'SQS'; "]" return 'SQE'; +"style" { this.begin("style"); return 'STYLE'; } +