Compare commits

..

1 Commits

Author SHA1 Message Date
Steph
f85bb1496a update topbar content 2025-03-20 16:31:33 -07:00
441 changed files with 5932 additions and 19159 deletions

View File

@@ -33,9 +33,4 @@ export const packageOptions = {
packageName: 'mermaid-layout-elk', packageName: 'mermaid-layout-elk',
file: 'layouts.ts', file: 'layouts.ts',
}, },
examples: {
name: 'mermaid-examples',
packageName: 'examples',
file: 'index.ts',
},
} as const satisfies Record<string, PackageOptions>; } as const satisfies Record<string, PackageOptions>;

View File

@@ -27,7 +27,6 @@ const MERMAID_CONFIG_DIAGRAM_KEYS = [
'block', 'block',
'packet', 'packet',
'architecture', 'architecture',
'radar',
] as const; ] as const;
/** /**

View File

@@ -10,16 +10,13 @@ const buildType = (packageName: string) => {
console.log(out.toString()); console.log(out.toString());
} }
} catch (e) { } catch (e) {
console.error(e);
if (e.stdout.length > 0) { if (e.stdout.length > 0) {
console.error(e.stdout.toString()); console.error(e.stdout.toString());
} }
if (e.stderr.length > 0) { if (e.stderr.length > 0) {
console.error(e.stderr.toString()); console.error(e.stderr.toString());
} }
// Exit the build process if we are in CI
if (process.env.CI) {
throw new Error(`Failed to build types for ${packageName}`);
}
} }
}; };

View File

@@ -1,5 +0,0 @@
---
'mermaid': minor
---
feat: Add `getRegisteredDiagramsMetadata` to `mermaid`, which returns all the registered diagram IDs in mermaid

View File

@@ -1,5 +0,0 @@
---
'@mermaid-js/examples': minor
---
feat: Add examples for diagrams in the `@mermaid-js/examples` package

View File

@@ -1,7 +0,0 @@
---
'@mermaid-js/examples': patch
'mermaid': patch
'@mermaid-js/parser': patch
---
chore: Move packet diagram out of beta

View File

@@ -1,5 +0,0 @@
---
'mermaid': patch
---
fix: adjust sequence diagram title positioning to prevent overlap with top border in Safari

View File

@@ -1,5 +0,0 @@
---
'mermaid': patch
---
chore: downgrade chokidar to 3.6.0 and ignore updates for hot reload stability

View File

@@ -1,7 +0,0 @@
---
'mermaid': patch
---
fix(timeline): fix loading `leftMargin` from config
The `timeline.leftMargin` config value should now correctly control the size of the left margin, instead of being ignored.

View File

@@ -47,13 +47,13 @@ edgesep
EMPTYSTR EMPTYSTR
enddate enddate
ERDIAGRAM ERDIAGRAM
eslint
flatmap flatmap
forwardable forwardable
frontmatter frontmatter
funs funs
gantt gantt
GENERICTYPE GENERICTYPE
getBoundarys
grammr grammr
graphtype graphtype
halign halign
@@ -88,7 +88,6 @@ NODIR
NSTR NSTR
outdir outdir
Qcontrolx Qcontrolx
QSTR
reinit reinit
rels rels
reqs reqs

View File

@@ -2,10 +2,8 @@
Ashish Jain Ashish Jain
cpettitt cpettitt
Dong Cai Dong Cai
knsv
Knut Sveidqvist
Nikolay Rozhkov Nikolay Rozhkov
Peng Xiao Peng Xiao
Per Brolin Per Brolin
Sidharth Vinod
subhash-halder subhash-halder
Vinod Sidharth

View File

@@ -26,7 +26,6 @@ dompurify
elkjs elkjs
fcose fcose
fontawesome fontawesome
Fonticons
Forgejo Forgejo
Foswiki Foswiki
Gitea Gitea

View File

@@ -13,10 +13,11 @@ gitgraph
gzipped gzipped
handDrawn handDrawn
kanban kanban
knsv
Knut
marginx marginx
marginy marginy
Markdownish Markdownish
mermaidchart
mermaidjs mermaidjs
mindmap mindmap
mindmaps mindmaps
@@ -34,6 +35,7 @@ sandboxed
siebling siebling
statediagram statediagram
substate substate
Sveidqvist
unfixable unfixable
Viewbox Viewbox
viewports viewports

View File

@@ -1,5 +1,5 @@
import { build } from 'esbuild'; import { build } from 'esbuild';
import { cp, mkdir, readFile, rename, writeFile } from 'node:fs/promises'; import { mkdir, writeFile } from 'node:fs/promises';
import { packageOptions } from '../.build/common.js'; import { packageOptions } from '../.build/common.js';
import { generateLangium } from '../.build/generateLangium.js'; import { generateLangium } from '../.build/generateLangium.js';
import type { MermaidBuildOptions } from './util.js'; import type { MermaidBuildOptions } from './util.js';
@@ -31,27 +31,6 @@ const buildPackage = async (entryName: keyof typeof packageOptions) => {
// mermaid.js // mermaid.js
{ ...iifeOptions }, { ...iifeOptions },
// mermaid.min.js // mermaid.min.js
{ ...iifeOptions, minify: true, metafile: shouldVisualize },
// mermaid.tiny.min.js
{
...iifeOptions,
minify: true,
includeLargeFeatures: false,
metafile: shouldVisualize,
sourcemap: false,
}
);
}
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 } { ...iifeOptions, minify: true, metafile: shouldVisualize }
); );
} }
@@ -78,21 +57,6 @@ const handler = (e) => {
process.exit(1); process.exit(1);
}; };
const buildTinyMermaid = async () => {
await mkdir('./packages/tiny/dist', { recursive: true });
await rename(
'./packages/mermaid/dist/mermaid.tiny.min.js',
'./packages/tiny/dist/mermaid.tiny.js'
);
// Copy version from mermaid's package.json to tiny's package.json
const mermaidPkg = JSON.parse(await readFile('./packages/mermaid/package.json', 'utf8'));
const tinyPkg = JSON.parse(await readFile('./packages/tiny/package.json', 'utf8'));
tinyPkg.version = mermaidPkg.version;
await writeFile('./packages/tiny/package.json', JSON.stringify(tinyPkg, null, 2) + '\n');
await cp('./packages/mermaid/CHANGELOG.md', './packages/tiny/CHANGELOG.md');
};
const main = async () => { const main = async () => {
await generateLangium(); await generateLangium();
await mkdir('stats', { recursive: true }); await mkdir('stats', { recursive: true });
@@ -101,7 +65,6 @@ const main = async () => {
for (const pkg of packageNames) { for (const pkg of packageNames) {
await buildPackage(pkg).catch(handler); await buildPackage(pkg).catch(handler);
} }
await buildTinyMermaid();
}; };
void main(); void main();

View File

@@ -14,7 +14,6 @@ export interface MermaidBuildOptions extends BuildOptions {
metafile: boolean; metafile: boolean;
format: 'esm' | 'iife'; format: 'esm' | 'iife';
options: PackageOptions; options: PackageOptions;
includeLargeFeatures: boolean;
} }
export const defaultOptions: Omit<MermaidBuildOptions, 'entryName' | 'options'> = { export const defaultOptions: Omit<MermaidBuildOptions, 'entryName' | 'options'> = {
@@ -22,7 +21,6 @@ export const defaultOptions: Omit<MermaidBuildOptions, 'entryName' | 'options'>
metafile: false, metafile: false,
core: false, core: false,
format: 'esm', format: 'esm',
includeLargeFeatures: true,
} as const; } as const;
const buildOptions = (override: BuildOptions): BuildOptions => { const buildOptions = (override: BuildOptions): BuildOptions => {
@@ -41,18 +39,12 @@ const buildOptions = (override: BuildOptions): BuildOptions => {
}; };
}; };
const getFileName = ( const getFileName = (fileName: string, { core, format, minify }: MermaidBuildOptions) => {
fileName: string,
{ core, format, minify, includeLargeFeatures }: MermaidBuildOptions
) => {
if (core) { if (core) {
fileName += '.core'; fileName += '.core';
} else if (format === 'esm') { } else if (format === 'esm') {
fileName += '.esm'; fileName += '.esm';
} }
if (!includeLargeFeatures) {
fileName += '.tiny';
}
if (minify) { if (minify) {
fileName += '.min'; fileName += '.min';
} }
@@ -62,27 +54,23 @@ const getFileName = (
export const getBuildConfig = (options: MermaidBuildOptions): BuildOptions => { export const getBuildConfig = (options: MermaidBuildOptions): BuildOptions => {
const { const {
core, core,
metafile,
format, format,
minify,
options: { name, file, packageName }, options: { name, file, packageName },
globalName = 'mermaid',
includeLargeFeatures,
...rest
} = options; } = options;
const external: string[] = ['require', 'fs', 'path']; const external: string[] = ['require', 'fs', 'path'];
const outFileName = getFileName(name, options); const outFileName = getFileName(name, options);
const output: BuildOptions = buildOptions({ const output: BuildOptions = buildOptions({
...rest,
absWorkingDir: resolve(__dirname, `../packages/${packageName}`), absWorkingDir: resolve(__dirname, `../packages/${packageName}`),
entryPoints: { entryPoints: {
[outFileName]: `src/${file}`, [outFileName]: `src/${file}`,
}, },
globalName, metafile,
minify,
logLevel: 'info', logLevel: 'info',
chunkNames: `chunks/${outFileName}/[name]-[hash]`, chunkNames: `chunks/${outFileName}/[name]-[hash]`,
define: { define: {
// This needs to be stringified for esbuild
includeLargeFeatures: `${includeLargeFeatures}`,
'import.meta.vitest': 'undefined', 'import.meta.vitest': 'undefined',
}, },
}); });
@@ -101,12 +89,11 @@ export const getBuildConfig = (options: MermaidBuildOptions): BuildOptions => {
if (format === 'iife') { if (format === 'iife') {
output.format = 'iife'; output.format = 'iife';
output.splitting = false; output.splitting = false;
const originalGlobalName = output.globalName ?? 'mermaid'; output.globalName = '__esbuild_esm_mermaid';
output.globalName = `__esbuild_esm_mermaid_nm[${JSON.stringify(originalGlobalName)}]`;
// Workaround for removing the .default access in esbuild IIFE. // Workaround for removing the .default access in esbuild IIFE.
// https://github.com/mermaid-js/mermaid/pull/4109#discussion_r1292317396 // https://github.com/mermaid-js/mermaid/pull/4109#discussion_r1292317396
output.footer = { output.footer = {
js: `globalThis[${JSON.stringify(originalGlobalName)}] = globalThis.${output.globalName}.default;`, js: 'globalThis.mermaid = globalThis.__esbuild_esm_mermaid.default;',
}; };
output.outExtension = { '.js': '.js' }; output.outExtension = { '.js': '.js' };
} else { } else {

View File

@@ -29,7 +29,7 @@ body:
label: Colors label: Colors
description: |- description: |-
A detailed list of the different colour values to use. A detailed list of the different colour values to use.
See the [list of currently used variable names](https://mermaid-js.github.io/mermaid/#/theming?id=theme-variables-reference-table) A list of currently used variable names can be found [here](https://mermaid-js.github.io/mermaid/#/theming?id=theme-variables-reference-table)
placeholder: |- placeholder: |-
- background: #f4f4f4 - background: #f4f4f4
- primaryColor: #fff4dd - primaryColor: #fff4dd

10
.github/lychee.toml vendored
View File

@@ -46,17 +46,11 @@ exclude = [
# Drupal 403 # Drupal 403
"https://(www.)?drupal.org", "https://(www.)?drupal.org",
# Phbpp 403 # Swimm returns 404, eventhough the link is valid
"https://(www.)?phpbb.com",
# Swimm returns 404, even though the link is valid
"https://docs.swimm.io", "https://docs.swimm.io",
# Timeout # Timeout
"https://huehive.co", "https://huehive.co"
"https://foswiki.org",
"https://www.gnu.org",
"https://mermaid-preview.com"
] ]
# Exclude all private IPs from checking. # Exclude all private IPs from checking.

2
.github/stale.yml vendored
View File

@@ -15,5 +15,5 @@ markComment: >
If you are still interested in this issue and it is still relevant you can comment to revive it. If you are still interested in this issue and it is still relevant you can comment to revive it.
# Comment to post when closing a stale issue. Set to `false` to disable # Comment to post when closing a stale issue. Set to `false` to disable
closeComment: > closeComment: >
This issue has been automatically closed due to a lack of activity. This issue has been been automatically closed due to a lack of activity.
This is done to maintain a clean list of issues that the community is interested in developing. This is done to maintain a clean list of issues that the community is interested in developing.

View File

@@ -42,4 +42,4 @@ jobs:
working-directory: ./packages/mermaid working-directory: ./packages/mermaid
run: pnpm run docs:build run: pnpm run docs:build
- uses: autofix-ci/action@635ffb0c9798bd160680f18fd73371e355b85f27 # main - uses: autofix-ci/action@551dded8c6cc8a1054039c8bc0b8b48c51dfc6ef # main

View File

@@ -45,15 +45,13 @@ jobs:
- if: ${{ env.USE_APPLI }} - if: ${{ env.USE_APPLI }}
name: Notify applitools of new batch name: Notify applitools of new batch
# Copied from docs https://applitools.com/docs/topics/integrations/github-integration-ci-setup.html # Copied from docs https://applitools.com/docs/topics/integrations/github-integration-ci-setup.html
run: curl -L -d '' -X POST "$APPLITOOLS_SERVER_URL/api/externals/github/push?apiKey=$APPLITOOLS_API_KEY&CommitSha=$GITHUB_SHA&BranchName=${APPLITOOLS_BRANCH}$&ParentBranchName=$APPLITOOLS_PARENT_BRANCH"
env: env:
# e.g. mermaid-js/mermaid/my-branch # e.g. mermaid-js/mermaid/my-branch
APPLITOOLS_BRANCH: ${{ github.repository }}/${{ github.ref_name }} APPLITOOLS_BRANCH: ${{ github.repository }}/${{ github.ref_name }}
APPLITOOLS_PARENT_BRANCH: ${{ github.event.inputs.parent_branch }} APPLITOOLS_PARENT_BRANCH: ${{ github.event.inputs.parent_branch }}
APPLITOOLS_API_KEY: ${{ secrets.APPLITOOLS_API_KEY }} APPLITOOLS_API_KEY: ${{ secrets.APPLITOOLS_API_KEY }}
APPLITOOLS_SERVER_URL: 'https://eyesapi.applitools.com' APPLITOOLS_SERVER_URL: 'https://eyesapi.applitools.com'
uses: wei/curl@012398a392d02480afa2720780031f8621d5f94c
with:
args: -X POST "$APPLITOOLS_SERVER_URL/api/externals/github/push?apiKey=$APPLITOOLS_API_KEY&CommitSha=$GITHUB_SHA&BranchName=${APPLITOOLS_BRANCH}$&ParentBranchName=$APPLITOOLS_PARENT_BRANCH"
- name: Cypress run - name: Cypress run
uses: cypress-io/github-action@18a6541367f4580a515371905f499a27a44e8dbe # v6.7.12 uses: cypress-io/github-action@18a6541367f4580a515371905f499a27a44e8dbe # v6.7.12

View File

@@ -11,7 +11,6 @@ concurrency: ${{ github.workflow }}-${{ github.ref }}
permissions: permissions:
contents: write contents: write
pull-requests: write
jobs: jobs:
timings: timings:
@@ -30,7 +29,6 @@ jobs:
uses: cypress-io/github-action@18a6541367f4580a515371905f499a27a44e8dbe # v6.7.12 uses: cypress-io/github-action@18a6541367f4580a515371905f499a27a44e8dbe # v6.7.12
with: with:
runTests: false runTests: false
- name: Cypress run - name: Cypress run
uses: cypress-io/github-action@18a6541367f4580a515371905f499a27a44e8dbe # v6.7.12 uses: cypress-io/github-action@18a6541367f4580a515371905f499a27a44e8dbe # v6.7.12
id: cypress id: cypress
@@ -46,25 +44,15 @@ jobs:
SPLIT: 1 SPLIT: 1
SPLIT_INDEX: 0 SPLIT_INDEX: 0
SPLIT_FILE: 'cypress/timings.json' SPLIT_FILE: 'cypress/timings.json'
- name: Commit changes
- name: Compare timings uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4
id: compare
run: |
OUTPUT=$(pnpm tsx scripts/compare-timings.ts)
echo "$OUTPUT" >> $GITHUB_STEP_SUMMARY
echo "output<<EOF" >> $GITHUB_OUTPUT
echo "$OUTPUT" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Commit and create pull request
uses: peter-evans/create-pull-request@889dce9eaba7900ce30494f5e1ac7220b27e5c81
with: with:
add-paths: | add: 'cypress/timings.json'
cypress/timings.json author_name: 'github-actions[bot]'
commit-message: 'chore: update E2E timings' author_email: '41898282+github-actions[bot]@users.noreply.github.com'
branch: update-timings message: 'chore: update E2E timings'
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
branch: release-promotion
title: Update E2E Timings title: Update E2E Timings
body: ${{ steps.compare.outputs.output }}
delete-branch: true
sign-commits: true

View File

@@ -29,29 +29,3 @@ jobs:
disable-releaser: true disable-releaser: true
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Add "Sponsored by MermaidChart" label
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const prNumber = context.payload.pull_request.number;
const { data: commits } = await github.rest.pulls.listCommits({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber,
});
const isSponsored = commits.every(
(c) => c.commit.author.email?.endsWith('@mermaidchart.com')
);
if (isSponsored) {
console.log('PR is sponsored. Adding label.');
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
labels: ['Sponsored by MermaidChart'],
});
}

View File

@@ -1,70 +0,0 @@
name: Validate pnpm-lock.yaml
on:
pull_request:
paths:
- 'pnpm-lock.yaml'
- '**/package.json'
- '.github/workflows/validate-lockfile.yml'
jobs:
validate-lockfile:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
- name: Validate pnpm-lock.yaml entries
id: validate # give this step an ID so we can reference its outputs
run: |
issues=()
# 1) No tarball references
if grep -qF 'tarball:' pnpm-lock.yaml; then
issues+=("• Tarball references found (forbidden)")
fi
# 2) No unwanted vitepress paths
if grep -qF 'packages/mermaid/src/vitepress' pnpm-lock.yaml; then
issues+=("• Disallowed path 'packages/mermaid/src/vitepress' present. Run \`rm -rf packages/mermaid/src/vitepress && pnpm install\` to regenerate.")
fi
# 3) Lockfile only changes when package.json changes
git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} > changed.txt
if grep -q '^pnpm-lock.yaml$' changed.txt && ! grep -q 'package.json' changed.txt; then
issues+=("• pnpm-lock.yaml changed without any package.json modification")
fi
# If any issues, output them and fail
if [ ${#issues[@]} -gt 0 ]; then
{
echo "errors<<EOF"
printf '%s\n' "${issues[@]}"
echo "EOF"
} >> "$GITHUB_OUTPUT"
exit 1
fi
- name: Comment on PR if validation failed
if: failure()
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body: |
The following issue(s) were detected:
${{ steps.validate.outputs.errors }}
Please address these and push an update.
_Posted automatically by GitHub Actions_

View File

@@ -94,10 +94,6 @@ export const getBuildConfig = ({ minify, core, watch, entryName }: BuildOptions)
}), }),
...visualizerOptions(packageName, core), ...visualizerOptions(packageName, core),
], ],
define: {
// Needs to be string
includeLargeFeatures: 'true',
},
}; };
if (watch && config.build) { if (watch && config.build) {

View File

@@ -256,7 +256,7 @@ mermaid.run({
- Problem showing graph with php on localhost [\#502](https://github.com/knsv/mermaid/issues/502) - Problem showing graph with php on localhost [\#502](https://github.com/knsv/mermaid/issues/502)
- logLevel's option doesnt work at 7.0.0 [\#501](https://github.com/knsv/mermaid/issues/501) - logLevel's option doesnt work at 7.0.0 [\#501](https://github.com/knsv/mermaid/issues/501)
- How do I get the log for a render or parse attempt? [\#500](https://github.com/knsv/mermaid/issues/500) - How do I get the log for a render or parse attempt? [\#500](https://github.com/knsv/mermaid/issues/500)
- Mermaid neutral style to built in latest release [\#499](https://github.com/knsv/mermaid/issues/499) - Mermaid neutral style style to built in latest release [\#499](https://github.com/knsv/mermaid/issues/499)
- Any plans for adding a typescript definition file? [\#495](https://github.com/knsv/mermaid/issues/495) - Any plans for adding a typescript definition file? [\#495](https://github.com/knsv/mermaid/issues/495)
- Gantt diagrams too narrow [\#493](https://github.com/knsv/mermaid/issues/493) - Gantt diagrams too narrow [\#493](https://github.com/knsv/mermaid/issues/493)
- Flowchart edge labels placement [\#490](https://github.com/knsv/mermaid/issues/490) - Flowchart edge labels placement [\#490](https://github.com/knsv/mermaid/issues/490)
@@ -833,7 +833,7 @@ mermaid.run({
- Merge pull request \#1 from knsv/master [\#96](https://github.com/knsv/mermaid/pull/96) ([gkchic](https://github.com/gkchic)) - Merge pull request \#1 from knsv/master [\#96](https://github.com/knsv/mermaid/pull/96) ([gkchic](https://github.com/gkchic))
- Removed duplicated section in flowchart docs [\#94](https://github.com/knsv/mermaid/pull/94) ([kaime](https://github.com/kaime)) - Removed duplicated section in flowchart docs [\#94](https://github.com/knsv/mermaid/pull/94) ([kaime](https://github.com/kaime))
- Grammar changes to sequence page [\#93](https://github.com/knsv/mermaid/pull/93) ([gkchic](https://github.com/gkchic)) - Grammar changes to sequence page [\#93](https://github.com/knsv/mermaid/pull/93) ([gkchic](https://github.com/gkchic))
- GitHub buttons [\#89](https://github.com/knsv/mermaid/pull/89) ([gkchic](https://github.com/gkchic)) - Github buttons [\#89](https://github.com/knsv/mermaid/pull/89) ([gkchic](https://github.com/gkchic))
- Template change [\#88](https://github.com/knsv/mermaid/pull/88) ([gkchic](https://github.com/gkchic)) - Template change [\#88](https://github.com/knsv/mermaid/pull/88) ([gkchic](https://github.com/gkchic))
## [0.3.1](https://github.com/knsv/mermaid/tree/0.3.1) (2015-01-05) ## [0.3.1](https://github.com/knsv/mermaid/tree/0.3.1) (2015-01-05)
@@ -1002,4 +1002,4 @@ mermaid.run({
## [0.1.0](https://github.com/knsv/mermaid/tree/0.1.0) (2014-11-16) ## [0.1.0](https://github.com/knsv/mermaid/tree/0.1.0) (2014-11-16)
\* _This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/GitHub-Changelog-Generator)_ \* _This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)_

View File

@@ -44,7 +44,7 @@ Try Live Editor previews of future releases: <a href="https://develop.git.mermai
**Thanks to all involved, people committing pull requests, people answering questions! 🙏** **Thanks to all involved, people committing pull requests, people answering questions! 🙏**
<a href="https://mermaid.js.org/landing/"><img src="https://github.com/mermaid-js/mermaid/blob/master/docs/intro/img/book-banner-post-release.jpg" alt='Banner for "The Official Guide to Mermaid.js" book'></a> <a href="https://mermaid.js.org/landing/"><img src="https://github.com/mermaid-js/mermaid/blob/master/docs/intro/img/book-banner-post-release.jpg" alt="Explore Mermaid.js in depth, with real-world examples, tips & tricks from the creator... The first official book on Mermaid is available for purchase. Check it out!"></a>
## Table of content ## Table of content
@@ -95,6 +95,10 @@ In our release process we rely heavily on visual regression tests using [applito
<!-- </Main description> --> <!-- </Main description> -->
## Mermaid AI Bot
[Mermaid](https://codeparrot.ai/oracle?owner=mermaid-js&repo=mermaid) Bot will help you understand this repository better. You can ask for code examples, installation guide, debugging help and much more.
## Examples ## Examples
**The following are some examples of the diagrams, charts and graphs that can be made using Mermaid. Click here to jump into the [text syntax](https://mermaid.js.org/intro/syntax-reference.html).** **The following are some examples of the diagrams, charts and graphs that can be made using Mermaid. Click here to jump into the [text syntax](https://mermaid.js.org/intro/syntax-reference.html).**
@@ -447,7 +451,7 @@ For public sites, it can be precarious to retrieve text from users on the intern
As an extra level of security for sites with external users we are happy to introduce a new security level in which the diagram is rendered in a sandboxed iframe preventing javascript in the code from being executed. This is a great step forward for better security. As an extra level of security for sites with external users we are happy to introduce a new security level in which the diagram is rendered in a sandboxed iframe preventing javascript in the code from being executed. This is a great step forward for better security.
_Unfortunately you cannot have a cake and eat it at the same time which in this case means that some of the interactive functionality gets blocked along with the possible malicious code._ _Unfortunately you can not have a cake and eat it at the same time which in this case means that some of the interactive functionality gets blocked along with the possible malicious code._
## Reporting vulnerabilities ## Reporting vulnerabilities

View File

@@ -43,13 +43,13 @@ Mermaid
**感谢所有参与进来提交 PR解答疑问的人们! 🙏** **感谢所有参与进来提交 PR解答疑问的人们! 🙏**
<a href="https://mermaid.js.org/landing/"><img src="https://github.com/mermaid-js/mermaid/blob/master/docs/intro/img/book-banner-post-release.jpg" alt='Banner for "The Official Guide to Mermaid.js" book'></a> <a href="https://mermaid.js.org/landing/"><img src="https://github.com/mermaid-js/mermaid/blob/master/docs/intro/img/book-banner-post-release.jpg" alt="Explore Mermaid.js in depth, with real-world examples, tips & tricks from the creator... The first official book on Mermaid is available for purchase. Check it out!"></a>
## 关于 Mermaid ## 关于 Mermaid
<!-- <Main description> --> <!-- <Main description> -->
Mermaid 是一个基于 JavaScript 的图表绘制工具,通过解析类 Markdown 的文本语法来实现图表的创建和动态修改。Mermaid 诞生的主要目的是让文档的更新能够及时跟上开发进度。 Mermaid 是一个基于 Javascript 的图表绘制工具,通过解析类 Markdown 的文本语法来实现图表的创建和动态修改。Mermaid 诞生的主要目的是让文档的更新能够及时跟上开发进度。
> Doc-Rot 是 Mermaid 致力于解决的一个难题。 > Doc-Rot 是 Mermaid 致力于解决的一个难题。

View File

@@ -1,8 +1,8 @@
import eyesPlugin from '@applitools/eyes-cypress'; import eyesPlugin from '@applitools/eyes-cypress';
import { registerArgosTask } from '@argos-ci/cypress/task'; import { registerArgosTask } from '@argos-ci/cypress/task';
import coverage from '@cypress/code-coverage/task.js'; import coverage from '@cypress/code-coverage/task';
import { defineConfig } from 'cypress'; import { defineConfig } from 'cypress';
import { addMatchImageSnapshotPlugin } from 'cypress-image-snapshot/plugin.js'; import { addMatchImageSnapshotPlugin } from 'cypress-image-snapshot/plugin';
import cypressSplit from 'cypress-split'; import cypressSplit from 'cypress-split';
export default eyesPlugin( export default eyesPlugin(
@@ -26,10 +26,7 @@ export default eyesPlugin(
config.env.useArgos = process.env.RUN_VISUAL_TEST === 'true'; config.env.useArgos = process.env.RUN_VISUAL_TEST === 'true';
if (config.env.useArgos) { if (config.env.useArgos) {
registerArgosTask(on, config, { registerArgosTask(on, config);
// Enable upload to Argos only when it runs on CI.
uploadToArgos: !!process.env.CI,
});
} else { } else {
addMatchImageSnapshotPlugin(on, config); addMatchImageSnapshotPlugin(on, config);
} }

View File

@@ -69,9 +69,7 @@ describe('Configuration', () => {
.and('include', 'url(#'); .and('include', 'url(#');
}); });
}); });
// This has been broken for a long time, but something about the Cypress environment was it('should handle arrowMarkerAbsolute explicitly set to "false" as false', () => {
// rewriting the URL to be relative, causing the test to incorrectly pass.
it.skip('should handle arrowMarkerAbsolute explicitly set to "false" as false', () => {
renderGraph( renderGraph(
`graph TD `graph TD
A[Christmas] -->|Get money| B(Go shopping) A[Christmas] -->|Get money| B(Go shopping)
@@ -114,7 +112,7 @@ describe('Configuration', () => {
.first() .first()
.should('have.attr', 'marker-end') .should('have.attr', 'marker-end')
.should('exist') .should('exist')
.and('include', 'url(http\\:\\/\\/localhost'); .and('include', 'url(http://localhost');
}); });
}); });
it('should not taint the initial configuration when using multiple directives', () => { it('should not taint the initial configuration when using multiple directives', () => {

View File

@@ -20,7 +20,7 @@ describe('Interaction', () => {
}); });
it('Graph: should handle a click on a node with a bound url', () => { it('Graph: should handle a click on a node with a bound url', () => {
// When there is a URL, `cy.contains()` selects the `a` tag instead of the `span` tag. The .node is a child of `a`, so we have to use `find()` instead of `parent`. // When there is a URL, cy.contains selects the a tag instead of the span. The .node is a child of a, so we have to use find instead of parent.
cy.contains('URLTest1').find('.node').click(); cy.contains('URLTest1').find('.node').click();
cy.location().should(({ href }) => { cy.location().should(({ href }) => {
expect(href).to.eq('http://localhost:9000/empty.html'); expect(href).to.eq('http://localhost:9000/empty.html');
@@ -146,7 +146,7 @@ describe('Interaction', () => {
}); });
}); });
describe('Interaction - security level other, misspelling', () => { describe('Interaction - security level other, missspelling', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('http://localhost:9000/click_security_other.html'); cy.visit('http://localhost:9000/click_security_other.html');
}); });

View File

@@ -19,25 +19,6 @@ describe.skip('architecture diagram', () => {
` `
); );
}); });
it('should render a simple architecture diagram with titleAndAccessibilities', () => {
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', () => { it('should render an architecture diagram with groups within groups', () => {
imgSnapshotTest( imgSnapshotTest(
`architecture-beta `architecture-beta
@@ -191,7 +172,7 @@ describe.skip('architecture diagram', () => {
); );
}); });
it('should render an architecture diagram with a reasonable height', () => { it('should render an architecture diagram with a resonable height', () => {
imgSnapshotTest( imgSnapshotTest(
`architecture-beta `architecture-beta
group federated(cloud)[Federated Environment] group federated(cloud)[Federated Environment]

View File

@@ -14,7 +14,7 @@ describe('Block diagram', () => {
); );
}); });
it('BL2: should handle columns statement in sub-blocks', () => { it('BL2: should handle colums statement in sub-blocks', () => {
imgSnapshotTest( imgSnapshotTest(
`block-beta `block-beta
id1["Hello"] id1["Hello"]
@@ -30,7 +30,7 @@ describe('Block diagram', () => {
); );
}); });
it('BL3: should align block widths and handle columns statement in sub-blocks', () => { it('BL3: should align block widths and handle colums statement in sub-blocks', () => {
imgSnapshotTest( imgSnapshotTest(
`block-beta `block-beta
block block
@@ -46,7 +46,7 @@ describe('Block diagram', () => {
); );
}); });
it('BL4: should align block widths and handle columns statements in deeper sub-blocks then 1 level', () => { it('BL4: should align block widths and handle colums statements in deeper sub-blocks then 1 level', () => {
imgSnapshotTest( imgSnapshotTest(
`block-beta `block-beta
columns 1 columns 1
@@ -66,7 +66,7 @@ describe('Block diagram', () => {
); );
}); });
it('BL5: should align block widths and handle columns statements in deeper sub-blocks then 1 level (alt)', () => { it('BL5: should align block widths and handle colums statements in deeper sub-blocks then 1 level (alt)', () => {
imgSnapshotTest( imgSnapshotTest(
`block-beta `block-beta
columns 1 columns 1
@@ -236,7 +236,7 @@ describe('Block diagram', () => {
); );
}); });
it('BL17: width alignment - blocks should be equal in width', () => { it('BL17: width alignment - blocks shold be equal in width', () => {
imgSnapshotTest( imgSnapshotTest(
`block-beta `block-beta
A("This is the text") A("This is the text")

View File

@@ -429,7 +429,7 @@ describe('Class diagram', () => {
classDiagram classDiagram
class \`This\nTitle\nHas\nMany\nNewlines\` { class \`This\nTitle\nHas\nMany\nNewlines\` {
+String Also +String Also
-String Many -Stirng Many
#int Members #int Members
+And() +And()
-Many() -Many()
@@ -443,7 +443,7 @@ describe('Class diagram', () => {
classDiagram classDiagram
class \`This\nTitle\nHas\nMany\nNewlines\` { class \`This\nTitle\nHas\nMany\nNewlines\` {
+String Also +String Also
-String Many -Stirng Many
#int Members #int Members
+And() +And()
-Many() -Many()
@@ -459,7 +459,7 @@ describe('Class diagram', () => {
namespace testingNamespace { namespace testingNamespace {
class \`This\nTitle\nHas\nMany\nNewlines\` { class \`This\nTitle\nHas\nMany\nNewlines\` {
+String Also +String Also
-String Many -Stirng Many
#int Members #int Members
+And() +And()
-Many() -Many()

View File

@@ -208,13 +208,13 @@ describe('Flowchart ELK', () => {
`flowchart-elk TB `flowchart-elk TB
internet internet
nat nat
router routeur
lb1 lb1
lb2 lb2
compute1 compute1
compute2 compute2
subgraph project subgraph project
router routeur
nat nat
subgraph subnet1 subgraph subnet1
compute1 compute1
@@ -225,8 +225,8 @@ describe('Flowchart ELK', () => {
lb2 lb2
end end
end end
internet --> router internet --> routeur
router --> subnet1 & subnet2 routeur --> subnet1 & subnet2
subnet1 & subnet2 --> nat --> internet subnet1 & subnet2 --> nat --> internet
`, `,
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' } { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
@@ -443,7 +443,7 @@ flowchart-elk TD
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' } { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
it('63-elk: title on subgraphs should be themeable', () => { it('63-elk: title on subgraphs should be themable', () => {
imgSnapshotTest( imgSnapshotTest(
` `
%%{init:{"theme":"base", "themeVariables": {"primaryColor":"#411d4e", "titleColor":"white", "darkMode":true}}}%% %%{init:{"theme":"base", "themeVariables": {"primaryColor":"#411d4e", "titleColor":"white", "darkMode":true}}}%%

View File

@@ -1,28 +0,0 @@
import { imgSnapshotTest } from '../../helpers/util.ts';
const themes = ['default', 'forest', 'dark', 'base', 'neutral'];
describe('when rendering flowchart with icons', () => {
for (const theme of themes) {
it(`should render icons from fontawesome library on theme ${theme}`, () => {
imgSnapshotTest(
`flowchart TD
A("fab:fa-twitter Twitter") --> B("fab:fa-facebook Facebook")
B --> C("fa:fa-coffee Coffee")
C --> D("fa:fa-car Car")
D --> E("fab:fa-github GitHub")
`,
{ theme }
);
});
it(`should render registered icons on theme ${theme}`, () => {
imgSnapshotTest(
`flowchart TD
A("fa:fa-bell Bell")
`,
{ theme }
);
});
}
});

View File

@@ -99,7 +99,7 @@ describe('Flowchart v2', () => {
const style = svg.attr('style'); const style = svg.attr('style');
expect(style).to.match(/^max-width: [\d.]+px;$/); expect(style).to.match(/^max-width: [\d.]+px;$/);
const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join('')); const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join(''));
expect(maxWidthValue).to.be.within(440 * 0.95, 440 * 1.05); expect(maxWidthValue).to.be.within(417 * 0.95, 417 * 1.05);
}); });
}); });
it('8: should render a flowchart when useMaxWidth is false', () => { it('8: should render a flowchart when useMaxWidth is false', () => {
@@ -118,7 +118,7 @@ describe('Flowchart v2', () => {
const width = parseFloat(svg.attr('width')); const width = parseFloat(svg.attr('width'));
// use within because the absolute value can be slightly different depending on the environment ±5% // use within because the absolute value can be slightly different depending on the environment ±5%
// expect(height).to.be.within(446 * 0.95, 446 * 1.05); // expect(height).to.be.within(446 * 0.95, 446 * 1.05);
expect(width).to.be.within(440 * 0.95, 440 * 1.05); expect(width).to.be.within(417 * 0.95, 417 * 1.05);
expect(svg).to.not.have.attr('style'); expect(svg).to.not.have.attr('style');
}); });
}); });
@@ -198,13 +198,13 @@ describe('Flowchart v2', () => {
`flowchart TB `flowchart TB
internet internet
nat nat
router routeur
lb1 lb1
lb2 lb2
compute1 compute1
compute2 compute2
subgraph project subgraph project
router routeur
nat nat
subgraph subnet1 subgraph subnet1
compute1 compute1
@@ -215,8 +215,8 @@ describe('Flowchart v2', () => {
lb2 lb2
end end
end end
internet --> router internet --> routeur
router --> subnet1 & subnet2 routeur --> subnet1 & subnet2
subnet1 & subnet2 --> nat --> internet subnet1 & subnet2 --> nat --> internet
`, `,
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' } { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
@@ -433,7 +433,7 @@ flowchart TD
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' } { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
it('63: title on subgraphs should be themeable', () => { it('63: title on subgraphs should be themable', () => {
imgSnapshotTest( imgSnapshotTest(
` `
%%{init:{"theme":"base", "themeVariables": {"primaryColor":"#411d4e", "titleColor":"white", "darkMode":true}}}%% %%{init:{"theme":"base", "themeVariables": {"primaryColor":"#411d4e", "titleColor":"white", "darkMode":true}}}%%
@@ -699,7 +699,7 @@ A --> B
{ flowchart: { titleTopMargin: 10 } } { flowchart: { titleTopMargin: 10 } }
); );
}); });
it('3192: It should be possible to render flowcharts with invisible edges', () => { it('3192: It should be possieble to render flowcharts with invisible edges', () => {
imgSnapshotTest( imgSnapshotTest(
`--- `---
title: Simple flowchart with invisible edges title: Simple flowchart with invisible edges
@@ -1076,11 +1076,11 @@ end
); );
}); });
}); });
describe('New @ syntax for node metadata edge cases', () => { describe('New @ sytax for node metadata edge cases', () => {
it('should be possible to use @ syntax to add labels on multi nodes', () => { it('should be possible to use @ syntax to add labels on multi nodes', () => {
imgSnapshotTest( imgSnapshotTest(
`flowchart TB `flowchart TB
n2["label for n2"] & n4@{ label: "label for n4"} & n5@{ label: "label for n5"} n2["label for n2"] & n4@{ label: "labe for n4"} & n5@{ label: "labe for n5"}
`, `,
{} {}
); );
@@ -1088,7 +1088,7 @@ end
it('should be possible to use @ syntax to add labels with trail spaces and &', () => { it('should be possible to use @ syntax to add labels with trail spaces and &', () => {
imgSnapshotTest( imgSnapshotTest(
`flowchart TB `flowchart TB
n2["label for n2"] & n4@{ label: "label for n4"} & n5@{ label: "label for n5"} n2["label for n2"] & n4@{ label: "labe for n4"} & n5@{ label: "labe for n5"}
`, `,
{} {}
); );
@@ -1097,8 +1097,8 @@ end
imgSnapshotTest( imgSnapshotTest(
`flowchart TB `flowchart TB
n2["label for n2"] n2["label for n2"]
n4@{ label: "label for n4"} n4@{ label: "labe for n4"}
n5@{ label: "label for n5"} n5@{ label: "labe for n5"}
`, `,
{} {}
); );

View File

@@ -934,43 +934,4 @@ graph TD
} }
); );
}); });
it('68: should honor subgraph direction when inheritDir is false', () => {
imgSnapshotTest(
`
%%{init: {"flowchart": { "inheritDir": false }}}%%
flowchart TB
direction LR
subgraph A
direction TB
a --> b
end
subgraph B
c --> d
end
`,
{
fontFamily: 'courier',
}
);
});
it('69: should inherit global direction when inheritDir is true', () => {
imgSnapshotTest(
`
%%{init: {"flowchart": { "inheritDir": true }}}%%
flowchart TB
direction LR
subgraph A
direction TB
a --> b
end
subgraph B
c --> d
end
`,
{
fontFamily: 'courier',
}
);
});
}); });

View File

@@ -117,7 +117,7 @@ describe('Gantt diagram', () => {
{} {}
); );
}); });
it('should FAIL rendering a gantt chart for issue #1060 with invalid date', () => { it('should FAIL redering a gantt chart for issue #1060 with invalid date', () => {
imgSnapshotTest( imgSnapshotTest(
` `
gantt gantt
@@ -358,23 +358,6 @@ describe('Gantt diagram', () => {
); );
}); });
it('should render a gantt diagram with a vert tag', () => {
imgSnapshotTest(
`
gantt
title A Gantt Diagram
dateFormat ss
axisFormat %Ss
section Section
A task : a1, 00, 6s
Milestone : vert, 01,
section Another
Task in sec : 06, 3s
another task : 3s
`
);
});
it('should render a gantt diagram with tick is 2 milliseconds', () => { it('should render a gantt diagram with tick is 2 milliseconds', () => {
imgSnapshotTest( imgSnapshotTest(
` `
@@ -590,7 +573,7 @@ describe('Gantt diagram', () => {
` `
); );
}); });
it('should render a gantt diagram excluding friday and saturday', () => { it('should render a gantt diagram exculding friday and saturday', () => {
imgSnapshotTest( imgSnapshotTest(
`gantt `gantt
title A Gantt Diagram title A Gantt Diagram
@@ -601,7 +584,7 @@ describe('Gantt diagram', () => {
A task :a1, 2024-02-28, 10d` A task :a1, 2024-02-28, 10d`
); );
}); });
it('should render a gantt diagram excluding saturday and sunday', () => { it('should render a gantt diagram exculding saturday and sunday', () => {
imgSnapshotTest( imgSnapshotTest(
`gantt `gantt
title A Gantt Diagram title A Gantt Diagram
@@ -688,7 +671,7 @@ describe('Gantt diagram', () => {
title Gantt Digram title Gantt Digram
dateFormat YYYY-MM-DD dateFormat YYYY-MM-DD
section Section section Section
;A task with a semicolon :a1, 2014-01-01, 30d ;A task with a semiclon :a1, 2014-01-01, 30d
Another task :after a1 , 20d Another task :after a1 , 20d
section Another section Another
Task in sec :2014-01-12 , 12d Task in sec :2014-01-12 , 12d

View File

@@ -11,7 +11,7 @@ describe('Git Graph diagram', () => {
{} {}
); );
}); });
it('2: should render a simple gitgraph with commit on main branch with id', () => { it('2: should render a simple gitgraph with commit on main branch with Id', () => {
imgSnapshotTest( imgSnapshotTest(
`gitGraph `gitGraph
commit id: "One" commit id: "One"
@@ -253,7 +253,7 @@ describe('Git Graph diagram', () => {
` `
gitGraph gitGraph
checkout main checkout main
%% Make sure to manually set the id of all commits, for consistent visual tests %% Make sure to manually set the ID of all commits, for consistent visual tests
commit id: "1-abcdefg" commit id: "1-abcdefg"
checkout main checkout main
branch branch1 branch branch1
@@ -343,7 +343,7 @@ gitGraph
{} {}
); );
}); });
it('16: should render a simple gitgraph with commit on main branch with id | Vertical Branch', () => { it('16: should render a simple gitgraph with commit on main branch with Id | Vertical Branch', () => {
imgSnapshotTest( imgSnapshotTest(
`gitGraph TB: `gitGraph TB:
commit id: "One" commit id: "One"
@@ -585,7 +585,7 @@ gitGraph
` `
gitGraph TB: gitGraph TB:
checkout main checkout main
%% Make sure to manually set the id of all commits, for consistent visual tests %% Make sure to manually set the ID of all commits, for consistent visual tests
commit id: "1-abcdefg" commit id: "1-abcdefg"
checkout main checkout main
branch branch1 branch branch1
@@ -1024,7 +1024,7 @@ gitGraph TB:
{} {}
); );
}); });
it('51: should render a simple gitgraph with commit on main branch with id | Vertical Branch - Bottom-to-top', () => { it('51: should render a simple gitgraph with commit on main branch with Id | Vertical Branch - Bottom-to-top', () => {
imgSnapshotTest( imgSnapshotTest(
`gitGraph BT: `gitGraph BT:
commit id: "One" commit id: "One"
@@ -1266,7 +1266,7 @@ gitGraph TB:
` `
gitGraph BT: gitGraph BT:
checkout main checkout main
%% Make sure to manually set the id of all commits, for consistent visual tests %% Make sure to manually set the ID of all commits, for consistent visual tests
commit id: "1-abcdefg" commit id: "1-abcdefg"
checkout main checkout main
branch branch1 branch branch1
@@ -1491,7 +1491,7 @@ gitGraph TB:
` `
gitGraph gitGraph
switch main switch main
%% Make sure to manually set the id of all commits, for consistent visual tests %% Make sure to manually set the ID of all commits, for consistent visual tests
commit id: "1-abcdefg" commit id: "1-abcdefg"
switch main switch main
branch branch1 branch branch1

View File

@@ -63,199 +63,4 @@ section Checkout from website
{ journey: { useMaxWidth: false } } { 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);
});
});
});
it('should correctly render the user journey diagram title with the specified styling', () => {
renderGraph(
`---
config:
journey:
titleColor: "#2900A5"
titleFontFamily: "Times New Roman"
titleFontSize: "5rem"
---
journey
title User Journey Example
section Onboarding
Sign Up: 5: John, Shahir
Complete Profile: 4: John
section Engagement
Browse Features: 3: John
Use Core Functionality: 4: John
section Retention
Revisit Application: 5: John
Invite Friends: 3: John
size: 2rem
`
);
cy.get('text').contains('User Journey Example').as('title');
cy.get('@title').then(($title) => {
expect($title).to.have.attr('fill', '#2900A5');
expect($title).to.have.attr('font-family', 'Times New Roman');
expect($title).to.have.attr('font-size', '5rem');
});
});
}); });

View File

@@ -62,7 +62,7 @@ describe('Kanban diagram', () => {
{} {}
); );
}); });
it('6: should handle assignments', () => { it('6: should handle assigments', () => {
imgSnapshotTest( imgSnapshotTest(
`kanban `kanban
id1[Todo] id1[Todo]
@@ -118,7 +118,7 @@ kanban
docs[Create Documentation] docs[Create Documentation]
docs[Create Blog about the new diagram] docs[Create Blog about the new diagram]
id7[In progress] id7[In progress]
id6[Create renderer so that it works in all cases. We also add some extra text here for testing purposes. And some more just for the extra flare.] id6[Create renderer so that it works in all cases. We also add som extra text here for testing purposes. And some more just for the extra flare.]
id8[Design grammar]@{ assigned: 'knsv' } id8[Design grammar]@{ assigned: 'knsv' }
id9[Ready for deploy] id9[Ready for deploy]
id10[Ready for test] id10[Ready for test]

View File

@@ -146,7 +146,7 @@ root
shouldHaveRoot shouldHaveRoot
); );
}); });
it('text should wrap with icon', () => { it('text shouhld wrap with icon', () => {
imgSnapshotTest( imgSnapshotTest(
`mindmap `mindmap
root root

View File

@@ -1,7 +1,7 @@
import { imgSnapshotTest } from '../../helpers/util'; import { imgSnapshotTest } from '../../helpers/util';
describe('packet structure', () => { describe('packet structure', () => {
it('should render a simple packet-beta diagram', () => { it('should render a simple packet diagram', () => {
imgSnapshotTest( imgSnapshotTest(
`packet-beta `packet-beta
title Hello world title Hello world
@@ -10,18 +10,9 @@ describe('packet structure', () => {
); );
}); });
it('should render a simple packet diagram', () => {
imgSnapshotTest(
`packet
title Hello world
0-10: "hello"
`
);
});
it('should render a simple packet diagram without ranges', () => { it('should render a simple packet diagram without ranges', () => {
imgSnapshotTest( imgSnapshotTest(
`packet `packet-beta
0: "h" 0: "h"
1: "i" 1: "i"
` `
@@ -30,7 +21,7 @@ describe('packet structure', () => {
it('should render a complex packet diagram', () => { it('should render a complex packet diagram', () => {
imgSnapshotTest( imgSnapshotTest(
`packet `packet-beta
0-15: "Source Port" 0-15: "Source Port"
16-31: "Destination Port" 16-31: "Destination Port"
32-63: "Sequence Number" 32-63: "Sequence Number"
@@ -61,7 +52,7 @@ describe('packet structure', () => {
packet: packet:
showBits: false showBits: false
--- ---
packet packet-beta
0-15: "Source Port" 0-15: "Source Port"
16-31: "Destination Port" 16-31: "Destination Port"
32-63: "Sequence Number" 32-63: "Sequence Number"

View File

@@ -64,7 +64,7 @@ describe('pie chart', () => {
}); });
}); });
it('should render a pie diagram when textPosition is set', () => { it('should render a pie diagram when textPosition is setted', () => {
imgSnapshotTest( imgSnapshotTest(
`pie `pie
"Dogs": 50 "Dogs": 50

View File

@@ -45,7 +45,7 @@ describe('Quadrant Chart', () => {
{} {}
); );
}); });
it('should able to render y-axis on right side', () => { it('should able to render y-axix on right side', () => {
imgSnapshotTest( imgSnapshotTest(
` `
%%{init: {"quadrantChart": {"yAxisPosition": "right"}}}%% %%{init: {"quadrantChart": {"yAxisPosition": "right"}}}%%
@@ -61,7 +61,7 @@ describe('Quadrant Chart', () => {
{} {}
); );
}); });
it('should able to render x-axis on bottom', () => { it('should able to render x-axix on bottom', () => {
imgSnapshotTest( imgSnapshotTest(
` `
%%{init: {"quadrantChart": {"xAxisPosition": "bottom"}}}%% %%{init: {"quadrantChart": {"xAxisPosition": "bottom"}}}%%
@@ -77,7 +77,7 @@ describe('Quadrant Chart', () => {
{} {}
); );
}); });
it('should able to render x-axis on bottom and y-axis on right', () => { it('should able to render x-axix on bottom and y-axis on right', () => {
imgSnapshotTest( imgSnapshotTest(
` `
%%{init: {"quadrantChart": {"xAxisPosition": "bottom", "yAxisPosition": "right"}}}%% %%{init: {"quadrantChart": {"xAxisPosition": "bottom", "yAxisPosition": "right"}}}%%

View File

@@ -1,79 +0,0 @@
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' } } }
);
});
});

View File

@@ -138,8 +138,8 @@ describe('State diagram', () => {
imgSnapshotTest( imgSnapshotTest(
` `
stateDiagram-v2 stateDiagram-v2
State1: This a single line description State1: This a a single line description
State2: This a multi line description State2: This a a multi line description
State2: here comes the multi part State2: here comes the multi part
[*] --> State1 [*] --> State1
State1 --> State2 State1 --> State2
@@ -345,7 +345,7 @@ stateDiagram
} }
); );
}); });
it('v2 width of compound state should grow with title if title is wider', () => { it('v2 width of compond state should grow with title if title is wider', () => {
imgSnapshotTest( imgSnapshotTest(
` `
stateDiagram-v2 stateDiagram-v2
@@ -402,8 +402,8 @@ stateDiagram-v2
` `
stateDiagram-v2 stateDiagram-v2
MyState MyState
note left of MyState : I am a lefty note left of MyState : I am a leftie
note right of MyState : I am a righty note right of MyState : I am a rightie
`, `,
{ {
logLevel: 0, logLevel: 0,
@@ -552,7 +552,7 @@ style AState fill:#636,border:1px solid red,color:white;
{ logLevel: 0, fontFamily: 'courier' } { logLevel: 0, fontFamily: 'courier' }
); );
}); });
it(' should let styles take precedence over classes', () => { it(' should let styles take preceedence over classes', () => {
imgSnapshotTest( imgSnapshotTest(
` `
stateDiagram-v2 stateDiagram-v2
@@ -565,7 +565,7 @@ style AState fill:#636,border:1px solid red,color:white;
{ logLevel: 0, fontFamily: 'courier' } { logLevel: 0, fontFamily: 'courier' }
); );
}); });
it(' should allow styles to take effect in subgraphs', () => { it(' should allow styles to take effect in stubgraphs', () => {
imgSnapshotTest( imgSnapshotTest(
` `
stateDiagram stateDiagram

View File

@@ -129,8 +129,8 @@ describe('State diagram', () => {
imgSnapshotTest( imgSnapshotTest(
` `
stateDiagram stateDiagram
State1: This a single line description State1: This a a single line description
State2: This a multi line description State2: This a a multi line description
State2: here comes the multi part State2: here comes the multi part
[*] --> State1 [*] --> State1
State1 --> State2 State1 --> State2

View File

@@ -7,7 +7,7 @@ describe('Timeline diagram', () => {
title History of Social Media Platform title History of Social Media Platform
2002 : LinkedIn 2002 : LinkedIn
2004 : Facebook : Google 2004 : Facebook : Google
2005 : YouTube 2005 : Youtube
2006 : Twitter 2006 : Twitter
`, `,
{} {}
@@ -35,7 +35,7 @@ describe('Timeline diagram', () => {
section Stone Age section Stone Age
7600 BC : Britain's oldest known house was built in Orkney, Scotland 7600 BC : Britain's oldest known house was built in Orkney, Scotland
6000 BC : Sea levels rise and Britain becomes an island.<br> The people who live here are hunter-gatherers. 6000 BC : Sea levels rise and Britain becomes an island.<br> The people who live here are hunter-gatherers.
section Bronze Age section Broze Age
2300 BC : People arrive from Europe and settle in Britain. <br>They bring farming and metalworking. 2300 BC : People arrive from Europe and settle in Britain. <br>They bring farming and metalworking.
: New styles of pottery and ways of burying the dead appear. : New styles of pottery and ways of burying the dead appear.
2200 BC : The last major building works are completed at Stonehenge.<br> People now bury their dead in stone circles. 2200 BC : The last major building works are completed at Stonehenge.<br> People now bury their dead in stone circles.
@@ -51,7 +51,7 @@ describe('Timeline diagram', () => {
title History of Social Media Platform title History of Social Media Platform
2002 : LinkedIn 2002 : LinkedIn
2004 : Facebook : Google 2004 : Facebook : Google
2005 : YouTube 2005 : Youtube
2006 : Twitter 2006 : Twitter
`, `,
{} {}
@@ -68,7 +68,7 @@ describe('Timeline diagram', () => {
title History of Social Media Platform title History of Social Media Platform
2002 : LinkedIn 2002 : LinkedIn
2004 : Facebook : Google 2004 : Facebook : Google
2005 : YouTube 2005 : Youtube
2006 : Twitter 2006 : Twitter
2007 : Tumblr 2007 : Tumblr
2008 : Instagram 2008 : Instagram
@@ -84,7 +84,7 @@ describe('Timeline diagram', () => {
title History of Social Media Platform title History of Social Media Platform
2002 : LinkedIn 2002 : LinkedIn
2004 : Facebook : Google 2004 : Facebook : Google
2005 : YouTube 2005 : Youtube
2006 : Twitter 2006 : Twitter
2007 : Tumblr 2007 : Tumblr
2008 : Instagram 2008 : Instagram
@@ -101,7 +101,7 @@ describe('Timeline diagram', () => {
title History of Social Media Platform title History of Social Media Platform
2002 : LinkedIn 2002 : LinkedIn
2004 : Facebook : Google 2004 : Facebook : Google
2005 : YouTube 2005 : Youtube
2006 : Twitter 2006 : Twitter
2007 : Tumblr 2007 : Tumblr
2008 : Instagram 2008 : Instagram
@@ -118,7 +118,7 @@ describe('Timeline diagram', () => {
title History of Social Media Platform title History of Social Media Platform
2002 : LinkedIn 2002 : LinkedIn
2004 : Facebook : Google 2004 : Facebook : Google
2005 : YouTube 2005 : Youtube
2006 : Twitter 2006 : Twitter
2007 : Tumblr 2007 : Tumblr
2008 : Instagram 2008 : Instagram
@@ -135,7 +135,7 @@ describe('Timeline diagram', () => {
title History of Social Media Platform title History of Social Media Platform
2002 : LinkedIn 2002 : LinkedIn
2004 : Facebook : Google 2004 : Facebook : Google
2005 : YouTube 2005 : Youtube
2006 : Twitter 2006 : Twitter
2007 : Tumblr 2007 : Tumblr
2008 : Instagram 2008 : Instagram
@@ -152,7 +152,7 @@ describe('Timeline diagram', () => {
title History of Social Media Platform title History of Social Media Platform
2002 : LinkedIn 2002 : LinkedIn
2004 : Facebook : Google 2004 : Facebook : Google
2005 : YouTube 2005 : Youtube
2006 : Twitter 2006 : Twitter
2007 : Tumblr 2007 : Tumblr
2008 : Instagram 2008 : Instagram
@@ -161,68 +161,4 @@ describe('Timeline diagram', () => {
{} {}
); );
}); });
it('11: should render timeline with many stacked events and proper timeline line length', () => {
imgSnapshotTest(
`timeline
title Medical Device Lifecycle
section Pre-Development
Quality Management System : Regulatory Compliance : Risk Management
section Development
Management Responsibility : Planning Activities : Human Resources
Resource Management : Management Reviews : Infrastructure
section Post-Development
Product Realization Activities : Planning Activities : Customer-related Processes
Post-Production Activities : Feedback : Complaints : Adverse Events
: Research and Development : Purchasing Activities
: Production Activities : Installation Activities
: Servicing Activities : Post-Market Surveillance
`,
{}
);
});
it('12: should render timeline with proper vertical line lengths for all columns', () => {
imgSnapshotTest(
`---
config:
theme: base
themeVariables:
fontFamily: Fira Sans
fontSize: 17px
cScale0: '#b3cde0'
cScale1: '#f49090'
cScale2: '#85d5b8'
---
timeline
title Medical Device Lifecycle
section Planning
Quality Management System (4): Regulatory Compliance (4.1.1)
: Risk Management (4.1.2)
Management Resposibility (5): Planning Activities (5.4)
: Management Reviews (5.6)
Resource Management (6): Human Resources (6.2)
: Infrastructure (6.3)
section Realization
Research and Development (7.3): RnD Planning (7.3.2)
: Inputs (7.3.3)
: Outputs (7.3.4)
: Review (7.3.5)
: Verification (7.3.6)
: Validation (7.3.7)
Purchasing (7.4): Purchasing Process (7.4.1)
: Purchasing Information (7.4.2)
Production (7.5): Production Activities (7.5.1)
: Production Feedback (8.2.1)
Installation (7.5.3): Installation Activities (7.5.3)
Servicing (7.5.4): Servicing Activities (7.5.4)
section Post-Production
Post-Market Activities (8): Feedback (8.2.1)
: Complaints (8.2.2)
: Adverse Events (8.2.3)
`,
{}
);
});
}); });

View File

@@ -1,382 +0,0 @@
import { imgSnapshotTest } from '../../helpers/util.ts';
describe('Treemap Diagram', () => {
it('1: should render a basic treemap', () => {
imgSnapshotTest(
`treemap-beta
"Category A"
"Item A1": 10
"Item A2": 20
"Category B"
"Item B1": 15
"Item B2": 25
`,
{}
);
});
it('2: should render a hierarchical treemap', () => {
imgSnapshotTest(
`treemap-beta
"Products"
"Electronics"
"Phones": 50
"Computers": 30
"Accessories": 20
"Clothing"
"Men's"
"Shirts": 10
"Pants": 15
"Women's"
"Dresses": 20
"Skirts": 10
`,
{}
);
});
it('3: should render a treemap with styling using classDef', () => {
imgSnapshotTest(
`treemap-beta
"Section 1"
"Leaf 1.1": 12
"Section 1.2":::class1
"Leaf 1.2.1": 12
"Section 2"
"Leaf 2.1": 20:::class1
"Leaf 2.2": 25
"Leaf 2.3": 12
classDef class1 fill:red,color:blue,stroke:#FFD600;
`,
{}
);
});
it('4: should handle long text that wraps', () => {
imgSnapshotTest(
`treemap-beta
"Main Category"
"This is a very long item name that should wrap to the next line when rendered in the treemap diagram": 50
"Short item": 20
`,
{}
);
});
it('5: should render with a forest theme', () => {
imgSnapshotTest(
`---
config:
theme: forest
---
treemap-beta
"Category A"
"Item A1": 10
"Item A2": 20
"Category B"
"Item B1": 15
"Item B2": 25
`,
{}
);
});
it('6: should handle multiple levels of nesting', () => {
imgSnapshotTest(
`treemap-beta
"Level 1"
"Level 2A"
"Level 3A": 10
"Level 3B": 15
"Level 2B"
"Level 3C": 20
"Level 3D"
"Level 4A": 5
"Level 4B": 5
`,
{}
);
});
it('7: should handle classDef with multiple styles', () => {
imgSnapshotTest(
`treemap-beta
"Main"
"A": 20
"B":::important
"B1": 10
"B2": 15
"C": 5:::secondary
classDef important fill:#f96,stroke:#333,stroke-width:2px;
classDef secondary fill:#6cf,stroke:#333,stroke-dasharray:5 5;
`,
{}
);
});
it('8: should handle dollar value formatting with thousands separator', () => {
imgSnapshotTest(
`---
config:
treemap:
valueFormat: "$0,0"
---
treemap
"Budget"
"Operations"
"Salaries": 700000
"Equipment": 200000
"Supplies": 100000
"Marketing"
"Advertising": 400000
"Events": 100000
`,
{}
);
});
it('8a: should handle percentage formatting', () => {
imgSnapshotTest(
`---
config:
treemap:
valueFormat: ".1%"
---
treemap-beta
"Market Share"
"Company A": 0.35
"Company B": 0.25
"Company C": 0.15
"Others": 0.25
`,
{}
);
});
it('8b: should handle decimal formatting', () => {
imgSnapshotTest(
`---
config:
treemap:
valueFormat: ".2f"
---
treemap-beta
"Metrics"
"Conversion Rate": 0.0567
"Bounce Rate": 0.6723
"Click-through Rate": 0.1289
"Engagement": 0.4521
`,
{}
);
});
it('8c: should handle dollar sign with decimal places', () => {
imgSnapshotTest(
`---
config:
treemap:
valueFormat: "$.2f"
---
treemap-beta
"Product Prices"
"Basic": 19.99
"Standard": 49.99
"Premium": 99.99
"Enterprise": 199.99
`,
{}
);
});
it('8d: should handle dollar sign with thousands separator and decimal places', () => {
imgSnapshotTest(
`---
config:
treemap:
valueFormat: "$,.2f"
---
treemap-beta
"Revenue"
"Q1": 1250345.75
"Q2": 1645789.25
"Q3": 1845123.50
"Q4": 2145678.75
`,
{}
);
});
it('8e: should handle simple thousands separator', () => {
imgSnapshotTest(
`---
config:
treemap:
valueFormat: ","
---
treemap-beta
"User Counts"
"Active Users": 1250345
"New Signups": 45789
"Churned": 12350
"Converted": 78975
`,
{}
);
});
it('8f: should handle valueFormat set via directive with dollar and thousands separator', () => {
imgSnapshotTest(
`---
config:
treemap:
valueFormat: "$,.0f"
---
treemap-beta
"Sales by Region"
"North": 1234567
"South": 7654321
"East": 4567890
"West": 9876543
`,
{}
);
});
it('8g: should handle scientific notation format', () => {
imgSnapshotTest(
`---
config:
treemap:
valueFormat: ".2e"
---
treemap-beta
"Scientific Values"
"Value 1": 1234567
"Value 2": 0.0000123
"Value 3": 1000000000
`,
{}
);
});
it('9: should handle a complex example with multiple features', () => {
imgSnapshotTest(
`---
config:
theme: dark
treemap:
valueFormat: "$0,0"
---
treemap-beta
"Company Budget"
"Engineering":::engineering
"Frontend": 300000
"Backend": 400000
"DevOps": 200000
"Marketing":::marketing
"Digital": 250000
"Print": 100000
"Events": 150000
"Sales":::sales
"Direct": 500000
"Channel": 300000
classDef engineering fill:#6b9bc3,stroke:#333;
classDef marketing fill:#c36b9b,stroke:#333;
classDef sales fill:#c3a66b,stroke:#333;
`,
{}
);
});
it('10: should render the example from documentation', () => {
imgSnapshotTest(
`
treemap-beta
"Section 1"
"Leaf 1.1": 12
"Section 1.2":::class1
"Leaf 1.2.1": 12
"Section 2"
"Leaf 2.1": 20:::class1
"Leaf 2.2": 25
"Leaf 2.3": 12
classDef class1 fill:red,color:blue,stroke:#FFD600;
`,
{}
);
});
it('11: should handle comments', () => {
imgSnapshotTest(
`
treemap-beta
%% This is a comment
"Category A"
"Item A1": 10
"Item A2": 20
%% Another comment
"Category B"
"Item B1": 15
"Item B2": 25
`,
{}
);
});
/*
it.skip('12: should render a treemap with title', () => {
imgSnapshotTest(
`
treemap-beta
title Treemap with Title
"Category A"
"Item A1": 10
"Item A2": 20
"Category B"
"Item B1": 15
"Item B2": 25
`,
{}
);
});
it.skip('13: should render a treemap with accessibility attributes', () => {
imgSnapshotTest(
`
treemap-beta
accTitle: Accessible Treemap Title
accDescr: This is a description of the treemap for accessibility purposes
"Category A"
"Item A1": 10
"Item A2": 20
"Category B"
"Item B1": 15
"Item B2": 25
`,
{}
);
});
it.skip('14: should render a treemap with title and accessibility attributes', () => {
imgSnapshotTest(
`
treemap
title Treemap with Title and Accessibility
accTitle: Accessible Treemap Title
accDescr: This is a description of the treemap for accessibility purposes
"Category A"
"Item A1": 10
"Item A2": 20
"Category B"
"Item B1": 15
"Item B2": 25
`,
{}
);
});
*/
});

View File

@@ -179,7 +179,6 @@ describe('XY Chart', () => {
axisLineWidth: 5 axisLineWidth: 5
chartOrientation: horizontal chartOrientation: horizontal
plotReservedSpacePercent: 60 plotReservedSpacePercent: 60
showDataLabel: true
--- ---
xychart-beta xychart-beta
title "Sales Revenue" title "Sales Revenue"
@@ -316,516 +315,4 @@ describe('XY Chart', () => {
); );
cy.get('svg'); cy.get('svg');
}); });
it('should render vertical bar chart with labels', () => {
imgSnapshotTest(
`
---
config:
xyChart:
showDataLabel: true
---
xychart-beta
title "Sales Revenue"
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
y-axis "Revenue (in $)" 4000 --> 11000
bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]
`,
{}
);
});
it('should render horizontal bar chart with labels', () => {
imgSnapshotTest(
`
---
config:
xyChart:
showDataLabel: true
chartOrientation: horizontal
---
xychart-beta
title "Sales Revenue"
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
y-axis "Revenue (in $)" 4000 --> 11000
bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]
`,
{}
);
});
it('should render vertical bar chart without labels by default', () => {
imgSnapshotTest(
`
xychart-beta
title "Sales Revenue"
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
y-axis "Revenue (in $)" 4000 --> 11000
bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]
`,
{}
);
});
it('should render horizontal bar chart without labels by default', () => {
imgSnapshotTest(
`
---
config:
xyChart:
chartOrientation: horizontal
---
xychart-beta
title "Sales Revenue"
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
y-axis "Revenue (in $)" 4000 --> 11000
bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]
`,
{}
);
});
it('should render multiple bar plots vertically with labels correctly', () => {
imgSnapshotTest(
`
---
config:
xyChart:
showDataLabel: true
---
xychart-beta
title "Multiple Bar Plots"
x-axis Categories [A, B, C]
y-axis "Values" 0 --> 100
bar [10, 50, 90]
`,
{}
);
});
it('should render multiple bar plots horizontally with labels correctly', () => {
imgSnapshotTest(
`
---
config:
xyChart:
showDataLabel: true
chartOrientation: horizontal
---
xychart-beta
title "Multiple Bar Plots"
x-axis Categories [A, B, C]
y-axis "Values" 0 --> 100
bar [10, 50, 90]
`,
{}
);
});
it('should render a single bar with label for a vertical xy-chart', () => {
imgSnapshotTest(
`
---
config:
xyChart:
showDataLabel: true
---
xychart-beta
title "Single Bar Chart"
x-axis Categories [A]
y-axis "Value" 0 --> 100
bar [75]
`,
{}
);
});
it('should render a single bar with label for a horizontal xy-chart', () => {
imgSnapshotTest(
`
---
config:
xyChart:
showDataLabel: true
chartOrientation: horizontal
---
xychart-beta
title "Single Bar Chart"
x-axis Categories [A]
y-axis "Value" 0 --> 100
bar [75]
`,
{}
);
});
it('should render negative and decimal values with correct labels for vertical xy-chart', () => {
imgSnapshotTest(
`
---
config:
xyChart:
showDataLabel: true
---
xychart-beta
title "Decimal and Negative Values"
x-axis Categories [A, B, C]
y-axis -10 --> 10
bar [ -2.5, 0.75, 5.1 ]
`,
{}
);
});
it('should render negative and decimal values with correct labels for horizontal xy-chart', () => {
imgSnapshotTest(
`
---
config:
xyChart:
showDataLabel: true
chartOrientation: horizontal
---
xychart-beta
title "Decimal and Negative Values"
x-axis Categories [A, B, C]
y-axis -10 --> 10
bar [ -2.5, 0.75, 5.1 ]
`,
{}
);
});
it('should render data labels within each bar in the vertical xy-chart', () => {
imgSnapshotTest(
`
---
config:
xyChart:
showDataLabel: true
---
xychart-beta
title "Sales Revenue"
x-axis Months [jan,b,c]
y-axis "Revenue (in $)" 4000 --> 12000
bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000, 3000, 2000, 500, 2000, 3000, 11000, 5000, 6000]
`,
{}
);
cy.get('g.bar-plot-0').within(() => {
cy.get('rect').each(($rect, index) => {
// Extract bar properties
const barProps = {
x: parseFloat($rect.attr('x')),
y: parseFloat($rect.attr('y')),
width: parseFloat($rect.attr('width')),
height: parseFloat($rect.attr('height')),
};
// Get the text element corresponding to this bar by index.
cy.get('text')
.eq(index)
.then(($text) => {
const bbox = $text[0].getBBox();
const textProps = {
x: bbox.x,
y: bbox.y,
width: bbox.width,
height: bbox.height,
};
// Verify that the text label is positioned within the boundaries of the bar.
expect(textProps.x).to.be.greaterThan(barProps.x);
expect(textProps.x + textProps.width).to.be.lessThan(barProps.x + barProps.width);
// Check horizontal alignment (within tolerance)
expect(textProps.x + textProps.width / 2).to.be.closeTo(
barProps.x + barProps.width / 2,
5
);
expect(textProps.y).to.be.greaterThan(barProps.y);
expect(textProps.y + textProps.height).to.be.lessThan(barProps.y + barProps.height);
});
});
});
});
it('should render data labels within each bar in the horizontal xy-chart', () => {
imgSnapshotTest(
`
---
config:
xyChart:
showDataLabel: true
chartOrientation: horizontal
---
xychart-beta
title "Sales Revenue"
x-axis Months [jan,b,c]
y-axis "Revenue (in $)" 4000 --> 12000
bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000, 3000, 2000, 500, 2000, 3000, 11000, 5000, 6000]
`,
{}
);
cy.get('g.bar-plot-0').within(() => {
cy.get('rect').each(($rect, index) => {
// Extract bar properties
const barProps = {
x: parseFloat($rect.attr('x')),
y: parseFloat($rect.attr('y')),
width: parseFloat($rect.attr('width')),
height: parseFloat($rect.attr('height')),
};
// Get the text element corresponding to this bar by index.
cy.get('text')
.eq(index)
.then(($text) => {
const bbox = $text[0].getBBox();
const textProps = {
x: bbox.x,
y: bbox.y,
width: bbox.width,
height: bbox.height,
};
// Verify that the text label is positioned within the boundaries of the bar.
expect(textProps.x).to.be.greaterThan(barProps.x);
expect(textProps.x + textProps.width).to.be.lessThan(barProps.x + barProps.width);
expect(textProps.y).to.be.greaterThan(barProps.y);
expect(textProps.y + textProps.height).to.be.lessThan(barProps.y + barProps.height);
expect(textProps.y + textProps.height / 2).to.be.closeTo(
barProps.y + barProps.height / 2,
5
);
});
});
});
});
it('should render data labels within each bar in the vertical xy-chart with a lot of bars of different sizes', () => {
imgSnapshotTest(
`
---
config:
xyChart:
showDataLabel: true
---
xychart-beta
title "Sales Revenue"
x-axis Months [jan,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s]
y-axis "Revenue (in $)" 4000 --> 12000
bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000, 8000, 10000, 5000, 7600, 4999,11000 ,5000,6000]
`,
{}
);
cy.get('g.bar-plot-0').within(() => {
cy.get('rect').each(($rect, index) => {
// Extract bar properties
const barProps = {
x: parseFloat($rect.attr('x')),
y: parseFloat($rect.attr('y')),
width: parseFloat($rect.attr('width')),
height: parseFloat($rect.attr('height')),
};
// Get the text element corresponding to this bar by index.
cy.get('text')
.eq(index)
.then(($text) => {
const bbox = $text[0].getBBox();
const textProps = {
x: bbox.x,
y: bbox.y,
width: bbox.width,
height: bbox.height,
};
// Verify that the text label is positioned within the boundaries of the bar.
expect(textProps.x).to.be.greaterThan(barProps.x);
expect(textProps.x + textProps.width).to.be.lessThan(barProps.x + barProps.width);
// Check horizontal alignment (within tolerance)
expect(textProps.x + textProps.width / 2).to.be.closeTo(
barProps.x + barProps.width / 2,
5
);
expect(textProps.y).to.be.greaterThan(barProps.y);
expect(textProps.y + textProps.height).to.be.lessThan(barProps.y + barProps.height);
});
});
});
});
it('should render data labels within each bar in the horizontal xy-chart with a lot of bars of different sizes', () => {
imgSnapshotTest(
`
---
config:
xyChart:
showDataLabel: true
chartOrientation: horizontal
---
xychart-beta
title "Sales Revenue"
x-axis Months [jan,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s]
y-axis "Revenue (in $)" 4000 --> 12000
bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000, 8000, 10000, 5000, 7600, 4999,11000 ,5000,6000]
`,
{}
);
cy.get('g.bar-plot-0').within(() => {
cy.get('rect').each(($rect, index) => {
// Extract bar properties
const barProps = {
x: parseFloat($rect.attr('x')),
y: parseFloat($rect.attr('y')),
width: parseFloat($rect.attr('width')),
height: parseFloat($rect.attr('height')),
};
// Get the text element corresponding to this bar by index.
cy.get('text')
.eq(index)
.then(($text) => {
const bbox = $text[0].getBBox();
const textProps = {
x: bbox.x,
y: bbox.y,
width: bbox.width,
height: bbox.height,
};
// Verify that the text label is positioned within the boundaries of the bar.
expect(textProps.x).to.be.greaterThan(barProps.x);
expect(textProps.x + textProps.width).to.be.lessThan(barProps.x + barProps.width);
expect(textProps.y).to.be.greaterThan(barProps.y);
expect(textProps.y + textProps.height).to.be.lessThan(barProps.y + barProps.height);
expect(textProps.y + textProps.height / 2).to.be.closeTo(
barProps.y + barProps.height / 2,
5
);
});
});
});
});
it('should render data labels correctly for a bar in the vertical xy-chart', () => {
imgSnapshotTest(
`
---
config:
xyChart:
showDataLabel: true
---
xychart-beta
title "Sales Revenue"
x-axis Months [jan]
y-axis "Revenue (in $)" 3000 --> 12000
bar [4000]
`,
{}
);
cy.get('g.bar-plot-0').within(() => {
cy.get('rect').each(($rect, index) => {
// Extract bar properties
const barProps = {
x: parseFloat($rect.attr('x')),
y: parseFloat($rect.attr('y')),
width: parseFloat($rect.attr('width')),
height: parseFloat($rect.attr('height')),
};
// Get the text element corresponding to this bar by index.
cy.get('text')
.eq(index)
.then(($text) => {
const bbox = $text[0].getBBox();
const textProps = {
x: bbox.x,
y: bbox.y,
width: bbox.width,
height: bbox.height,
};
// Verify that the text label is positioned within the boundaries of the bar.
expect(textProps.x).to.be.greaterThan(barProps.x);
expect(textProps.x + textProps.width).to.be.lessThan(barProps.x + barProps.width);
// Check horizontal alignment (within tolerance)
expect(textProps.x + textProps.width / 2).to.be.closeTo(
barProps.x + barProps.width / 2,
5
);
expect(textProps.y).to.be.greaterThan(barProps.y);
expect(textProps.y + textProps.height).to.be.lessThan(barProps.y + barProps.height);
});
});
});
});
it('should render data labels correctly for a bar in the horizontal xy-chart', () => {
imgSnapshotTest(
`
---
config:
xyChart:
showDataLabel: true
chartOrientation: horizontal
---
xychart-beta
title "Sales Revenue"
x-axis Months [jan]
y-axis "Revenue (in $)" 3000 --> 12000
bar [4000]
`,
{}
);
cy.get('g.bar-plot-0').within(() => {
cy.get('rect').each(($rect, index) => {
// Extract bar properties
const barProps = {
x: parseFloat($rect.attr('x')),
y: parseFloat($rect.attr('y')),
width: parseFloat($rect.attr('width')),
height: parseFloat($rect.attr('height')),
};
// Get the text element corresponding to this bar by index.
cy.get('text')
.eq(index)
.then(($text) => {
const bbox = $text[0].getBBox();
const textProps = {
x: bbox.x,
y: bbox.y,
width: bbox.width,
height: bbox.height,
};
// Verify that the text label is positioned within the boundaries of the bar.
expect(textProps.x).to.be.greaterThan(barProps.x);
expect(textProps.x + textProps.width).to.be.lessThan(barProps.x + barProps.width);
expect(textProps.y).to.be.greaterThan(barProps.y);
expect(textProps.y + textProps.height).to.be.lessThan(barProps.y + barProps.height);
expect(textProps.y + textProps.height / 2).to.be.closeTo(
barProps.y + barProps.height / 2,
5
);
});
});
});
});
}); });

View File

@@ -60,7 +60,7 @@
<pre id="diagram" class="mermaid2"> <pre id="diagram" class="mermaid2">
timeline timeline
title My day title My day
section Section with no tasks section section with no tasks
section Go to work at the dog office section Go to work at the dog office
1930 : first step : second step is a long step 1930 : first step : second step is a long step
: third step : third step
@@ -70,18 +70,18 @@
1960 : India fights poverty, looses war to China and gets nuclear weapons from USA and USSR 1960 : India fights poverty, looses war to China and gets nuclear weapons from USA and USSR
1970 : Green Revolution comes to india 1970 : Green Revolution comes to india
section Another section with no tasks section Another section with no tasks
I am a very, very big task I am a big big big tasks
I am not so big task I am not so big tasks
</pre> </pre>
<pre id="diagram" class="mermaid"> <pre id="diagram" class="mermaid">
timeline timeline
title MermaidChart 2023 Timeline title MermaidChart 2023 Timeline
section 2023 Q1 <br> Release Personal Tier section 2023 Q1 <br> Release Personal Tier
Bullet 1 : sub-point 1a : sub-point 1b Buttet 1 : sub-point 1a : sub-point 1b
: sub-point 1c : sub-point 1c
Bullet 2 : sub-point 2a : sub-point 2b Bullet 2 : sub-point 2a : sub-point 2b
section 2023 Q2 <br> Release XYZ Tier section 2023 Q2 <br> Release XYZ Tier
Bullet 3 : sub-point <br> 3a : sub-point 3b Buttet 3 : sub-point <br> 3a : sub-point 3b
: sub-point 3c : sub-point 3c
Bullet 4 : sub-point 4a : sub-point 4b Bullet 4 : sub-point 4a : sub-point 4b
@@ -93,7 +93,7 @@
section Stone Age section Stone Age
7600 BC : Britain's oldest known house was built in Orkney, Scotland 7600 BC : Britain's oldest known house was built in Orkney, Scotland
6000 BC : Sea levels rise and Britain becomes an island. The people who live here are hunter-gatherers. 6000 BC : Sea levels rise and Britain becomes an island. The people who live here are hunter-gatherers.
section Bronze Age section Broze Age
2300 BC : People arrive from Europe and settle in Britain. They bring farming and metalworking. 2300 BC : People arrive from Europe and settle in Britain. They bring farming and metalworking.
: New styles of pottery and ways of burying the dead appear. : New styles of pottery and ways of burying the dead appear.
2200 BC : The last major building works are completed at Stonehenge. People now bury their dead in stone circles. 2200 BC : The last major building works are completed at Stonehenge. People now bury their dead in stone circles.
@@ -106,7 +106,7 @@
title History of Social Media Platform title History of Social Media Platform
2002 : LinkedIn 2002 : LinkedIn
2004 : Facebook : Google : Pixar 2004 : Facebook : Google : Pixar
2005 : YouTube 2005 : Youtube
2006 : Twitter 2006 : Twitter
2007 : Tumblr 2007 : Tumblr
2008s : Instagram 2008s : Instagram
@@ -122,7 +122,7 @@
title History of Social Media Platform title History of Social Media Platform
2002 : LinkedIn 2002 : LinkedIn
2004 : Facebook : Google : Pixar 2004 : Facebook : Google : Pixar
2005 : YouTube 2005 : Youtube
2006 : Twitter 2006 : Twitter
2007 : Tumblr 2007 : Tumblr
2008s : Instagram 2008s : Instagram
@@ -139,7 +139,7 @@
title History of Social Media Platform title History of Social Media Platform
2002 : LinkedIn 2002 : LinkedIn
2004 : Facebook : Google 2004 : Facebook : Google
2005 : YouTube 2005 : Youtube
2006 : Twitter 2006 : Twitter
2007 : Tumblr 2007 : Tumblr
2008 : Instagram 2008 : Instagram
@@ -152,7 +152,7 @@
title History of Social Media Platform title History of Social Media Platform
2002 : LinkedIn 2002 : LinkedIn
2004 : Facebook : Google 2004 : Facebook : Google
2005 : YouTube 2005 : Youtube
2006 : Twitter 2006 : Twitter
2007 : Tumblr 2007 : Tumblr
2008s : Instagram 2008s : Instagram

View File

@@ -37,7 +37,7 @@
+String owner +String owner
+BigDecimal balance +BigDecimal balance
+deposit(amount) bool +deposit(amount) bool
+withdrawal(amount) int +withdrawl(amount) int
} }
cssClass "BankAccount" customCss cssClass "BankAccount" customCss
@@ -56,7 +56,7 @@ classE o-- classF : aggregation
+String owner +String owner
+BigDecimal balance +BigDecimal balance
+deposit(amount) bool +deposit(amount) bool
+withdrawal(amount) int +withdrawl(amount) int
} }
Class01~T~ <|-- AveryLongClass : Cool Class01~T~ <|-- AveryLongClass : Cool
Class03~T~ *-- Class04~T~ Class03~T~ *-- Class04~T~

View File

@@ -77,7 +77,7 @@
document.getElementsByTagName('body')[0].appendChild(div); document.getElementsByTagName('body')[0].appendChild(div);
} }
mermaid.initialize({ startOnLoad: true, securityLevel: 'strict_', logLevel: 1 }); mermaid.initialize({ startOnLoad: true, securityLevel: 'strct', logLevel: 1 });
</script> </script>
</body> </body>
</html> </html>

View File

@@ -31,7 +31,7 @@
flowchart BT subgraph S1 sub1 -->sub2 end subgraph S2 sub4 end S1 --> S2 sub1 --> sub4 flowchart BT subgraph S1 sub1 -->sub2 end subgraph S2 sub4 end S1 --> S2 sub1 --> sub4
</div> </div>
<div class="mermaid2" style="width: 50%; height: 200px"> <div class="mermaid2" style="width: 50%; height: 200px">
sequenceDiagram Alice->>Bob:Extremely utterly long line of longness which had previously sequenceDiagram Alice->>Bob:Extremely utterly long line of longness which had preivously
overflown the actor box as it is much longer than what it should be Bob->>Alice: I'm short overflown the actor box as it is much longer than what it should be Bob->>Alice: I'm short
though though
</div> </div>
@@ -61,9 +61,9 @@
#quot;elit#quot;."}} #quot;elit#quot;."}}
</div> </div>
<div class="mermaid2" style="width: 50%; height: 50%"> <div class="mermaid2" style="width: 50%; height: 50%">
flowchart TB internet nat router lb1 lb2 compute1 compute2 subgraph project router nat flowchart TB internet nat routeur lb1 lb2 compute1 compute2 subgraph project routeur nat
subgraph subnet1 compute1 lb1 end subgraph subnet2 compute2 lb2 end end internet --> router subgraph subnet1 compute1 lb1 end subgraph subnet2 compute2 lb2 end end internet --> routeur
router --> subnet1 & subnet2 subnet1 & subnet2 --> nat --> internet routeur --> subnet1 & subnet2 subnet1 & subnet2 --> nat --> internet
</div> </div>
<div class="mermaid2" style="width: 50%; height: 50%"> <div class="mermaid2" style="width: 50%; height: 50%">
flowchart TD subgraph one[One] subgraph sub_one[Sub One] _sub_one end end subgraph two[Two] flowchart TD subgraph one[One] subgraph sub_one[Sub One] _sub_one end end subgraph two[Two]

View File

@@ -7,7 +7,7 @@
rel="stylesheet" rel="stylesheet"
/> />
<style> <style>
svg:not(svg svg) { svg {
border: 2px solid darkred; border: 2px solid darkred;
} }
.exClass2 > rect, .exClass2 > rect,

View File

@@ -38,7 +38,7 @@
+String owner +String owner
+BigDecimal balance +BigDecimal balance
+deposit(amount) bool +deposit(amount) bool
+withdrawal(amount) int +withdrawl(amount) int
} }
cssClass "BankAccount" customCss cssClass "BankAccount" customCss
</pre> </pre>

View File

@@ -32,26 +32,8 @@
href="https://fonts.googleapis.com/css2?family=Kalam:wght@300;400;700&family=Rubik+Mono+One&display=swap" href="https://fonts.googleapis.com/css2?family=Kalam:wght@300;400;700&family=Rubik+Mono+One&display=swap"
rel="stylesheet" rel="stylesheet"
/> />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Recursive:wght@300..1000&display=swap"
rel="stylesheet"
/>
<style> <style>
.recursive-mermaid {
font-family: 'Recursive', sans-serif;
font-optical-sizing: auto;
font-weight: 500;
font-style: normal;
font-variation-settings:
'slnt' 0,
'CASL' 0,
'CRSV' 0.5,
'MONO' 0;
}
body { body {
/* background: rgb(221, 208, 208); */ /* background: rgb(221, 208, 208); */
/* background: #333; */ /* background: #333; */
@@ -63,9 +45,7 @@
h1 { h1 {
color: grey; color: grey;
} }
.mermaid {
border: 1px solid red;
}
.mermaid2 { .mermaid2 {
display: none; display: none;
} }
@@ -103,11 +83,6 @@
width: 100%; width: 100%;
} }
.class2 {
fill: red;
fill-opacity: 1;
}
/* tspan { /* tspan {
font-size: 6px !important; font-size: 6px !important;
} */ } */
@@ -131,63 +106,19 @@
<body> <body>
<pre id="diagram4" class="mermaid"> <pre id="diagram4" class="mermaid">
treemap
"Section 1"
"Leaf 1.1": 12
"Section 1.2":::class1
"Leaf 1.2.1": 12
"Section 2"
"Leaf 2.1": 20:::class1
"Leaf 2.2": 25
"Leaf 2.3": 12
classDef class1 fill:red,color:blue,stroke:#FFD600;
</pre
>
<pre id="diagram4" class="mermaid2">
---
config:
treemap:
valueFormat: '$0,0'
---
treemap
"Budget"
"Operations"
"Salaries": 7000
"Equipment": 2000
"Supplies": 1000
"Marketing"
"Advertising": 4000
"Events": 1000
</pre
>
<pre id="diagram4" class="mermaid">
treemap
title Accessible Treemap Title
"Category A"
"Item A1": 10
"Item A2": 20
"Category B"
"Item B1": 15
"Item B2": 25
</pre>
<pre id="diagram4" class="mermaid2">
flowchart LR flowchart LR
AB["apa@apa@"] --> B(("`apa@apa`")) AB["apa@apa@"] --> B(("`apa@apa`"))
</pre> </pre>
<pre id="diagram4" class="mermaid2"> <pre id="diagram4" class="mermaid">
flowchart flowchart
D(("for D")) D(("for D"))
</pre> </pre>
<pre id="diagram4" class="mermaid2"> <pre id="diagram4" class="mermaid">
flowchart LR flowchart LR
A e1@==> B A e1@==> B
e1@{ animate: true} e1@{ animate: true}
</pre> </pre>
<pre id="diagram4" class="mermaid2"> <pre id="diagram4" class="mermaid">
flowchart LR flowchart LR
A e1@--> B A e1@--> B
classDef animate stroke-width:2,stroke-dasharray:10\,8,stroke-dashoffset:-180,animation: edge-animation-frame 6s linear infinite, stroke-linecap: round classDef animate stroke-width:2,stroke-dasharray:10\,8,stroke-dashoffset:-180,animation: edge-animation-frame 6s linear infinite, stroke-linecap: round
@@ -455,7 +386,7 @@ kanban
[Create Documentation] [Create Documentation]
docs[Create Blog about the new diagram] docs[Create Blog about the new diagram]
id7[In progress] id7[In progress]
id6[Create renderer so that it works in all cases. We also add some extra text here for testing purposes. And some more just for the extra flare.] id6[Create renderer so that it works in all cases. We also add som extra text here for testing purposes. And some more just for the extra flare.]
id9[Ready for deploy] id9[Ready for deploy]
id8[Design grammar]@{ assigned: 'knsv' } id8[Design grammar]@{ assigned: 'knsv' }
id10[Ready for test] id10[Ready for test]
@@ -507,7 +438,7 @@ kanban
alert('It worked'); alert('It worked');
} }
await mermaid.initialize({ await mermaid.initialize({
// theme: 'forest', // theme: 'base',
// theme: 'default', // theme: 'default',
// theme: 'forest', // theme: 'forest',
// handDrawnSeed: 12, // handDrawnSeed: 12,
@@ -518,7 +449,11 @@ kanban
// layout: 'fixed', // layout: 'fixed',
// htmlLabels: false, // htmlLabels: false,
flowchart: { titleTopMargin: 10 }, flowchart: { titleTopMargin: 10 },
fontFamily: "'Recursive', sans-serif",
// fontFamily: 'Caveat',
// fontFamily: 'Kalam',
// fontFamily: 'courier',
fontFamily: 'arial',
sequence: { sequence: {
actorFontFamily: 'courier', actorFontFamily: 'courier',
noteFontFamily: 'courier', noteFontFamily: 'courier',

View File

@@ -14,28 +14,12 @@ function markRendered() {
} }
} }
function loadFontAwesomeCSS() {
const link = document.createElement('link');
link.rel = 'stylesheet';
link.href = 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css';
document.head.appendChild(link);
return new Promise((resolve, reject) => {
link.onload = resolve;
link.onerror = () => reject(new Error('Failed to load FontAwesome'));
});
}
/** /**
* ##contentLoaded Callback function that is called when page is loaded. This functions fetches * ##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 * configuration for mermaid rendering and calls init for rendering the mermaid diagrams on the
* page. * page.
*/ */
const contentLoaded = async function () { const contentLoaded = async function () {
await loadFontAwesomeCSS();
await Promise.all(Array.from(document.fonts, (font) => font.load()));
let pos = document.location.href.indexOf('?graph='); let pos = document.location.href.indexOf('?graph=');
if (pos > 0) { if (pos > 0) {
pos = pos + 7; pos = pos + 7;
@@ -66,13 +50,8 @@ const contentLoaded = async function () {
mermaid.registerLayoutLoaders(layouts); mermaid.registerLayoutLoaders(layouts);
mermaid.initialize(graphObj.mermaid); mermaid.initialize(graphObj.mermaid);
/**
* CC-BY-4.0
* Copyright (c) Fonticons, Inc. - https://fontawesome.com/license/free
* https://fontawesome.com/icons/bell?f=classic&s=regular
*/
const staticBellIconPack = { const staticBellIconPack = {
prefix: 'fa', prefix: 'fa6-regular',
icons: { icons: {
bell: { bell: {
body: '<path fill="currentColor" d="M224 0c-17.7 0-32 14.3-32 32v19.2C119 66 64 130.6 64 208v25.4c0 45.4-15.5 89.5-43.8 124.9L5.3 377c-5.8 7.2-6.9 17.1-2.9 25.4S14.8 416 24 416h400c9.2 0 17.6-5.3 21.6-13.6s2.9-18.2-2.9-25.4l-14.9-18.6c-28.3-35.5-43.8-79.6-43.8-125V208c0-77.4-55-142-128-156.8V32c0-17.7-14.3-32-32-32m0 96c61.9 0 112 50.1 112 112v25.4c0 47.9 13.9 94.6 39.7 134.6H72.3c25.8-40 39.7-86.7 39.7-134.6V208c0-61.9 50.1-112 112-112m64 352H160c0 17 6.7 33.3 18.7 45.3S207 512 224 512s33.3-6.7 45.3-18.7S288 465 288 448"/>', body: '<path fill="currentColor" d="M224 0c-17.7 0-32 14.3-32 32v19.2C119 66 64 130.6 64 208v25.4c0 45.4-15.5 89.5-43.8 124.9L5.3 377c-5.8 7.2-6.9 17.1-2.9 25.4S14.8 416 24 416h400c9.2 0 17.6-5.3 21.6-13.6s2.9-18.2-2.9-25.4l-14.9-18.6c-28.3-35.5-43.8-79.6-43.8-125V208c0-77.4-55-142-128-156.8V32c0-17.7-14.3-32-32-32m0 96c61.9 0 112 50.1 112 112v25.4c0 47.9 13.9 94.6 39.7 134.6H72.3c25.8-40 39.7-86.7 39.7-134.6V208c0-61.9 50.1-112 112-112m64 352H160c0 17 6.7 33.3 18.7 45.3S207 512 224 512s33.3-6.7 45.3-18.7S288 465 288 448"/>',

View File

@@ -105,7 +105,7 @@
let diagram = 'graph LR\n'; let diagram = 'graph LR\n';
diagram += " B(<a href='<"; diagram += " B(<a href='<";
diagram += 'script></'; diagram += 'script></';
diagram += "script>JavaScript:xssAttack`1`'>Click)"; diagram += "script>Javascript:xssAttack`1`'>Click)";
// diagram += "script\u003aalert\u0028document.domain\u0029\` src=x>\"\);\n"; // diagram += "script\u003aalert\u0028document.domain\u0029\` src=x>\"\);\n";
console.log(diagram); console.log(diagram);
// document.querySelector('#diagram').innerHTML = diagram; // document.querySelector('#diagram').innerHTML = diagram;

View File

@@ -50,7 +50,7 @@
setPoints(List~int~ points) setPoints(List~int~ points)
getPoints() List~int~ getPoints() List~int~
} }
Square : -List~string~ messages Square : -List~string~ messages
Square : +setMessages(List~string~ messages) Square : +setMessages(List~string~ messages)
Square : +getMessages() List~string~ Square : +getMessages() List~string~
@@ -88,7 +88,7 @@
--- ---
classDiagram classDiagram
class Duck { class Duck {
} }
</pre> </pre>
</div> </div>
@@ -127,8 +127,8 @@
-attribute:type -attribute:type
- attribute : type - attribute : type
test test
+ GetAttribute() type + GetAttribute() type
+ GetAttribute() type + GetAttribute() type
} }
</pre> </pre>
@@ -449,7 +449,7 @@
--- ---
config: config:
theme: forest theme: forest
look: handDrawn look: handDrawns
layout: elk layout: elk
--- ---
classDiagram classDiagram

View File

@@ -41,7 +41,7 @@
CAR:::someclass CAR:::someclass
PERSON:::anotherclass,someclass PERSON:::anotherclass,someclass
classDef someclass fill:#f96 classDef someclass fill:#f96
classDef anotherclass color:blue classDef anotherclass color:blue
</pre> </pre>
@@ -90,7 +90,7 @@
erDiagram erDiagram
CAR ||--o{ NAMED-DRIVER : allows CAR ||--o{ NAMED-DRIVER : allows
CAR { CAR {
text text PK "comment" test test PK "comment"
string make string make
string model string model
string[] parts string[] parts
@@ -108,7 +108,7 @@
string carRegistrationNumber PK, FK string carRegistrationNumber PK, FK
string driverLicence PK, FK string driverLicence PK, FK
} }
MANUFACTURER only one to zero or more CAR : makes MANUFACTURER only one to zero or more CAR : makes
</pre> </pre>
</div> </div>
<div class="test"> <div class="test">
@@ -129,7 +129,7 @@
string email string email
} }
p ||--o| a : has p ||--o| a : has
</pre> </pre>
</div> </div>
<div class="test"> <div class="test">

View File

@@ -2,219 +2,151 @@
"durations": [ "durations": [
{ {
"spec": "cypress/integration/other/configuration.spec.js", "spec": "cypress/integration/other/configuration.spec.js",
"duration": 5672 "duration": 4989
}, },
{ {
"spec": "cypress/integration/other/external-diagrams.spec.js", "spec": "cypress/integration/other/external-diagrams.spec.js",
"duration": 1990 "duration": 1382
}, },
{ {
"spec": "cypress/integration/other/ghsa.spec.js", "spec": "cypress/integration/other/ghsa.spec.js",
"duration": 3186 "duration": 3178
}, },
{ {
"spec": "cypress/integration/other/iife.spec.js", "spec": "cypress/integration/other/iife.spec.js",
"duration": 1948 "duration": 1372
}, },
{ {
"spec": "cypress/integration/other/interaction.spec.js", "spec": "cypress/integration/other/interaction.spec.js",
"duration": 11938 "duration": 8998
}, },
{ {
"spec": "cypress/integration/other/rerender.spec.js", "spec": "cypress/integration/other/rerender.spec.js",
"duration": 1932 "duration": 1249
}, },
{ {
"spec": "cypress/integration/other/xss.spec.js", "spec": "cypress/integration/other/xss.spec.js",
"duration": 27237 "duration": 25664
}, },
{ {
"spec": "cypress/integration/rendering/appli.spec.js", "spec": "cypress/integration/rendering/appli.spec.js",
"duration": 3170 "duration": 1928
}, },
{ {
"spec": "cypress/integration/rendering/architecture.spec.ts", "spec": "cypress/integration/rendering/architecture.spec.ts",
"duration": 104 "duration": 2330
}, },
{ {
"spec": "cypress/integration/rendering/block.spec.js", "spec": "cypress/integration/rendering/block.spec.js",
"duration": 17390 "duration": 11156
}, },
{ {
"spec": "cypress/integration/rendering/c4.spec.js", "spec": "cypress/integration/rendering/c4.spec.js",
"duration": 5296 "duration": 3418
},
{
"spec": "cypress/integration/rendering/classDiagram-elk-v3.spec.js",
"duration": 39004
},
{
"spec": "cypress/integration/rendering/classDiagram-handDrawn-v3.spec.js",
"duration": 37653
}, },
{ {
"spec": "cypress/integration/rendering/classDiagram-v2.spec.js", "spec": "cypress/integration/rendering/classDiagram-v2.spec.js",
"duration": 23278 "duration": 14866
},
{
"spec": "cypress/integration/rendering/classDiagram-v3.spec.js",
"duration": 36645
}, },
{ {
"spec": "cypress/integration/rendering/classDiagram.spec.js", "spec": "cypress/integration/rendering/classDiagram.spec.js",
"duration": 15418 "duration": 9894
}, },
{ {
"spec": "cypress/integration/rendering/conf-and-directives.spec.js", "spec": "cypress/integration/rendering/conf-and-directives.spec.js",
"duration": 9684 "duration": 5778
}, },
{ {
"spec": "cypress/integration/rendering/current.spec.js", "spec": "cypress/integration/rendering/current.spec.js",
"duration": 2570 "duration": 1690
},
{
"spec": "cypress/integration/rendering/erDiagram-unified.spec.js",
"duration": 84687
}, },
{ {
"spec": "cypress/integration/rendering/erDiagram.spec.js", "spec": "cypress/integration/rendering/erDiagram.spec.js",
"duration": 14819 "duration": 9144
}, },
{ {
"spec": "cypress/integration/rendering/errorDiagram.spec.js", "spec": "cypress/integration/rendering/errorDiagram.spec.js",
"duration": 3371 "duration": 1951
}, },
{ {
"spec": "cypress/integration/rendering/flowchart-elk.spec.js", "spec": "cypress/integration/rendering/flowchart-elk.spec.js",
"duration": 39925 "duration": 2196
}, },
{ {
"spec": "cypress/integration/rendering/flowchart-handDrawn.spec.js", "spec": "cypress/integration/rendering/flowchart-handDrawn.spec.js",
"duration": 34694 "duration": 21029
},
{
"spec": "cypress/integration/rendering/flowchart-icon.spec.js",
"duration": 7137
}, },
{ {
"spec": "cypress/integration/rendering/flowchart-shape-alias.spec.ts", "spec": "cypress/integration/rendering/flowchart-shape-alias.spec.ts",
"duration": 24740 "duration": 16087
}, },
{ {
"spec": "cypress/integration/rendering/flowchart-v2.spec.js", "spec": "cypress/integration/rendering/flowchart-v2.spec.js",
"duration": 42077 "duration": 27465
}, },
{ {
"spec": "cypress/integration/rendering/flowchart.spec.js", "spec": "cypress/integration/rendering/flowchart.spec.js",
"duration": 30642 "duration": 20035
}, },
{ {
"spec": "cypress/integration/rendering/gantt.spec.js", "spec": "cypress/integration/rendering/gantt.spec.js",
"duration": 18085 "duration": 11366
}, },
{ {
"spec": "cypress/integration/rendering/gitGraph.spec.js", "spec": "cypress/integration/rendering/gitGraph.spec.js",
"duration": 50107 "duration": 34025
}, },
{ {
"spec": "cypress/integration/rendering/iconShape.spec.ts", "spec": "cypress/integration/rendering/iconShape.spec.ts",
"duration": 276279 "duration": 185902
}, },
{ {
"spec": "cypress/integration/rendering/imageShape.spec.ts", "spec": "cypress/integration/rendering/imageShape.spec.ts",
"duration": 56505 "duration": 41631
}, },
{ {
"spec": "cypress/integration/rendering/info.spec.ts", "spec": "cypress/integration/rendering/info.spec.ts",
"duration": 3036 "duration": 1736
}, },
{ {
"spec": "cypress/integration/rendering/journey.spec.js", "spec": "cypress/integration/rendering/journey.spec.js",
"duration": 6889 "duration": 2247
},
{
"spec": "cypress/integration/rendering/kanban.spec.ts",
"duration": 7353
}, },
{ {
"spec": "cypress/integration/rendering/katex.spec.js", "spec": "cypress/integration/rendering/katex.spec.js",
"duration": 3580 "duration": 2144
}, },
{ {
"spec": "cypress/integration/rendering/marker_unique_id.spec.js", "spec": "cypress/integration/rendering/marker_unique_id.spec.js",
"duration": 2508 "duration": 1646
}, },
{ {
"spec": "cypress/integration/rendering/mindmap.spec.ts", "spec": "cypress/integration/rendering/mindmap.spec.ts",
"duration": 10939 "duration": 6406
}, },
{ {
"spec": "cypress/integration/rendering/newShapes.spec.ts", "spec": "cypress/integration/rendering/newShapes.spec.ts",
"duration": 149102 "duration": 107219
},
{
"spec": "cypress/integration/rendering/oldShapes.spec.ts",
"duration": 113987
},
{
"spec": "cypress/integration/rendering/packet.spec.ts",
"duration": 4060
},
{
"spec": "cypress/integration/rendering/pie.spec.ts",
"duration": 5715
},
{
"spec": "cypress/integration/rendering/quadrantChart.spec.js",
"duration": 8945
},
{
"spec": "cypress/integration/rendering/radar.spec.js",
"duration": 5337
},
{
"spec": "cypress/integration/rendering/requirement.spec.js",
"duration": 2643
},
{
"spec": "cypress/integration/rendering/requirementDiagram-unified.spec.js",
"duration": 52072
},
{
"spec": "cypress/integration/rendering/sankey.spec.ts",
"duration": 6692
},
{
"spec": "cypress/integration/rendering/sequencediagram.spec.js",
"duration": 35721
},
{
"spec": "cypress/integration/rendering/stateDiagram-v2.spec.js",
"duration": 26030
}, },
{ {
"spec": "cypress/integration/rendering/stateDiagram.spec.js", "spec": "cypress/integration/rendering/stateDiagram.spec.js",
"duration": 16333 "duration": 15834
}, },
{ {
"spec": "cypress/integration/rendering/theme.spec.js", "spec": "cypress/integration/rendering/theme.spec.js",
"duration": 29287 "duration": 33240
}, },
{ {
"spec": "cypress/integration/rendering/timeline.spec.ts", "spec": "cypress/integration/rendering/timeline.spec.ts",
"duration": 8491 "duration": 7122
},
{
"spec": "cypress/integration/rendering/treemap.spec.ts",
"duration": 12291
}, },
{ {
"spec": "cypress/integration/rendering/xyChart.spec.js", "spec": "cypress/integration/rendering/xyChart.spec.js",
"duration": 20651 "duration": 11127
}, },
{ {
"spec": "cypress/integration/rendering/zenuml.spec.js", "spec": "cypress/integration/rendering/zenuml.spec.js",
"duration": 3218 "duration": 2391
} }
] ]
} }

View File

@@ -110,7 +110,7 @@
title Component diagram for Internet Banking System - API Application title Component diagram for Internet Banking System - API Application
Container(spa, "Single Page Application", "javascript and angular", "Provides all the internet banking functionality to customers via their web browser.") Container(spa, "Single Page Application", "javascript and angular", "Provides all the internet banking functionality to customers via their web browser.")
Container(ma, "Mobile App", "Xamarin", "Provides a limited subset ot the internet banking functionality to customers via their mobile device.") Container(ma, "Mobile App", "Xamarin", "Provides a limited subset ot the internet banking functionality to customers via their mobile mobile device.")
ContainerDb(db, "Database", "Relational Database Schema", "Stores user registration information, hashed authentication credentials, access logs, etc.") ContainerDb(db, "Database", "Relational Database Schema", "Stores user registration information, hashed authentication credentials, access logs, etc.")
System_Ext(mbs, "Mainframe Banking System", "Stores all of the core banking information about customers, accounts, transactions, etc.") System_Ext(mbs, "Mainframe Banking System", "Stores all of the core banking information about customers, accounts, transactions, etc.")

View File

@@ -148,7 +148,7 @@
<pre class="mermaid"> <pre class="mermaid">
classDiagram classDiagram
class Person { class Person {
+ID : Guid +Id : Guid
+FirstName : string +FirstName : string
+LastName : string +LastName : string
-privateProperty : string -privateProperty : string
@@ -218,10 +218,10 @@
+double side +double side
} }
} }
Shape <|-- Circle Shape <|-- Circle
Shape <|-- Square Shape <|-- Square
namespace Vehicles { namespace Vehicles {
class Vehicle { class Vehicle {
+String brand +String brand
@@ -233,12 +233,12 @@
+boolean hasGears +boolean hasGears
} }
} }
Vehicle <|-- Car Vehicle <|-- Car
Vehicle <|-- Bike Vehicle <|-- Bike
Car --> Circle : "Logo Shape" Car --> Circle : "Logo Shape"
Bike --> Square : "Logo Shape" Bike --> Square : "Logo Shape"
</pre> </pre>
<script type="module"> <script type="module">
import mermaid from './mermaid.esm.mjs'; import mermaid from './mermaid.esm.mjs';

View File

@@ -1,222 +0,0 @@
<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Montserrat&display=swap" rel="stylesheet" />
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet" />
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/font-awesome.min.css"
/>
<link
href="https://cdn.jsdelivr.net/npm/@mdi/font@6.9.96/css/materialdesignicons.min.css"
rel="stylesheet"
/>
<link
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css?family=Noto+Sans+SC&display=swap"
rel="stylesheet"
/>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Kalam:wght@300;400;700&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Caveat:wght@400..700&family=Kalam:wght@300;400;700&family=Rubik+Mono+One&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Kalam:wght@300;400;700&family=Rubik+Mono+One&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Recursive:wght@300..1000&display=swap"
rel="stylesheet"
/>
<style>
.recursive-500 {
font-family: 'Recursive', serif;
font-optical-sizing: auto;
font-weight: 500;
font-style: normal;
font-variation-settings:
'slnt' 0,
'CASL' 0,
'CRSV' 0.5,
'MONO' 0;
}
body {
/* background: rgb(221, 208, 208); */
/* background: #333; */
/* font-family: 'Arial'; */
font-family: 'Recursive', serif;
font-optical-sizing: auto;
font-weight: 500;
font-style: normal;
font-variation-settings:
'slnt' 0,
'CASL' 0,
'CRSV' 0.5,
'MONO' 0;
/* color: white; */
/* font-size: 18px !important; */
}
.gridify.tiny {
background-image:
linear-gradient(transparent 11px, rgba(220, 220, 200, 0.8) 12px, transparent 12px),
linear-gradient(90deg, transparent 11px, rgba(220, 220, 200, 0.8) 12px, transparent 12px);
background-size:
100% 12px,
12px 100%;
}
.gridify.dots {
background-image: radial-gradient(
circle at center,
rgba(220, 220, 200, 0.8) 1px,
transparent 1px
);
background-size: 24px 24px;
}
h1 {
color: grey;
}
.mermaid2 {
display: none;
}
.mermaid svg {
font-size: 16px !important;
font-family: 'Recursive', serif;
font-optical-sizing: auto;
font-weight: 500;
font-style: normal;
font-variation-settings:
'slnt' 0,
'CASL' 0,
'CRSV' 0.5,
'MONO' 0;
}
pre {
width: 100%;
/*box-shadow: 4px 4px 0px 0px #0000000F;*/
}
</style>
</head>
<body class="gridify dots">
<div class="w-full h-64">
<pre id="diagram4" class="mermaid" style="background: rgb(255, 255, 255)">
erDiagram
CAR ||--o{ NAMED-DRIVER : allows
CAR ::: Pine {
string registrationNumber PK "Primary Key<br><strong>Unique registration number</strong>"
string make "Car make<br><strong>e.g., Toyota</strong>"
string model "Model of the car<br><strong>e.g., Corolla</strong>"
string[] parts "List of parts<br><strong>Stored as array</strong>"
}
PERSON ||--o{ NAMED-DRIVER : is
PERSON ::: someclass {
string driversLicense PK "The license #<br><strong>Primary Key</strong>"
string(99) firstName "Only 99 characters <br>are allowed <br> <strong>e.g., Smith</strong>"
string lastName "Last name of person<br><strong>e.g., Smith</strong>"
string phone UK "Unique phone number<br><strong>Used for contact</strong>"
int age "Age of the person<br><strong>Must be numeric</strong>"
}
NAMED-DRIVER {
string carRegistrationNumber PK, FK, UK, PK "Foreign key to CAR<br><strong>Also part of PK</strong>"
string driverLicence PK, FK "Foreign key to PERSON<br><strong>Also part of PK</strong>"
}
MANUFACTURER only one to zero or more CAR : makesx
</pre>
<hr />
<pre class="mermaid">
erDiagram
_**testẽζØ😀㌕ぼ**_ {
*__List~List~int~~sdfds__* **driversLicense** PK "***The l😀icense #***"
string last*Name*
string __phone__ UK
*string(99)~T~~~~~~* firstName "Only __99__ <br>characters are a<br>llowed dsfsdfsdfsdfs"
int _age_
}
</pre>
</div>
<script type="module">
import mermaid from './mermaid.esm.mjs';
import layouts from './mermaid-layout-elk.esm.mjs';
const staticBellIconPack = {
prefix: 'fa6-regular',
icons: {
bell: {
body: '<path fill="currentColor" d="M224 0c-17.7 0-32 14.3-32 32v19.2C119 66 64 130.6 64 208v25.4c0 45.4-15.5 89.5-43.8 124.9L5.3 377c-5.8 7.2-6.9 17.1-2.9 25.4S14.8 416 24 416h400c9.2 0 17.6-5.3 21.6-13.6s2.9-18.2-2.9-25.4l-14.9-18.6c-28.3-35.5-43.8-79.6-43.8-125V208c0-77.4-55-142-128-156.8V32c0-17.7-14.3-32-32-32m0 96c61.9 0 112 50.1 112 112v25.4c0 47.9 13.9 94.6 39.7 134.6H72.3c25.8-40 39.7-86.7 39.7-134.6V208c0-61.9 50.1-112 112-112m64 352H160c0 17 6.7 33.3 18.7 45.3S207 512 224 512s33.3-6.7 45.3-18.7S288 465 288 448"/>',
width: 448,
},
},
width: 512,
height: 512,
};
mermaid.registerIconPacks([
{
name: 'logos',
loader: () =>
fetch('https://unpkg.com/@iconify-json/logos@1/icons.json').then((res) => res.json()),
},
{
name: 'fa',
loader: () => staticBellIconPack,
},
]);
mermaid.registerLayoutLoaders(layouts);
mermaid.parseError = function (err, hash) {
console.error('Mermaid error: ', err);
};
window.callback = function () {
alert('A callback was triggered');
};
function callback() {
alert('It worked');
}
await mermaid.initialize({
startOnLoad: false,
theme: 'forest',
look: 'classic',
layout: 'dagre',
// theme: 'default',
// look: 'classic',
flowchart: { titleTopMargin: 10 },
fontFamily: 'Recursive',
sequence: {
actorFontFamily: 'courier',
noteFontFamily: 'courier',
messageFontFamily: 'courier',
},
kanban: {
htmlLabels: false,
},
fontSize: 16,
logLevel: 0,
securityLevel: 'loose',
callback,
});
// setTimeout(() => {
mermaid.init(undefined, document.querySelectorAll('.mermaid'));
// }, 1000);
mermaid.parseError = function (err, hash) {
console.error('In parse error:');
console.error(err);
};
</script>
</body>
</html>

View File

@@ -91,9 +91,6 @@
<li> <li>
<h2><a href="./architecture.html">Architecture</a></h2> <h2><a href="./architecture.html">Architecture</a></h2>
</li> </li>
<li>
<h2><a href="./radar.html">Radar</a></h2>
</li>
</ul> </ul>
</body> </body>
</html> </html>

View File

@@ -17,7 +17,7 @@
<div class="diagrams"> <div class="diagrams">
<pre class="mermaid"> <pre class="mermaid">
packet packet-beta
0-15: "Source Port" 0-15: "Source Port"
16-31: "Destination Port" 16-31: "Destination Port"
32-63: "Sequence Number" 32-63: "Sequence Number"
@@ -44,7 +44,7 @@
packet: packet:
showBits: false showBits: false
--- ---
packet packet-beta
0-15: "Source Port" 0-15: "Source Port"
16-31: "Destination Port" 16-31: "Destination Port"
32-63: "Sequence Number" 32-63: "Sequence Number"
@@ -70,7 +70,7 @@
config: config:
theme: forest theme: forest
--- ---
packet packet-beta
title Forest theme title Forest theme
0-15: "Source Port" 0-15: "Source Port"
16-31: "Destination Port" 16-31: "Destination Port"
@@ -97,7 +97,7 @@
config: config:
theme: dark theme: dark
--- ---
packet packet-beta
title Dark theme title Dark theme
0-15: "Source Port" 0-15: "Source Port"
16-31: "Destination Port" 16-31: "Destination Port"

View File

@@ -22,7 +22,7 @@
y-axis Not Important --> important y-axis Not Important --> important
quadrant-1 Plan quadrant-1 Plan
quadrant-2 Do quadrant-2 Do
quadrant-3 Delegate quadrant-3 Deligate
quadrant-4 Delete quadrant-4 Delete
</pre> </pre>

View File

@@ -1,157 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Mermaid Quick Test Page</title>
<link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgo=" />
<style>
div.mermaid {
font-family: 'Courier New', Courier, monospace !important;
}
</style>
</head>
<body>
<h1>Radar diagram demo</h1>
<div class="diagrams">
<pre class="mermaid">
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
</pre
>
<pre class="mermaid">
---
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
</pre
>
<pre class="mermaid">
%%{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}
</pre
>
<pre class="mermaid" style="background-color: black">
%%{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}
</pre
>
<pre class="mermaid">
%%{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}
</pre
>
<pre class="mermaid">
---
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}
</pre>
</div>
<script type="module">
import mermaid from '/mermaid.esm.mjs';
mermaid.initialize({
logLevel: 3,
securityLevel: 'loose',
});
</script>
<style>
.diagrams {
display: flex;
flex-wrap: wrap;
}
pre {
width: 45vw;
padding: 2em;
}
</style>
</body>
</html>

View File

@@ -23,23 +23,6 @@
1940 : fourth step : fifth step 1940 : fourth step : fifth step
</pre> </pre>
<h2>Medical Device Lifecycle Timeline</h2>
<pre class="mermaid">
timeline
title Medical Device Lifecycle
section Planning
Quality Management System (4) : Regulatory Compliance (4.1) : Risk Management (4.1.3) : Management Review (5.6) : Infrastructure (6.3)
Management Responsibility (5) : Planning Activities (5.2) : Human Resources (6.2) : RnD Planning (7.3.2) : Purchasing Process (7.4.1) : Production Activities (7.5.1) : Installation Activities (7.5.3) : Servicing Activities (7.5.4)
section Realization
Research and Development (7.3) : Inputs (7.3.3) : Outputs (7.3.4) : Review (7.3.5) : Verification (7.3.6) : Validation (7.3.7)
Purchasing (7.4) : Purchasing Information (7.4.2) : Production Feedback (8.2.1)
Production (7.5) : Production Feedback (8.2.1)
Installation (7.5.3) : Installation Activities (7.5.3)
Servicing (7.5.4) : Servicing Activities (7.5.4)
section Post-Production
Post-Market Activities (8) : Feedback (8.2.1) : Complaints (8.2.2) : Adverse Events (8.2.3)
</pre>
<script type="module"> <script type="module">
import mermaid from './mermaid.esm.mjs'; import mermaid from './mermaid.esm.mjs';
mermaid.initialize({ mermaid.initialize({

View File

@@ -1,75 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Mermaid Treemap Diagram Demo</title>
<link href="https://fonts.googleapis.com/css?family=Montserrat&display=swap" rel="stylesheet" />
<style>
body {
font-family: 'Montserrat', sans-serif;
margin: 0 auto;
max-width: 900px;
padding: 20px;
}
.mermaid {
margin: 30px 0;
}
h1,
h2 {
color: #333;
}
pre {
background-color: #f5f5f5;
padding: 15px;
border-radius: 5px;
}
</style>
</head>
<body>
<h1>Treemap Diagram Demo</h1>
<p>This is a demo of the new treemap diagram type in Mermaid.</p>
<h2>Basic Treemap Example</h2>
<pre class="mermaid">
treemap
"Root"
"Branch 1"
"Leaf 1.1": 10
"Leaf 1.2": 15
"Branch 2"
"Branch 2.1"
"Leaf 2.1.1": 20
"Leaf 2.1.2": 25
"Leaf 2.2": 25
"Leaf 2.3": 30
</pre>
<h2>Technology Stack Treemap Example</h2>
<pre class="mermaid">
treemap
"Technology Stack"
"Frontend"
"React": 35
"CSS": 15
"HTML": 10
"Backend"
"Node.js": 25
"Express": 10
"MongoDB": 15
"DevOps"
"Docker": 10
"Kubernetes": 15
"CI/CD": 5
</pre>
<script type="module">
import mermaid from './mermaid.esm.mjs';
mermaid.initialize({
theme: 'forest',
logLevel: 1,
securityLevel: 'loose',
});
</script>
</body>
</html>

View File

@@ -10,20 +10,16 @@
<h1>Zenuml demos</h1> <h1>Zenuml demos</h1>
<pre class="mermaid"> <pre class="mermaid">
zenuml zenuml
BookLibService.Borrow(id) { title Sync Messages (Design Pattern: Adapter)
User = Session.GetUser() @Starter(Client)
if(User.isActive) { Adapter.interfaceMethod() {
try { translateParameter(parameter)
BookRepository.Update(id, onLoan, User)
receipt = new Receipt(id, dueDate) result = Implementation.implementationMethod()
} catch (BookNotFoundException) {
ErrorService.onException(BookNotFoundException) translateResult()
} finally { return translatedResult
Connection.close() }
}
}
return receipt
}
</pre> </pre>
<pre class="mermaid"> <pre class="mermaid">
zenuml zenuml

View File

@@ -239,22 +239,6 @@ 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`. 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 ### Running Mermaid Locally
**Host** **Host**
@@ -497,14 +481,14 @@ This is a danger alert
### Navigation ### Navigation
If you want to propose changes to how the documentation is _organized_, such as adding a new section or re-arranging or renaming a section, you must update the **sidebar navigation**, which is defined in [the vitepress config](../.vitepress/config.ts). The same goes for **topbar**. If you want to propose changes to how the documentation is _organized_, such as adding a new section or re-arranging or renaming a section, you must update the **sidebar navigation**, which is defined in [the vitepress config](../.vitepress/config.ts). The same goes to **topbar**.
### Build Docs ### Build Docs
The content of `/docs` folder is built with GitHub Actions. The content of `/docs` folder is built with Github Actions.
> **Warning** > **Warning**
> So as to allow automatic compilation of documentation pages you have to enable GitHub Actions on your fork first > So as to allow automatic compilation of documentation pages you have to enable Github Actions on your fork first
## Submit your pull request ## Submit your pull request

View File

@@ -111,13 +111,3 @@ const themes = {
``` ```
The actual options and values for the colors are defined in **src/theme/theme-\[xyz].js**. If you provide the options your diagram needs in the existing theme files then the theming will work smoothly without hiccups. The actual options and values for the colors are defined in **src/theme/theme-\[xyz].js**. If you provide the options your diagram needs in the existing theme files then the theming will work smoothly without hiccups.
## Examples
The `@mermaid-js/examples` package contains a collection of examples that are used by tools like mermaid.live to help users get started with the new diagram.
You can duplicate an existing diagram example file, eg: `packages/examples/src/examples/flowchart.ts`, and modify it with details specific to your diagram.
Then you can import the example in the `packages/examples/src/index.ts` file and add it to the `examples` array.
Each diagram should have at least one example, and that should be marked as default. It is good to add more examples to showcase different features of the diagram.

View File

@@ -22,4 +22,4 @@ This helps the team know the relative interest in something and helps them set p
You have not found anything that already addresses your request, or maybe you have come up with the new idea? Feel free to open a new issue or discussion. You have not found anything that already addresses your request, or maybe you have come up with the new idea? Feel free to open a new issue or discussion.
Log in to [GitHub.com](https://www.github.com), and use [GitHub issue tracker of the mermaid-js repository](https://github.com/mermaid-js/mermaid/issues). Press [issue, select the appropriate template](https://github.com/mermaid-js/mermaid/issues/new/choose) and describe your problem. Log in to [GitHub.com](https://www.github.com), and use [GitHub issue tracker of the mermaid-js repository](https://github.com/mermaid-js/mermaid/issues). Press \[<https://github.com/mermaid-js/mermaid/issues/new/choose>] issue, select the appropriate template and describe your problem.

View File

@@ -251,12 +251,12 @@ Here is the HTML generated for the SVG element: _(Note that some of the SVG attr
``` ```
##### GitGraph ##### Gitgraph
```mermaid-example ```mermaid-example
gitGraph gitGraph
accTitle: My GitGraph Accessibility Title accTitle: My Gitgraph Accessibility Title
accDescr: My GitGraph Accessibility Description accDescr: My Gitgraph Accessibility Description
commit commit
commit commit
@@ -273,8 +273,8 @@ Here is the HTML generated for the SVG element: _(Note that some of the SVG attr
```mermaid ```mermaid
gitGraph gitGraph
accTitle: My GitGraph Accessibility Title accTitle: My Gitgraph Accessibility Title
accDescr: My GitGraph Accessibility Description accDescr: My Gitgraph Accessibility Description
commit commit
commit commit

View File

@@ -4,14 +4,12 @@
> >
> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/README.md](../../../packages/mermaid/src/docs/config/setup/README.md). > ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/README.md](../../../packages/mermaid/src/docs/config/setup/README.md).
**mermaid**
---
# mermaid # mermaid
## Modules ## Table of contents
- [config](config/README.md) ### Modules
- [defaultConfig](defaultConfig/README.md)
- [mermaid](mermaid/README.md) - [config](modules/config.md)
- [defaultConfig](modules/defaultConfig.md)
- [mermaid](modules/mermaid.md)

View File

@@ -0,0 +1,190 @@
> **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`**
## Table of contents
### Constructors
- [constructor](mermaid.UnknownDiagramError.md#constructor)
### Properties
- [cause](mermaid.UnknownDiagramError.md#cause)
- [message](mermaid.UnknownDiagramError.md#message)
- [name](mermaid.UnknownDiagramError.md#name)
- [stack](mermaid.UnknownDiagramError.md#stack)
- [prepareStackTrace](mermaid.UnknownDiagramError.md#preparestacktrace)
- [stackTraceLimit](mermaid.UnknownDiagramError.md#stacktracelimit)
### Methods
- [captureStackTrace](mermaid.UnknownDiagramError.md#capturestacktrace)
## 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`**
<https://v8.dev/docs/stack-trace-api#customizing-stack-traces>
#### 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\@22.13.5/node_modules/@types/node/globals.d.ts:143
---
### stackTraceLimit
`Static` **stackTraceLimit**: `number`
#### Inherited from
Error.stackTraceLimit
#### Defined in
node_modules/.pnpm/@types+node\@22.13.5/node_modules/@types/node/globals.d.ts:145
## 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\@22.13.5/node_modules/@types/node/globals.d.ts:136

View File

@@ -1,28 +0,0 @@
> **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)

View File

@@ -1,29 +0,0 @@
> **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`

View File

@@ -1,29 +0,0 @@
> **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

View File

@@ -1,29 +0,0 @@
> **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

View File

@@ -1,42 +0,0 @@
> **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`

View File

@@ -1,36 +0,0 @@
> **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`

View File

@@ -1,25 +0,0 @@
> **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`

View File

@@ -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/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

View File

@@ -1,40 +0,0 @@
> **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

View File

@@ -1,29 +0,0 @@
> **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)

View File

@@ -1,25 +0,0 @@
> **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)

View File

@@ -1,15 +0,0 @@
> **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)

View File

@@ -1,16 +0,0 @@
> **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)

View File

@@ -1,15 +0,0 @@
> **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:290](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/defaultConfig.ts#L290)

View File

@@ -1,21 +0,0 @@
> **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).

View File

@@ -0,0 +1,58 @@
> **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
## Table of contents
### Properties
- [error](mermaid.DetailedError.md#error)
- [hash](mermaid.DetailedError.md#hash)
- [message](mermaid.DetailedError.md#message)
- [str](mermaid.DetailedError.md#str)
## 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)

View File

@@ -0,0 +1,47 @@
> **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
## Table of contents
### Properties
- [detector](mermaid.ExternalDiagramDefinition.md#detector)
- [id](mermaid.ExternalDiagramDefinition.md#id)
- [loader](mermaid.ExternalDiagramDefinition.md#loader)
## 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)

View File

@@ -0,0 +1,51 @@
> **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`
## Table of contents
### Properties
- [config](mermaid.LayoutData.md#config)
- [edges](mermaid.LayoutData.md#edges)
- [nodes](mermaid.LayoutData.md#nodes)
## 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)

View File

@@ -0,0 +1,47 @@
> **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
## Table of contents
### Properties
- [algorithm](mermaid.LayoutLoaderDefinition.md#algorithm)
- [loader](mermaid.LayoutLoaderDefinition.md#loader)
- [name](mermaid.LayoutLoaderDefinition.md#name)
## 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)

View File

@@ -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/interfaces/mermaid.ParseOptions.md](../../../../packages/mermaid/src/docs/config/setup/interfaces/mermaid.ParseOptions.md).
# Interface: ParseOptions
[mermaid](../modules/mermaid.md).ParseOptions
## Table of contents
### Properties
- [suppressErrors](mermaid.ParseOptions.md#suppresserrors)
## 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)

Some files were not shown because too many files have changed in this diff Show More