From 21caa3eb727d056ef424df0c76afa5069290d105 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Mon, 3 Oct 2022 11:50:42 +0800 Subject: [PATCH 01/27] chore: Auto build docs if only src/docs is changed --- .github/workflows/lint.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 44e2f4cb1..c84632264 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -19,6 +19,16 @@ jobs: node-version: [16.x] steps: - uses: actions/checkout@v3 + if: ${{ github.event_name == 'pull_request' }} + with: + fetch-depth: 2 + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.event.pull_request.head.ref }} + + - uses: actions/checkout@v3 + if: ${{ github.event_name != 'pull_request' }} + with: + fetch-depth: 2 - name: Setup Node.js ${{ matrix.node-version }} uses: actions/setup-node@v3 @@ -38,5 +48,27 @@ jobs: - name: Run Linting run: yarn lint + - name: Run changed-files using the fork point of a pull request + id: changed-files-fork-point + uses: tj-actions/changed-files@v29 + with: + use_fork_point: 'true' + files: | + src/docs/* + + - name: Run step if any file(s) in the docs folder change + if: steps.changed-files-fork-point.outputs.only_modified == 'true' + run: | + echo "Only files in the src/docs folder has changed." + echo "List all the files that have changed: ${{ steps.changed-files-specific.outputs.all_changed_files }}" + yarn docs:build + + - name: Commit changes + uses: EndBug/add-and-commit@v9 + if: steps.changed-files-fork-point.outputs.only_modified == 'true' + with: + message: 'Update docs' + add: 'docs/*' + - name: Verify Docs run: yarn docs:verify From 058f1c2edf4908f0bbb63e955bee6e6e359f7caf Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Mon, 3 Oct 2022 11:55:33 +0800 Subject: [PATCH 02/27] chore: Update docs path --- .github/workflows/lint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index aa80e5c6e..13b2c4ebe 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -54,7 +54,7 @@ jobs: with: use_fork_point: 'true' files: | - src/docs/* + packages/mermaid/src/docs/* - name: Run step if any file(s) in the docs folder change if: steps.changed-files-fork-point.outputs.only_modified == 'true' @@ -68,7 +68,7 @@ jobs: if: steps.changed-files-fork-point.outputs.only_modified == 'true' with: message: 'Update docs' - add: 'docs/*' + add: 'packages/mermaid/docs/*' - name: Verify Docs run: pnpm run docs:verify From 8d9800c72709206a182db190df5b4e0447d79aa4 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Mon, 3 Oct 2022 11:57:19 +0800 Subject: [PATCH 03/27] fix(docs): Test auto commit --- packages/mermaid/src/docs/classDiagram.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/mermaid/src/docs/classDiagram.md b/packages/mermaid/src/docs/classDiagram.md index f46d3689c..51383fb6a 100644 --- a/packages/mermaid/src/docs/classDiagram.md +++ b/packages/mermaid/src/docs/classDiagram.md @@ -1,7 +1,8 @@ # Class diagrams > "In software engineering, a class diagram in the Unified Modeling Language (UML) is a type of static structure diagram that describes the structure of a system by showing the system's classes, their attributes, operations (or methods), and the relationships among objects." -> Wikipedia +> +> -Wikipedia The class diagram is the main building block of object-oriented modeling. It is used for general conceptual modeling of the structure of the application, and for detailed modeling to translate the models into programming code. Class diagrams can also be used for data modeling. The classes in a class diagram represent both the main elements, interactions in the application, and the classes to be programmed. From d367e832bed51bd60204316f1765f4df2e863619 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Mon, 3 Oct 2022 12:00:59 +0800 Subject: [PATCH 04/27] fix(docs): Test auto commit --- .github/workflows/lint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 13b2c4ebe..c0b0a7f28 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -21,9 +21,9 @@ jobs: - uses: actions/checkout@v3 if: ${{ github.event_name == 'pull_request' }} with: + # repository: ${{ github.event.pull_request.head.repo.full_name }} + # ref: ${{ github.event.pull_request.head.ref }} fetch-depth: 2 - repository: ${{ github.event.pull_request.head.repo.full_name }} - ref: ${{ github.event.pull_request.head.ref }} - uses: actions/checkout@v3 if: ${{ github.event_name != 'pull_request' }} From 75db08a60c944e749b5fac5558dc49725fbe858f Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Mon, 3 Oct 2022 12:05:48 +0800 Subject: [PATCH 05/27] fix(docs): Test auto commit --- .github/workflows/lint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c0b0a7f28..fc1121c71 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -57,7 +57,7 @@ jobs: packages/mermaid/src/docs/* - name: Run step if any file(s) in the docs folder change - if: steps.changed-files-fork-point.outputs.only_modified == 'true' + if: steps.changed-files-fork-point.outputs.any_modified == 'true' run: | echo "Only files in the src/docs folder has changed." echo "List all the files that have changed: ${{ steps.changed-files-specific.outputs.all_changed_files }}" @@ -65,7 +65,7 @@ jobs: - name: Commit changes uses: EndBug/add-and-commit@v9 - if: steps.changed-files-fork-point.outputs.only_modified == 'true' + if: steps.changed-files-fork-point.outputs.any_modified == 'true' with: message: 'Update docs' add: 'packages/mermaid/docs/*' From 1d8d677d81570628545437ff2adb487dc6c0d51e Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Mon, 3 Oct 2022 14:03:44 +0800 Subject: [PATCH 06/27] fix: File location --- .github/workflows/lint.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index fc1121c71..6ca6b3519 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -55,6 +55,7 @@ jobs: use_fork_point: 'true' files: | packages/mermaid/src/docs/* + packages/mermaid/src/docs.mts - name: Run step if any file(s) in the docs folder change if: steps.changed-files-fork-point.outputs.any_modified == 'true' @@ -68,7 +69,7 @@ jobs: if: steps.changed-files-fork-point.outputs.any_modified == 'true' with: message: 'Update docs' - add: 'packages/mermaid/docs/*' + add: 'docs/*' - name: Verify Docs run: pnpm run docs:verify From 3bae25fe6b353d3621ab4e68d3eee47b47ed8305 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Mon, 3 Oct 2022 14:15:28 +0800 Subject: [PATCH 07/27] split lint docs action --- .github/workflows/lint-docs.yml | 63 +++++++++++++++++++++++++++++++++ .github/workflows/lint.yml | 33 ----------------- 2 files changed, 63 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/lint-docs.yml diff --git a/.github/workflows/lint-docs.yml b/.github/workflows/lint-docs.yml new file mode 100644 index 000000000..68bda942a --- /dev/null +++ b/.github/workflows/lint-docs.yml @@ -0,0 +1,63 @@ +name: Lint Docs + +on: + pull_request: + types: + - opened + - synchronize + - ready_for_review + +permissions: + contents: write + +jobs: + lint: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [16.x] + steps: + - uses: actions/checkout@v3 + if: ${{ github.event_name == 'pull_request' }} + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.event.pull_request.head.ref }} + fetch-depth: 0 + + - uses: pnpm/action-setup@v2 + # uses version from "packageManager" field in package.json + + - name: Setup Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + cache: pnpm + node-version: ${{ matrix.node-version }} + + - name: Install Packages + run: | + pnpm install --frozen-lockfile + env: + CYPRESS_CACHE_FOLDER: .cache/Cypress + + - name: Run changed-files using the fork point of a pull request + id: changed-files-fork-point + uses: tj-actions/changed-files@v29 + with: + use_fork_point: 'true' + files: | + packages/mermaid/src/docs/* + packages/mermaid/src/docs.mts + + - name: Run step if any file(s) in the docs folder change + if: steps.changed-files-fork-point.outputs.any_modified == 'true' + run: | + echo "Only files in the src/docs folder has changed." + echo "List all the files that have changed: ${{ steps.changed-files-specific.outputs.all_changed_files }}" + yarn docs:build + + - name: Commit changes + uses: EndBug/add-and-commit@v9 + if: steps.changed-files-fork-point.outputs.any_modified == 'true' + with: + message: 'Update docs' + add: 'docs/*' diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6ca6b3519..dd2f7aa3b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -19,16 +19,6 @@ jobs: node-version: [16.x] steps: - uses: actions/checkout@v3 - if: ${{ github.event_name == 'pull_request' }} - with: - # repository: ${{ github.event.pull_request.head.repo.full_name }} - # ref: ${{ github.event.pull_request.head.ref }} - fetch-depth: 2 - - - uses: actions/checkout@v3 - if: ${{ github.event_name != 'pull_request' }} - with: - fetch-depth: 2 - uses: pnpm/action-setup@v2 # uses version from "packageManager" field in package.json @@ -48,28 +38,5 @@ jobs: - name: Run Linting run: pnpm run lint - - name: Run changed-files using the fork point of a pull request - id: changed-files-fork-point - uses: tj-actions/changed-files@v29 - with: - use_fork_point: 'true' - files: | - packages/mermaid/src/docs/* - packages/mermaid/src/docs.mts - - - name: Run step if any file(s) in the docs folder change - if: steps.changed-files-fork-point.outputs.any_modified == 'true' - run: | - echo "Only files in the src/docs folder has changed." - echo "List all the files that have changed: ${{ steps.changed-files-specific.outputs.all_changed_files }}" - yarn docs:build - - - name: Commit changes - uses: EndBug/add-and-commit@v9 - if: steps.changed-files-fork-point.outputs.any_modified == 'true' - with: - message: 'Update docs' - add: 'docs/*' - - name: Verify Docs run: pnpm run docs:verify From 8d6af3dfedd7fb564e889496db6e2e12e1eec012 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Mon, 3 Oct 2022 14:21:54 +0800 Subject: [PATCH 08/27] split lint docs action --- .github/workflows/lint-docs.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint-docs.yml b/.github/workflows/lint-docs.yml index 68bda942a..60faeda31 100644 --- a/.github/workflows/lint-docs.yml +++ b/.github/workflows/lint-docs.yml @@ -20,8 +20,8 @@ jobs: - uses: actions/checkout@v3 if: ${{ github.event_name == 'pull_request' }} with: - repository: ${{ github.event.pull_request.head.repo.full_name }} - ref: ${{ github.event.pull_request.head.ref }} + # repository: ${{ github.event.pull_request.head.repo.full_name }} + # ref: ${{ github.event.pull_request.head.ref }} fetch-depth: 0 - uses: pnpm/action-setup@v2 @@ -49,7 +49,7 @@ jobs: packages/mermaid/src/docs.mts - name: Run step if any file(s) in the docs folder change - if: steps.changed-files-fork-point.outputs.any_modified == 'true' + if: steps.changed-files-fork-point.outputs.only_modified == 'true' run: | echo "Only files in the src/docs folder has changed." echo "List all the files that have changed: ${{ steps.changed-files-specific.outputs.all_changed_files }}" @@ -57,7 +57,7 @@ jobs: - name: Commit changes uses: EndBug/add-and-commit@v9 - if: steps.changed-files-fork-point.outputs.any_modified == 'true' + if: steps.changed-files-fork-point.outputs.only_modified == 'true' with: message: 'Update docs' add: 'docs/*' From 9c5c85d34ac1777a93b8e80b15720a5fccbeb57c Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Mon, 3 Oct 2022 14:24:51 +0800 Subject: [PATCH 09/27] Run doc lint only if files changed --- .github/workflows/lint-docs.yml | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/.github/workflows/lint-docs.yml b/.github/workflows/lint-docs.yml index 60faeda31..734363a22 100644 --- a/.github/workflows/lint-docs.yml +++ b/.github/workflows/lint-docs.yml @@ -24,21 +24,6 @@ jobs: # ref: ${{ github.event.pull_request.head.ref }} fetch-depth: 0 - - uses: pnpm/action-setup@v2 - # uses version from "packageManager" field in package.json - - - name: Setup Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - cache: pnpm - node-version: ${{ matrix.node-version }} - - - name: Install Packages - run: | - pnpm install --frozen-lockfile - env: - CYPRESS_CACHE_FOLDER: .cache/Cypress - - name: Run changed-files using the fork point of a pull request id: changed-files-fork-point uses: tj-actions/changed-files@v29 @@ -48,6 +33,24 @@ jobs: packages/mermaid/src/docs/* packages/mermaid/src/docs.mts + - uses: pnpm/action-setup@v2 + if: steps.changed-files-fork-point.outputs.only_modified == 'true' + # uses version from "packageManager" field in package.json + + - name: Setup Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + if: steps.changed-files-fork-point.outputs.only_modified == 'true' + with: + cache: pnpm + node-version: ${{ matrix.node-version }} + + - name: Install Packages + if: steps.changed-files-fork-point.outputs.only_modified == 'true' + run: | + pnpm install --frozen-lockfile + env: + CYPRESS_CACHE_FOLDER: .cache/Cypress + - name: Run step if any file(s) in the docs folder change if: steps.changed-files-fork-point.outputs.only_modified == 'true' run: | From 0a547e524e1b6f9b98489a847670dea6733d10ab Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Mon, 3 Oct 2022 14:30:46 +0800 Subject: [PATCH 10/27] Run doc lint only if files changed --- .github/workflows/lint-docs.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/lint-docs.yml b/.github/workflows/lint-docs.yml index 734363a22..20caab6f0 100644 --- a/.github/workflows/lint-docs.yml +++ b/.github/workflows/lint-docs.yml @@ -18,17 +18,17 @@ jobs: node-version: [16.x] steps: - uses: actions/checkout@v3 - if: ${{ github.event_name == 'pull_request' }} - with: - # repository: ${{ github.event.pull_request.head.repo.full_name }} - # ref: ${{ github.event.pull_request.head.ref }} - fetch-depth: 0 + # if: ${{ github.event_name == 'pull_request' }} + # with: + # fetch-depth: 0 + # repository: ${{ github.event.pull_request.head.repo.full_name }} + # ref: ${{ github.event.pull_request.head.ref }} - name: Run changed-files using the fork point of a pull request id: changed-files-fork-point uses: tj-actions/changed-files@v29 with: - use_fork_point: 'true' + # use_fork_point: 'true' files: | packages/mermaid/src/docs/* packages/mermaid/src/docs.mts From 455c61b2cf38fd8c9739a3b97029cb935574c168 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Mon, 3 Oct 2022 14:41:52 +0800 Subject: [PATCH 11/27] Run doc lint only if files changed --- .github/workflows/lint-docs.yml | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/.github/workflows/lint-docs.yml b/.github/workflows/lint-docs.yml index 20caab6f0..312de8b1c 100644 --- a/.github/workflows/lint-docs.yml +++ b/.github/workflows/lint-docs.yml @@ -18,41 +18,37 @@ jobs: node-version: [16.x] steps: - uses: actions/checkout@v3 - # if: ${{ github.event_name == 'pull_request' }} - # with: - # fetch-depth: 0 - # repository: ${{ github.event.pull_request.head.repo.full_name }} - # ref: ${{ github.event.pull_request.head.ref }} + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.event.pull_request.head.ref }} - - name: Run changed-files using the fork point of a pull request - id: changed-files-fork-point + - name: Check if source docs are changed + id: changed-docs uses: tj-actions/changed-files@v29 with: - # use_fork_point: 'true' files: | packages/mermaid/src/docs/* packages/mermaid/src/docs.mts - uses: pnpm/action-setup@v2 - if: steps.changed-files-fork-point.outputs.only_modified == 'true' - # uses version from "packageManager" field in package.json + if: steps.changed-docs.outputs.only_modified == 'true' - name: Setup Node.js ${{ matrix.node-version }} uses: actions/setup-node@v3 - if: steps.changed-files-fork-point.outputs.only_modified == 'true' + if: steps.changed-docs.outputs.only_modified == 'true' with: cache: pnpm node-version: ${{ matrix.node-version }} - name: Install Packages - if: steps.changed-files-fork-point.outputs.only_modified == 'true' + if: steps.changed-docs.outputs.only_modified == 'true' run: | pnpm install --frozen-lockfile env: CYPRESS_CACHE_FOLDER: .cache/Cypress - name: Run step if any file(s) in the docs folder change - if: steps.changed-files-fork-point.outputs.only_modified == 'true' + if: steps.changed-docs.outputs.only_modified == 'true' run: | echo "Only files in the src/docs folder has changed." echo "List all the files that have changed: ${{ steps.changed-files-specific.outputs.all_changed_files }}" @@ -60,7 +56,7 @@ jobs: - name: Commit changes uses: EndBug/add-and-commit@v9 - if: steps.changed-files-fork-point.outputs.only_modified == 'true' + if: steps.changed-docs.outputs.only_modified == 'true' with: message: 'Update docs' add: 'docs/*' From 563c51d4311f1ff8b159355f8553905348d4b86a Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Mon, 3 Oct 2022 14:49:35 +0800 Subject: [PATCH 12/27] Get base sha from PR --- .github/workflows/lint-docs.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/lint-docs.yml b/.github/workflows/lint-docs.yml index 312de8b1c..d9f0ddae0 100644 --- a/.github/workflows/lint-docs.yml +++ b/.github/workflows/lint-docs.yml @@ -22,10 +22,22 @@ jobs: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.event.pull_request.head.ref }} + - name: Get branch name + id: branch-name + uses: tj-actions/branch-names@v5 + + - uses: nrwl/last-successful-commit-action@v1 + id: last_successful_commit_pull_request + with: + branch: ${{ steps.branch-name.outputs.base_ref_branch }} + workflow_id: 'lint-docs.yml' + github_token: ${{ secrets.GITHUB_TOKEN }} + - name: Check if source docs are changed id: changed-docs uses: tj-actions/changed-files@v29 with: + base_sha: ${{ steps.last_successful_commit_pull_request.outputs.commit_hash }} files: | packages/mermaid/src/docs/* packages/mermaid/src/docs.mts From c7471f17558856c8f91dec7b8e4908f84c4df350 Mon Sep 17 00:00:00 2001 From: MrCoder Date: Sat, 3 Dec 2022 19:10:05 +1100 Subject: [PATCH 13/27] Fixed the issue that theme-switch does not work on docs. --- packages/mermaid/src/docs/.vitepress/theme/mermaid.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/mermaid/src/docs/.vitepress/theme/mermaid.ts b/packages/mermaid/src/docs/.vitepress/theme/mermaid.ts index b287346f9..fef090ea9 100644 --- a/packages/mermaid/src/docs/.vitepress/theme/mermaid.ts +++ b/packages/mermaid/src/docs/.vitepress/theme/mermaid.ts @@ -8,7 +8,9 @@ try { } export const render = async (id: string, code: string, config: MermaidConfig): Promise => { - mermaid.initialize(config); + // make a clone of config, so we don't mutate the original + const mermaidConfig = { ...config }; + mermaid.initialize(mermaidConfig); const svg = await mermaid.renderAsync(id, code); return svg; }; From a1e4ffb3f08e38bb02945e33f02b7992c3f99a2c Mon Sep 17 00:00:00 2001 From: MrCoder Date: Sat, 3 Dec 2022 19:30:09 +1100 Subject: [PATCH 14/27] Fixed an issue that diagrams disappear from docs pages when switching themes or reloading pages --- packages/mermaid/src/docs/.vitepress/theme/Mermaid.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/mermaid/src/docs/.vitepress/theme/Mermaid.vue b/packages/mermaid/src/docs/.vitepress/theme/Mermaid.vue index 9ae9c9f3b..c99141601 100644 --- a/packages/mermaid/src/docs/.vitepress/theme/Mermaid.vue +++ b/packages/mermaid/src/docs/.vitepress/theme/Mermaid.vue @@ -61,6 +61,13 @@ const renderChart = async () => { mermaidConfig.theme = hasDarkClass ? 'dark' : 'default'; console.log({ mermaidConfig }); - svg.value = await render(props.id, decodeURIComponent(props.graph), mermaidConfig); + let svgCode = await render(props.id, decodeURIComponent(props.graph), mermaidConfig); + // This is a hack to force v-html to re-render, otherwise the diagram disappears + // when **switching themes** or **reloading the page**. + // The cause is that the diagram is deleted during rendering (out of Vue's knowledge). + // Because svgCode does NOT change, v-html does not re-render. + // This is not required for all diagrams, but it is required for c4c, mindmap and zenuml. + const salt = Math.random().toString(36).substring(7); + svg.value = `${svgCode} ${salt}`; }; From b68fee7e65274f6f8a52cc26cb9e3094c3bb88a1 Mon Sep 17 00:00:00 2001 From: Knut Sveidqvist Date: Sat, 3 Dec 2022 11:41:29 +0100 Subject: [PATCH 15/27] Small fix for issue #3881 --- cypress/platform/knsv2.html | 39 +++++++------------ .../mermaid/src/dagre-wrapper/clusters.js | 8 ++-- 2 files changed, 18 insertions(+), 29 deletions(-) diff --git a/cypress/platform/knsv2.html b/cypress/platform/knsv2.html index ba7f41601..fb2fe7f9b 100644 --- a/cypress/platform/knsv2.html +++ b/cypress/platform/knsv2.html @@ -56,29 +56,24 @@
Security check
-graph LR
+flowchart LR
     subgraph external
-        inside
+      subgraph internal
+          inside
+      end
     end
-    outside --> external
+    outside --> inside
     
-mindmap
-  root
-    child1((Circle))
-        grandchild 1
-        grandchild 2
-    child2(Round rectangle)
-        grandchild 3
-        grandchild 4
-    child3[Square]
-        grandchild 5
-        ::icon(mdi mdi-fire)
-        gc6((grand
child 6)) - ::icon(mdi mdi-fire) - gc7((grand
grand
child 8)) -
-
+flowchart LR
+    subgraph parent
+      subgraph childB
+        grandchild
+      end
+    end
+    foo --> childA        
+
       gantt
         title Style today marker (vertical line should be 5px wide and half-transparent blue)
         dateFormat YYYY-MM-DD
@@ -103,7 +98,7 @@ mindmap
         // console.error('Mermaid error: ', err);
       };
       mermaid.initialize({
-        theme: 'base',
+        theme: 'default',
         startOnLoad: true,
         logLevel: 0,
         flowchart: {
@@ -114,10 +109,6 @@ mindmap
           useMaxWidth: false,
         },
         useMaxWidth: false,
-        lazyLoadedDiagrams: [
-          './mermaid-mindmap-detector.esm.mjs',
-          './mermaid-example-diagram-detector.esm.mjs',
-        ],
       });
       function callback() {
         alert('It worked');
diff --git a/packages/mermaid/src/dagre-wrapper/clusters.js b/packages/mermaid/src/dagre-wrapper/clusters.js
index 40729dead..57c3ff513 100644
--- a/packages/mermaid/src/dagre-wrapper/clusters.js
+++ b/packages/mermaid/src/dagre-wrapper/clusters.js
@@ -59,11 +59,9 @@ const rect = (parent, node) => {
   // Center the label
   label.attr(
     'transform',
-    'translate(' +
-      (node.x - bbox.width / 2) +
-      ', ' +
-      (node.y - node.height / 2 + node.padding / 3) +
-      ')'
+    // This puts the labal on top of the box instead of inside it
+    // 'translate(' + (node.x - bbox.width / 2) + ', ' + (node.y - node.height / 2 - bbox.height) + ')'
+    'translate(' + (node.x - bbox.width / 2) + ', ' + (node.y - node.height / 2) + ')'
   );
 
   const rectBox = rect.node().getBBox();

From 4124d186d0b3b270c281db26d6c6d233626c6333 Mon Sep 17 00:00:00 2001
From: Knut Sveidqvist 
Date: Sat, 3 Dec 2022 13:21:10 +0100
Subject: [PATCH 16/27] Fix for issue #3882 moving the label when the path has
 been modified

---
 cypress/platform/knsv2.html                 | 32 ++++++++++++---------
 packages/mermaid/src/dagre-wrapper/edges.js | 20 ++++++++++---
 2 files changed, 35 insertions(+), 17 deletions(-)

diff --git a/cypress/platform/knsv2.html b/cypress/platform/knsv2.html
index fb2fe7f9b..83472039d 100644
--- a/cypress/platform/knsv2.html
+++ b/cypress/platform/knsv2.html
@@ -57,22 +57,28 @@
     
Security check
 flowchart LR
-    subgraph external
-      subgraph internal
-          inside
-      end
+    %% Actors
+    A
+    subgraph Sub
+        B --> C
     end
-    outside --> inside
+
+    %% Accusations
+    A --L --> Sub
+
+    %% Offense
+    B --> A
+
     
-flowchart LR
-    subgraph parent
-      subgraph childB
-        grandchild
-      end
-    end
-    foo --> childA        
+ stateDiagram-v2 + + [*] --> S1 + S1 --> S2: long line using
should work + S1 --> S3: long line using
should work + S1 --> S4: long line using \\nshould work + +
       gantt
         title Style today marker (vertical line should be 5px wide and half-transparent blue)
diff --git a/packages/mermaid/src/dagre-wrapper/edges.js b/packages/mermaid/src/dagre-wrapper/edges.js
index 5213d0684..bb22cee83 100644
--- a/packages/mermaid/src/dagre-wrapper/edges.js
+++ b/packages/mermaid/src/dagre-wrapper/edges.js
@@ -130,9 +130,21 @@ export const positionEdgeLabel = (edge, paths) => {
     if (path) {
       //   // debugger;
       const pos = utils.calcLabelPosition(path);
-      log.info('Moving label from (', x, ',', y, ') to (', pos.x, ',', pos.y, ') abc78');
-      // x = pos.x;
-      // y = pos.y;
+      log.info(
+        'Moving label ' + edge.label + ' from (',
+        x,
+        ',',
+        y,
+        ') to (',
+        pos.x,
+        ',',
+        pos.y,
+        ') abc78'
+      );
+      if (paths.updatedPath) {
+        x = pos.x;
+        y = pos.y;
+      }
     }
     el.attr('transform', 'translate(' + x + ', ' + y + ')');
   }
@@ -463,7 +475,7 @@ export const insertEdge = function (elem, e, edge, clusterDb, diagramType, graph
     .attr('style', edge.style);
 
   // DEBUG code, adds a red circle at each edge coordinate
-  // edge.points.forEach(point => {
+  // edge.points.forEach((point) => {
   //   elem
   //     .append('circle')
   //     .style('stroke', 'red')

From d451a0c508b4ffd7ffd5cd82de8a3088fea308f0 Mon Sep 17 00:00:00 2001
From: steph 
Date: Sun, 4 Dec 2022 21:20:09 -0800
Subject: [PATCH 17/27] refactor theming doc

---
 docs/config/theming.md                      | 814 ++++----------------
 packages/mermaid/src/docs/config/theming.md | 551 ++++---------
 2 files changed, 276 insertions(+), 1089 deletions(-)

diff --git a/docs/config/theming.md b/docs/config/theming.md
index cfd86caa0..6c12ee75f 100644
--- a/docs/config/theming.md
+++ b/docs/config/theming.md
@@ -6,31 +6,27 @@
 
 # Theme Configuration
 
-With Version 8.7.0 Mermaid comes out with a system for dynamic and integrated configuration of themes. The intent is to increase the customizability and ease of styling for mermaid diagrams.
+Dynamic and integrated theme configuration was introduced in Mermaid version 8.7.0.
 
-The theme can be altered by changing the root level variable `theme` variable in the configuration. To change it for the whole site you must use the `initialize` call. To do it for just for a single diagram you can use the `%%init%%` directive
+Themes can now be customized at the site-wide level, or on individual Mermaid diagrams. For site-wide theme customization, the `initialize` call is used. For diagram specific customization, the `init` directive is used.
 
-Themes follow and build upon the Levels of Configuration, and employ `directives` to modify and create custom configurations, as they were introduced in Version [8.6.0](./8.6.0_docs.md).
+## Available Themes
 
-## Deployable Themes
+1.  **default** - This is the default theme for all diagrams.
 
-The following are a list of **Deployable themes**, sample `%%init%%` directives and `initialize` calls.
+2.  **neutral** - This theme is great for black and white documents that will be printed.
 
-1.  **base**- Designed to be modified, as the name implies it is supposed to be used as the base for making custom themes.
+3.  **dark** - This theme goes well with dark-colored elements or dark-mode.
 
-2.  **forest**- A theme full of light greens that is easy on the eyes.
+4.  **forest** - This theme contains shades of green.
 
-3.  **dark**- A theme that would go well with other dark-colored elements.
+5.  **base** - This is the only theme that can be modified. Use this theme as the base for customizations.
 
-4.  **default**- The default theme for all diagrams.
+## Site-wide Theme
 
-5.  **neutral**- The theme to be used for black and white printing.
+To customize themes site-wide, call the `initialize` method on the `mermaidAPI`.
 
-## Site-wide Themes
-
-Site-wide themes are declared via `initialize` by site owners.
-
-Example of `Initialize` call setting `theme` to `base`:
+Example of `initialize` call setting `theme` to `base`:
 
 ```javascript
 mermaidAPI.initialize({
@@ -39,28 +35,52 @@ mermaidAPI.initialize({
 });
 ```
 
-**Notes**: Only site owners can use the `mermaidAPI.initialize` call, to set values. Site-Users will have to use `%%init%%` to modify or create the theme for their diagrams.
+## Diagram-specific Themes
 
-## Themes at the Local or Current Level
+To customize the theme of an individual diagram, use the `init` directive.
 
-When Generating a diagram using on a webpage that supports mermaid. It is also possible to override site-wide theme settings locally, for a specific diagram, using directives, as long as it is not prohibited by the `secure` array.
+Example of `init` directive setting the `theme` to `forest`:
 
 ```mermaid-example
-%%{init: {'theme':'base'}}%%
+%%{init: {'theme':'forest'}}%%
   graph TD
     a --> b
 ```
 
 ```mermaid
-%%{init: {'theme':'base'}}%%
+%%{init: {'theme':'forest'}}%%
   graph TD
     a --> b
 ```
 
-Here is an example of how `%%init%%` can set the theme to 'base', this assumes that `themeVariables` are set to default:
+> **Reminder**: the only theme that can be customed is the `base` theme. The following section covers how to use `themeVariables` for customizations.
+
+## Customizing Themes with `themeVariables`
+
+To make a custom theme, modify `themeVariables` via `init`.
+
+You will need to use the [base](#available-themes) theme as it is the only modifiable theme.
+
+| Parameter      | Description                          | Type   | Properties                                                                                          |
+| -------------- | ------------------------------------ | ------ | --------------------------------------------------------------------------------------------------- |
+| themeVariables | Modifiable with the `init` directive | Object | `primaryColor`, `primaryTextColor`, `lineColor` ([see full list](#theme-variables-reference-table)) |
+
+Example of modifying `themeVariables` using the `init` directive:
 
 ```mermaid-example
-%%{init: {'theme':'base'}}%%
+%%{
+  init: {
+    'theme': 'base',
+    'themeVariables': {
+      'primaryColor': '#BB2528',
+      'primaryTextColor': '#fff',
+      'primaryBorderColor': '#7C0000',
+      'lineColor': '#F8B229',
+      'secondaryColor': '#006100',
+      'tertiaryColor': '#fff'
+    }
+  }
+}%%
         graph TD
           A[Christmas] -->|Get money| B(Go shopping)
           B --> C{Let me think}
@@ -78,7 +98,19 @@ Here is an example of how `%%init%%` can set the theme to 'base', this assumes t
 ```
 
 ```mermaid
-%%{init: {'theme':'base'}}%%
+%%{
+  init: {
+    'theme': 'base',
+    'themeVariables': {
+      'primaryColor': '#BB2528',
+      'primaryTextColor': '#fff',
+      'primaryBorderColor': '#7C0000',
+      'lineColor': '#F8B229',
+      'secondaryColor': '#006100',
+      'tertiaryColor': '#fff'
+    }
+  }
+}%%
         graph TD
           A[Christmas] -->|Get money| B(Go shopping)
           B --> C{Let me think}
@@ -95,649 +127,93 @@ Here is an example of how `%%init%%` can set the theme to 'base', this assumes t
           end
 ```
 
-# List of Themes
-
-# Customizing Themes with `themeVariables`
-
-The easiest way to make a custom theme is to start with the base theme, and just modify theme variables through `themeVariables`, via `%%init%%`.
-
-| Parameter      | Description                                                        | Type  | Required | Objects contained                  |
-| -------------- | ------------------------------------------------------------------ | ----- | -------- | ---------------------------------- |
-| themeVariables | Array containing objects, modifiable with the `%%init%%` directive | Array | Required | primaryColor, lineColor, textColor |
-
-**Here is an example of overriding `primaryColor` through `themeVariables` and giving everything a different look, using `%%init%%`.**
-
-```mermaid-example
-%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#ff0000'}}}%%
-        graph TD
-          A[Christmas] -->|Get money| B(Go shopping)
-          B --> C{Let me think}
-          B --> G[/Another/]
-          C ==>|One| D[Laptop]
-          C -->|Two| E[iPhone]
-          C -->|Three| F[fa:fa-car Car]
-          subgraph section
-            C
-            D
-            E
-            F
-            G
-          end
-```
-
-```mermaid
-%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#ff0000'}}}%%
-        graph TD
-          A[Christmas] -->|Get money| B(Go shopping)
-          B --> C{Let me think}
-          B --> G[/Another/]
-          C ==>|One| D[Laptop]
-          C -->|Two| E[iPhone]
-          C -->|Three| F[fa:fa-car Car]
-          subgraph section
-            C
-            D
-            E
-            F
-            G
-          end
-```
-
-**Notes:**
-Leaving it empty will set all variable values to default.
-
-## Color and Color Calculation:
-
-Color definitions have certain interactions in mermaid, this is in order to ensure visibility for diagrams. Mermaid will adjust some variables automatically, when colors are changed in order to compensate and maintain readability.
-
-**The Default Value Column** to the right of the Variable column will denote the Variable paired/associated with the Variable on the left and the nature of this pairing or association. If it for instance says primaryColor it means that it gets primaryColor as default value. If it says "based on primaryColor" it means that it is calculated/ derived from primaryColor. This calculation can be primary color inversion, a change of hue, darkening or lightening by 10%, etc.
-
-You can create your own themes, by changing any of the given variables below. If you are using a dark background, set dark mode to true to adjust the colors. It is possible to override the calculations using the variable names below, with `%%init%%` if you wish to style it differently.
-
-## Theme Variables Reference Table
-
-> **Note**
-> Variables that are unique to some diagrams can be affected by changes in Theme Variables
-
-| Variable             | Default/Base/Factor value      | Calc | Description                                                                                                                      |
-| -------------------- | ------------------------------ | ---- | -------------------------------------------------------------------------------------------------------------------------------- |
-| darkMode             | false                          |      | Boolean Value that dictates how to calculate colors. "true" will activate darkmode.                                              |
-| background           | #f4f4f4                        |      | Used to calculate color for items that should either be background colored or contrasting to the background.                     |
-| fontFamily           | "trebuchet ms", verdana, arial |      |                                                                                                                                  |
-| fontSize             | 16px                           |      | Font Size, in pixels                                                                                                             |
-| primaryColor         | #fff4dd                        |      | Color to be used as background in nodes, other colors will be derived from this                                                  |
-| primaryBorderColor   | based on primaryColor          | \*   | Color to be used as border in nodes using primaryColor                                                                           |
-| primaryTextColor     | based on darkMode #ddd/#333    | \*   | Color to be used as text color in nodes using primaryColor                                                                       |
-| secondaryColor       | based on primaryColor          | \*   |                                                                                                                                  |
-| secondaryBorderColor | based on secondaryColor        | \*   | Color to be used as border in nodes using secondaryColor                                                                         |
-| secondaryTextColor   | based on secondaryColor        | \*   | Color to be used as text color in nodes using secondaryColor                                                                     |
-| tertiaryColor        | based on primaryColor          | \*   |                                                                                                                                  |
-| tertiaryBorderColor  | based on tertiaryColor         | \*   | Color to be used as border in nodes using tertiaryColor                                                                          |
-| tertiaryTextColor    | based on tertiaryColor         | \*   | Color to be used as text color in nodes using tertiaryColor                                                                      |
-| noteBkgColor         | #fff5ad                        |      | Color used as background in notes                                                                                                |
-| noteTextColor        | #333                           |      | Text color in note rectangles.                                                                                                   |
-| noteBorderColor      | based on noteBkgColor          | \*   | Border color in note rectangles.                                                                                                 |
-| lineColor            | based on background            | \*   |                                                                                                                                  |
-| textColor            | based on primaryTextColor      | \*   | Text in diagram over the background for instance text on labels and on signals in sequence diagram or the title in gantt diagram |
-| mainBkg              | based on primaryColor          | \*   | Background in flowchart objects like rects/circles, class diagram classes, sequence diagram etc                                  |
-| errorBkgColor        | tertiaryColor                  | \*   | Color for syntax error message                                                                                                   |
-| errorTextColor       | tertiaryTextColor              | \*   | Color for syntax error message                                                                                                   |
-
-# What follows are Variables, specific to different diagrams and charts.
-
-## Some Theme Variables serve as, or affect the Default Values for Specific Diagram Variables, unless changed using `%%init%%` .
-
-## Flowchart
-
-| Variable            | Default/ Associated Value | Calc | Description                  |
-| ------------------- | ------------------------- | ---- | ---------------------------- |
-| nodeBorder          | primaryBorderColor        | \*   | Node Border Color            |
-| clusterBkg          | tertiaryColor             | \*   | Background in subgraphs      |
-| clusterBorder       | tertiaryBorderColor       | \*   | Cluster Border Color         |
-| defaultLinkColor    | lineColor                 | \*   | Link Color                   |
-| titleColor          | tertiaryTextColor         | \*   | Title Color                  |
-| edgeLabelBackground | based on secondaryColor   | \*   |                              |
-| nodeTextColor       | primaryTextColor          | \*   | Color for text inside Nodes. |
-
-# sequence diagram
-
-| name                  | Default value           | Calc | Description                 |
-| --------------------- | ----------------------- | ---- | --------------------------- |
-| actorBorder           | primaryBorderColor      | \*   | Actor Border Color          |
-| actorBkg              | mainBkg                 | \*   | Actor Background Color      |
-| actorTextColor        | primaryTextColor        | \*   | Actor Text Color            |
-| actorLineColor        | grey                    | \*   | Actor Line Color            |
-| signalColor           | textColor               | \*   | Signal Color                |
-| signalTextColor       | textColor               | \*   | Signal Text Color           |
-| labelBoxBkgColor      | actorBkg                | \*   | Label Box Background Color  |
-| labelBoxBorderColor   | actorBorder             | \*   | Label Box Border Color      |
-| labelTextColor        | actorTextColor          | \*   | Label Text Color            |
-| loopTextColor         | actorTextColor          | \*   | Loop ext Color              |
-| activationBorderColor | based on secondaryColor | \*   | Activation Border Color     |
-| activationBkgColor    | secondaryColor          | \*   | Activation Background Color |
-| sequenceNumberColor   | based on lineColor      | \*   | Sequence Number Color       |
-
-# state colors
-
-| name          | Default value    | Calc | Description                                  |
-| ------------- | ---------------- | ---- | -------------------------------------------- |
-| labelColor    | primaryTextColor | \*   |                                              |
-| altBackground | tertiaryColor    | \*   | Used for background in deep composite states |
-
-# class colors
-
-| name      | Default value | Calc | Description                     |
-| --------- | ------------- | ---- | ------------------------------- |
-| classText | textColor     | \*   | Color of Text in class diagrams |
-
-# User journey colors
-
-| name      | Default value           | Calc | Description                             |
-| --------- | ----------------------- | ---- | --------------------------------------- |
-| fillType0 | primaryColor            | \*   | Fill for 1st section in journey diagram |
-| fillType1 | secondaryColor          | \*   | Fill for 2nd section in journey diagram |
-| fillType2 | based on primaryColor   | \*   | Fill for 3rd section in journey diagram |
-| fillType3 | based on secondaryColor | \*   | Fill for 4th section in journey diagram |
-| fillType4 | based on primaryColor   | \*   | Fill for 5th section in journey diagram |
-| fillType5 | based on secondaryColor | \*   | Fill for 6th section in journey diagram |
-| fillType6 | based on primaryColor   | \*   | Fill for 7th section in journey diagram |
-| fillType7 | based on secondaryColor | \*   | Fill for 8th section in journey diagram |
-
-\*\*Notes: Values are meant to create an alternating look.
-
-# Here is an example of overriding `primaryColor` and giving everything a different look, using `%%init%%`.
-
-```mermaid-example
-%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#ff0000'}}}%%
-        graph TD
-          A[Christmas] -->|Get money| B(Go shopping)
-          B --> C{Let me think}
-          B --> G[/Another/]
-          C ==>|One| D[Laptop]
-          C -->|Two| E[iPhone]
-          C -->|Three| F[fa:fa-car Car]
-          subgraph section
-            C
-            D
-            E
-            F
-            G
-          end
-```
-
-```mermaid
-%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#ff0000'}}}%%
-        graph TD
-          A[Christmas] -->|Get money| B(Go shopping)
-          B --> C{Let me think}
-          B --> G[/Another/]
-          C ==>|One| D[Laptop]
-          C -->|Two| E[iPhone]
-          C -->|Three| F[fa:fa-car Car]
-          subgraph section
-            C
-            D
-            E
-            F
-            G
-          end
-```
-
-\*\*This got a bit too dark and bit too colorful. With some easy steps this can be fixed:
-
-- Make the primary color a little lighter
-- set the tertiary color to a reddish shade as well
-- make the edge label background differ from the subgraph by setting the edgeLabelBackground
-
-```mermaid-example
-%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#ffcccc', 'edgeLabelBackground':'#ffffee', 'tertiaryColor': '#fff0f0'}}}%%
-        graph TD
-          A[Christmas] -->|Get money| B(Go shopping)
-          B --> C{Let me think}
-          B --> G[/Another/]
-          C ==>|One| D[Laptop]
-          C -->|Two| E[iPhone]
-          C -->|Three| F[fa:fa-car Car]
-          subgraph section
-            C
-            D
-            E
-            F
-            G
-          end
-```
-
-```mermaid
-%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#ffcccc', 'edgeLabelBackground':'#ffffee', 'tertiaryColor': '#fff0f0'}}}%%
-        graph TD
-          A[Christmas] -->|Get money| B(Go shopping)
-          B --> C{Let me think}
-          B --> G[/Another/]
-          C ==>|One| D[Laptop]
-          C -->|Two| E[iPhone]
-          C -->|Three| F[fa:fa-car Car]
-          subgraph section
-            C
-            D
-            E
-            F
-            G
-          end
-```
-
-The Theming Engine does not admit color codes and will only accept proper color values. Color Names is not supported so for instance, the color value 'red' will not work, but '#ff0000' will work.
-
-# Common theming activities
-
-## How to change the color of the arrows
-
-# Examples:
-
-When adjusting a theme it might be helpful to look at how your preferred theme goes with the diagrams, to evaluate whether everything is visible and looks good.
-In the following examples, the directive `init` is used, with the `theme` being declared as `base`. For more information on using directives, read the documentation for [Version 8.6.0](/8.6.0_docs.md)
-
-### Flowchart
-
-```mermaid-example
-%%{init: {'securityLevel': 'loose', 'theme':'base'}}%%
-        graph TD
-          A[Christmas] -->|Get money| B(Go shopping)
-          B --> C{Let me think}
-          B --> G[/Another/]
-          C ==>|One| D[Laptop]
-          C -->|Two| E[iPhone]
-          C -->|Three| F[fa:fa-car Car]
-          subgraph section
-            C
-            D
-            E
-            F
-            G
-          end
-```
-
-```mermaid
-%%{init: {'securityLevel': 'loose', 'theme':'base'}}%%
-        graph TD
-          A[Christmas] -->|Get money| B(Go shopping)
-          B --> C{Let me think}
-          B --> G[/Another/]
-          C ==>|One| D[Laptop]
-          C -->|Two| E[iPhone]
-          C -->|Three| F[fa:fa-car Car]
-          subgraph section
-            C
-            D
-            E
-            F
-            G
-          end
-```
-
-### Flowchart (beta)
-
-```mermaid-example
-%%{init: {'securityLevel': 'loose', 'theme':'base'}}%%
-        flowchart TD
-          A[Christmas] -->|Get money| B(Go shopping)
-          B --> C{Let me think}
-          B --> G[Another]
-          C ==>|One| D[Laptop]
-          C x--x|Two| E[iPhone]
-          C o--o|Three| F[fa:fa-car Car]
-          subgraph section
-            C
-            D
-            E
-            F
-            G
-          end
-```
-
-```mermaid
-%%{init: {'securityLevel': 'loose', 'theme':'base'}}%%
-        flowchart TD
-          A[Christmas] -->|Get money| B(Go shopping)
-          B --> C{Let me think}
-          B --> G[Another]
-          C ==>|One| D[Laptop]
-          C x--x|Two| E[iPhone]
-          C o--o|Three| F[fa:fa-car Car]
-          subgraph section
-            C
-            D
-            E
-            F
-            G
-          end
-```
-
-### Sequence diagram
-
-```mermaid-example
-%%{init: {'securityLevel': 'loose', 'theme':'base'}}%%
-        sequenceDiagram
-          autonumber
-          par Action 1
-            Alice->>John: Hello John, how are you?
-          and Action 2
-            Alice->>Bob: Hello Bob, how are you?
-          end
-          Alice->>+John: Hello John, how are you?
-          Alice->>+John: John, can you hear me?
-          John-->>-Alice: Hi Alice, I can hear you!
-          Note right of John: John is perceptive
-          John-->>-Alice: I feel great!
-              loop Every minute
-                John-->Alice: Great!
-            end
-```
-
-```mermaid
-%%{init: {'securityLevel': 'loose', 'theme':'base'}}%%
-        sequenceDiagram
-          autonumber
-          par Action 1
-            Alice->>John: Hello John, how are you?
-          and Action 2
-            Alice->>Bob: Hello Bob, how are you?
-          end
-          Alice->>+John: Hello John, how are you?
-          Alice->>+John: John, can you hear me?
-          John-->>-Alice: Hi Alice, I can hear you!
-          Note right of John: John is perceptive
-          John-->>-Alice: I feel great!
-              loop Every minute
-                John-->Alice: Great!
-            end
-```
-
-### Class diagram
-
-```mermaid-example
-%%{init: {'securityLevel': 'loose', 'theme':'base'}}%%
-
-classDiagram
-	Animal "1" <|-- Duck
-	Animal <|-- Fish
-	Animal <--o Zebra
-	Animal : +int age
-	Animal : +String gender
-	Animal: +isMammal()
-	Animal: +mate()
-	class Duck{
-		+String beakColor
-		+swim()
-		+quack()
-	}
-	class Fish{
-		-int sizeInFeet
-		-canEat()
-	}
-	class Zebra{
-		+bool is_wild
-		+run()
-	}
-```
-
-```mermaid
-%%{init: {'securityLevel': 'loose', 'theme':'base'}}%%
-
-classDiagram
-	Animal "1" <|-- Duck
-	Animal <|-- Fish
-	Animal <--o Zebra
-	Animal : +int age
-	Animal : +String gender
-	Animal: +isMammal()
-	Animal: +mate()
-	class Duck{
-		+String beakColor
-		+swim()
-		+quack()
-	}
-	class Fish{
-		-int sizeInFeet
-		-canEat()
-	}
-	class Zebra{
-		+bool is_wild
-		+run()
-	}
-```
-
-### Gantt
-
-```mermaid-example
-gantt
-       dateFormat                YYYY-MM-DD
-       title                     Adding GANTT diagram functionality to mermaid
-       excludes                  :excludes the named dates/days from being included in a charted task..
-       section A section
-       Completed task            :done,    des1, 2014-01-06,2014-01-08
-       Active task               :active,  des2, 2014-01-09, 3d
-       Future task               :         des3, after des2, 5d
-       Future task2              :         des4, after des3, 5d
-
-       section Critical tasks
-       Completed task in the critical line :crit, done, 2014-01-06,24h
-       Implement parser and jison          :crit, done, after des1, 2d
-       Create tests for parser             :crit, active, 3d
-       Future task in critical line        :crit, 5d
-       Create tests for renderer           :2d
-       Add to mermaid                      :1d
-
-       section Documentation
-       Describe gantt syntax               :active, a1, after des1, 3d
-       Add gantt diagram to demo page      :after a1  , 20h
-       Add another diagram to demo page    :doc1, after a1  , 48h
-
-       section Last section
-       Describe gantt syntax               :after doc1, 3d
-       Add gantt diagram to demo page      :20h
-       Add another diagram to demo page    :48h
-```
-
-```mermaid
-gantt
-       dateFormat                YYYY-MM-DD
-       title                     Adding GANTT diagram functionality to mermaid
-       excludes                  :excludes the named dates/days from being included in a charted task..
-       section A section
-       Completed task            :done,    des1, 2014-01-06,2014-01-08
-       Active task               :active,  des2, 2014-01-09, 3d
-       Future task               :         des3, after des2, 5d
-       Future task2              :         des4, after des3, 5d
-
-       section Critical tasks
-       Completed task in the critical line :crit, done, 2014-01-06,24h
-       Implement parser and jison          :crit, done, after des1, 2d
-       Create tests for parser             :crit, active, 3d
-       Future task in critical line        :crit, 5d
-       Create tests for renderer           :2d
-       Add to mermaid                      :1d
-
-       section Documentation
-       Describe gantt syntax               :active, a1, after des1, 3d
-       Add gantt diagram to demo page      :after a1  , 20h
-       Add another diagram to demo page    :doc1, after a1  , 48h
-
-       section Last section
-       Describe gantt syntax               :after doc1, 3d
-       Add gantt diagram to demo page      :20h
-       Add another diagram to demo page    :48h
-```
-
-### State diagram
-
-```mermaid-example
-%%{init: {'securityLevel': 'loose', 'theme':'base'}}%%
-      stateDiagram
-        [*] --> Active
-
-        state Active {
-            [*] --> NumLockOff
-            NumLockOff --> NumLockOn : EvNumLockPressed
-            NumLockOn --> NumLockOff : EvNumLockPressed
-            --
-            [*] --> CapsLockOff
-            CapsLockOff --> CapsLockOn : EvCapsLockPressed
-            CapsLockOn --> CapsLockOff : EvCapsLockPressed
-            --
-            [*] --> ScrollLockOff
-            ScrollLockOff --> ScrollLockOn : EvCapsLockPressed
-            ScrollLockOn --> ScrollLockOff : EvCapsLockPressed
-        }
-        state SomethingElse {
-          A --> B
-          B --> A
-        }
-
-        Active --> SomethingElse
-        note right of SomethingElse : This is the note to the right.
-
-        SomethingElse --> [*]
-
-```
-
-```mermaid
-%%{init: {'securityLevel': 'loose', 'theme':'base'}}%%
-      stateDiagram
-        [*] --> Active
-
-        state Active {
-            [*] --> NumLockOff
-            NumLockOff --> NumLockOn : EvNumLockPressed
-            NumLockOn --> NumLockOff : EvNumLockPressed
-            --
-            [*] --> CapsLockOff
-            CapsLockOff --> CapsLockOn : EvCapsLockPressed
-            CapsLockOn --> CapsLockOff : EvCapsLockPressed
-            --
-            [*] --> ScrollLockOff
-            ScrollLockOff --> ScrollLockOn : EvCapsLockPressed
-            ScrollLockOn --> ScrollLockOff : EvCapsLockPressed
-        }
-        state SomethingElse {
-          A --> B
-          B --> A
-        }
-
-        Active --> SomethingElse
-        note right of SomethingElse : This is the note to the right.
-
-        SomethingElse --> [*]
-
-```
-
-### State diagram (beta)
-
-```mermaid-example
-%%{init: {'securityLevel': 'loose', 'theme':'base'}}%%
-stateDiagram-v2
-        [*] --> Active
-
-        state Active {
-            [*] --> NumLockOff
-            NumLockOff --> NumLockOn : EvNumLockPressed
-            NumLockOn --> NumLockOff : EvNumLockPressed
-            --
-            [*] --> CapsLockOff
-            CapsLockOff --> CapsLockOn : EvCapsLockPressed
-            CapsLockOn --> CapsLockOff : EvCapsLockPressed
-            --
-            [*] --> ScrollLockOff
-            ScrollLockOff --> ScrollLockOn : EvCapsLockPressed
-            ScrollLockOn --> ScrollLockOff : EvCapsLockPressed
-        }
-        state SomethingElse {
-          A --> B
-          B --> A
-        }
-
-        Active --> SomethingElse2
-        note right of SomethingElse2 : This is the note to the right.
-
-        SomethingElse2 --> [*]
-```
-
-```mermaid
-%%{init: {'securityLevel': 'loose', 'theme':'base'}}%%
-stateDiagram-v2
-        [*] --> Active
-
-        state Active {
-            [*] --> NumLockOff
-            NumLockOff --> NumLockOn : EvNumLockPressed
-            NumLockOn --> NumLockOff : EvNumLockPressed
-            --
-            [*] --> CapsLockOff
-            CapsLockOff --> CapsLockOn : EvCapsLockPressed
-            CapsLockOn --> CapsLockOff : EvCapsLockPressed
-            --
-            [*] --> ScrollLockOff
-            ScrollLockOff --> ScrollLockOn : EvCapsLockPressed
-            ScrollLockOn --> ScrollLockOff : EvCapsLockPressed
-        }
-        state SomethingElse {
-          A --> B
-          B --> A
-        }
-
-        Active --> SomethingElse2
-        note right of SomethingElse2 : This is the note to the right.
-
-        SomethingElse2 --> [*]
-```
-
-### Entity Relations diagram
-
-```mermaid-example
-      erDiagram
-        CUSTOMER }|..|{ DELIVERY-ADDRESS : has
-        CUSTOMER ||--o{ ORDER : places
-        CUSTOMER ||--o{ INVOICE : "liable for"
-        DELIVERY-ADDRESS ||--o{ ORDER : receives
-        INVOICE ||--|{ ORDER : covers
-        ORDER ||--|{ ORDER-ITEM : includes
-        PRODUCT-CATEGORY ||--|{ PRODUCT : contains
-        PRODUCT ||--o{ ORDER-ITEM : "ordered in"
-```
-
-```mermaid
-      erDiagram
-        CUSTOMER }|..|{ DELIVERY-ADDRESS : has
-        CUSTOMER ||--o{ ORDER : places
-        CUSTOMER ||--o{ INVOICE : "liable for"
-        DELIVERY-ADDRESS ||--o{ ORDER : receives
-        INVOICE ||--|{ ORDER : covers
-        ORDER ||--|{ ORDER-ITEM : includes
-        PRODUCT-CATEGORY ||--|{ PRODUCT : contains
-        PRODUCT ||--o{ ORDER-ITEM : "ordered in"
-```
-
-### User journey diagram
-
-```mermaid-example
-journey
-            title My working day
-            section Go to work
-              Make tea: 5: Me
-              Go upstairs: 3: Me
-              Do work: 1: Me, Cat
-            section Go home
-              Go downstairs: 5: Me
-              Sit down: 5: Me
-```
-
-```mermaid
-journey
-            title My working day
-            section Go to work
-              Make tea: 5: Me
-              Go upstairs: 3: Me
-              Do work: 1: Me, Cat
-            section Go home
-              Go downstairs: 5: Me
-              Sit down: 5: Me
-```
+## Color and Color Calculation
+
+To ensure diagram readability, the default value of certain variables is calculated or derived from other variables. For example, `primaryBorderColor` is derived from the `primaryColor` variable. So if the `primaryColor` variable is customized, Mermaid will adjust `primaryBorderColor` automatically. Adjustments can mean a color inversion, a hue change, a darkening/lightening by 10%, etc.
+
+The theming engine will only recognize hex colors and not color names. So, the value `#ff0000` will work, but `red` will not.
+
+## Theme Variables
+
+| Variable             | Default value                      | Description                                                                                                                      |
+| -------------------- | ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
+| darkMode             | false                              | Affects how derived colors are calculated. Set value to `true` for darkmode.                                                     |
+| background           | #f4f4f4                            | Used to calculate color for items that should either be background colored or contrasting to the background                      |
+| fontFamily           | trebuchet ms, verdana, arial       |                                                                                                                                  |
+| fontSize             | 16px                               | Font size in pixels                                                                                                              |
+| primaryColor         | #fff4dd                            | Color to be used as background in nodes, other colors will be derived from this                                                  |
+| primaryBorderColor   | calculated from primaryColor       | Color to be used as border in nodes using `primaryColor`                                                                         |
+| primaryBorderColor   | calculated from primaryColor       | Color to be used as border in nodes using `primaryColor`                                                                         |
+| primaryTextColor     | calculated from darkMode #ddd/#333 | Color to be used as text color in nodes using `primaryColor`                                                                     |
+| secondaryColor       | calculated from primaryColor       |                                                                                                                                  |
+| primaryBorderColor   | calculated from primaryColor       | Color to be used as border in nodes using `primaryColor`                                                                         |
+| secondaryBorderColor | calculated from secondaryColor     | Color to be used as border in nodes using `secondaryColor`                                                                       |
+| primaryBorderColor   | calculated from primaryColor       | Color to be used as border in nodes using `primaryColor`                                                                         |
+| secondaryTextColor   | calculated from secondaryColor     | Color to be used as text color in nodes using `secondaryColor`                                                                   |
+| tertiaryColor        | calculated from primaryColor       |                                                                                                                                  |
+| tertiaryBorderColor  | calculated from tertiaryColor      | Color to be used as border in nodes using `tertiaryColor`                                                                        |
+| tertiaryTextColor    | calculated from tertiaryColor      | Color to be used as text color in nodes using `tertiaryColor`                                                                    |
+| noteBkgColor         | #fff5ad                            | Color used as background in notes                                                                                                |
+| noteTextColor        | #333                               | Text color in note rectangles                                                                                                    |
+| noteBorderColor      | calculated from noteBkgColor       | Border color in note rectangles                                                                                                  |
+| lineColor            | calculated from background         |                                                                                                                                  |
+| textColor            | calculated from primaryTextColor   | Text in diagram over the background for instance text on labels and on signals in sequence diagram or the title in Gantt diagram |
+| mainBkg              | calculated from primaryColor       | Background in flowchart objects like rects/circles, class diagram classes, sequence diagram etc                                  |
+| errorBkgColor        | tertiaryColor                      | Color for syntax error message                                                                                                   |
+| errorTextColor       | tertiaryTextColor                  | Color for syntax error message                                                                                                   |
+
+## Flowchart Variables
+
+| Variable            | Default value                  | Description                 |
+| ------------------- | ------------------------------ | --------------------------- |
+| nodeBorder          | primaryBorderColor             | Node Border Color           |
+| clusterBkg          | tertiaryColor                  | Background in subgraphs     |
+| clusterBorder       | tertiaryBorderColor            | Cluster Border Color        |
+| defaultLinkColor    | lineColor                      | Link Color                  |
+| titleColor          | tertiaryTextColor              | Title Color                 |
+| edgeLabelBackground | calculated from secondaryColor |                             |
+| nodeTextColor       | primaryTextColor               | Color for text inside Nodes |
+
+## Sequence Diagram Variables
+
+| Variable              | Default value                  | Description                 |
+| --------------------- | ------------------------------ | --------------------------- |
+| actorBkg              | mainBkg                        | Actor Background Color      |
+| actorBorder           | primaryBorderColor             | Actor Border Color          |
+| actorTextColor        | primaryTextColor               | Actor Text Color            |
+| actorLineColor        | grey                           | Actor Line Color            |
+| signalColor           | textColor                      | Signal Color                |
+| signalTextColor       | textColor                      | Signal Text Color           |
+| labelBoxBkgColor      | actorBkg                       | Label Box Background Color  |
+| labelBoxBorderColor   | actorBorder                    | Label Box Border Color      |
+| labelTextColor        | actorTextColor                 | Label Text Color            |
+| loopTextColor         | actorTextColor                 | Loop Text Color             |
+| activationBorderColor | calculated from secondaryColor | Activation Border Color     |
+| activationBkgColor    | secondaryColor                 | Activation Background Color |
+| sequenceNumberColor   | calculated from lineColor      | Sequence Number Color       |
+
+## State Colors
+
+| Variable      | Default value    | Description                                  |
+| ------------- | ---------------- | -------------------------------------------- |
+| labelColor    | primaryTextColor |                                              |
+| altBackground | tertiaryColor    | Used for background in deep composite states |
+
+## Class Colors
+
+| Variable  | Default value | Description                     |
+| --------- | ------------- | ------------------------------- |
+| classText | textColor     | Color of Text in class diagrams |
+
+## User Journey Colors
+
+| Variable  | Default value                  | Description                             |
+| --------- | ------------------------------ | --------------------------------------- |
+| fillType0 | primaryColor                   | Fill for 1st section in journey diagram |
+| fillType1 | secondaryColor                 | Fill for 2nd section in journey diagram |
+| fillType2 | calculated from primaryColor   | Fill for 3rd section in journey diagram |
+| fillType3 | calculated from secondaryColor | Fill for 4th section in journey diagram |
+| fillType4 | calculated from primaryColor   | Fill for 5th section in journey diagram |
+| fillType5 | calculated from secondaryColor | Fill for 6th section in journey diagram |
+| fillType6 | calculated from primaryColor   | Fill for 7th section in journey diagram |
+| fillType7 | calculated from secondaryColor | Fill for 8th section in journey diagram |
diff --git a/packages/mermaid/src/docs/config/theming.md b/packages/mermaid/src/docs/config/theming.md
index 78f3546cc..2dcc9a561 100644
--- a/packages/mermaid/src/docs/config/theming.md
+++ b/packages/mermaid/src/docs/config/theming.md
@@ -1,30 +1,26 @@
 # Theme Configuration
 
-With Version 8.7.0 Mermaid comes out with a system for dynamic and integrated configuration of themes. The intent is to increase the customizability and ease of styling for mermaid diagrams.
+Dynamic and integrated theme configuration was introduced in Mermaid version 8.7.0.
 
-The theme can be altered by changing the root level variable `theme` variable in the configuration. To change it for the whole site you must use the `initialize` call. To do it for just for a single diagram you can use the `%%init%%` directive
+Themes can now be customized at the site-wide level, or on individual Mermaid diagrams. For site-wide theme customization, the `initialize` call is used. For diagram specific customization, the `init` directive is used.
 
-Themes follow and build upon the Levels of Configuration, and employ `directives` to modify and create custom configurations, as they were introduced in Version [8.6.0](./8.6.0_docs.md).
+## Available Themes
 
-## Deployable Themes
+1. **default** - This is the default theme for all diagrams.
 
-The following are a list of **Deployable themes**, sample `%%init%%` directives and `initialize` calls.
+1. **neutral** - This theme is great for black and white documents that will be printed.
 
-1. **base**- Designed to be modified, as the name implies it is supposed to be used as the base for making custom themes.
+1. **dark** - This theme goes well with dark-colored elements or dark-mode.
 
-2. **forest**- A theme full of light greens that is easy on the eyes.
+1. **forest** - This theme contains shades of green.
 
-3. **dark**- A theme that would go well with other dark-colored elements.
+1. **base** - This is the only theme that can be modified. Use this theme as the base for customizations.
 
-4. **default**- The default theme for all diagrams.
+## Site-wide Theme
 
-5. **neutral**- The theme to be used for black and white printing.
+To customize themes site-wide, call the `initialize` method on the `mermaidAPI`.
 
-## Site-wide Themes
-
-Site-wide themes are declared via `initialize` by site owners.
-
-Example of `Initialize` call setting `theme` to `base`:
+Example of `initialize` call setting `theme` to `base`:
 
 ```javascript
 mermaidAPI.initialize({
@@ -33,22 +29,46 @@ mermaidAPI.initialize({
 });
 ```
 
-**Notes**: Only site owners can use the `mermaidAPI.initialize` call, to set values. Site-Users will have to use `%%init%%` to modify or create the theme for their diagrams.
+## Diagram-specific Themes
 
-## Themes at the Local or Current Level
+To customize the theme of an individual diagram, use the `init` directive.
 
-When Generating a diagram using on a webpage that supports mermaid. It is also possible to override site-wide theme settings locally, for a specific diagram, using directives, as long as it is not prohibited by the `secure` array.
+Example of `init` directive setting the `theme` to `forest`:
 
 ```mmd
-%%{init: {'theme':'base'}}%%
+%%{init: {'theme':'forest'}}%%
   graph TD
     a --> b
 ```
 
-Here is an example of how `%%init%%` can set the theme to 'base', this assumes that `themeVariables` are set to default:
+> **Reminder**: the only theme that can be customed is the `base` theme. The following section covers how to use `themeVariables` for customizations.
+
+## Customizing Themes with `themeVariables`
+
+To make a custom theme, modify `themeVariables` via `init`.
+
+You will need to use the [base](#available-themes) theme as it is the only modifiable theme.
+
+| Parameter      | Description                                                        | Type   | Properties                         |
+| -------------- | ------------------------------------------------------------------ | ------ | ---------------------------------- |
+| themeVariables | Modifiable with the `init` directive | Object | `primaryColor`, `primaryTextColor`, `lineColor` ([see full list](#theme-variables-reference-table)) |
+
+Example of modifying `themeVariables` using the `init` directive:
 
 ```mermaid-example
-%%{init: {'theme':'base'}}%%
+%%{
+  init: {
+    'theme': 'base',
+    'themeVariables': {
+      'primaryColor': '#BB2528',
+      'primaryTextColor': '#fff',
+      'primaryBorderColor': '#7C0000',
+      'lineColor': '#F8B229',
+      'secondaryColor': '#006100',
+      'tertiaryColor': '#fff'
+    }
+  }
+}%%
         graph TD
           A[Christmas] -->|Get money| B(Go shopping)
           B --> C{Let me think}
@@ -65,402 +85,93 @@ Here is an example of how `%%init%%` can set the theme to 'base', this assumes t
           end
 ```
 
-# List of Themes
-
-# Customizing Themes with `themeVariables`
-
-The easiest way to make a custom theme is to start with the base theme, and just modify theme variables through `themeVariables`, via `%%init%%`.
-
-| Parameter      | Description                                                        | Type  | Required | Objects contained                  |
-| -------------- | ------------------------------------------------------------------ | ----- | -------- | ---------------------------------- |
-| themeVariables | Array containing objects, modifiable with the `%%init%%` directive | Array | Required | primaryColor, lineColor, textColor |
-
-**Here is an example of overriding `primaryColor` through `themeVariables` and giving everything a different look, using `%%init%%`.**
-
-```mermaid-example
-%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#ff0000'}}}%%
-        graph TD
-          A[Christmas] -->|Get money| B(Go shopping)
-          B --> C{Let me think}
-          B --> G[/Another/]
-          C ==>|One| D[Laptop]
-          C -->|Two| E[iPhone]
-          C -->|Three| F[fa:fa-car Car]
-          subgraph section
-            C
-            D
-            E
-            F
-            G
-          end
-```
-
-**Notes:**
-Leaving it empty will set all variable values to default.
-
-## Color and Color Calculation:
-
-Color definitions have certain interactions in mermaid, this is in order to ensure visibility for diagrams. Mermaid will adjust some variables automatically, when colors are changed in order to compensate and maintain readability.
-
-**The Default Value Column** to the right of the Variable column will denote the Variable paired/associated with the Variable on the left and the nature of this pairing or association. If it for instance says primaryColor it means that it gets primaryColor as default value. If it says "based on primaryColor" it means that it is calculated/ derived from primaryColor. This calculation can be primary color inversion, a change of hue, darkening or lightening by 10%, etc.
-
-You can create your own themes, by changing any of the given variables below. If you are using a dark background, set dark mode to true to adjust the colors. It is possible to override the calculations using the variable names below, with `%%init%%` if you wish to style it differently.
-
-## Theme Variables Reference Table
-
-```note
-Variables that are unique to some diagrams can be affected by changes in Theme Variables
-```
-
-| Variable             | Default/Base/Factor value      | Calc | Description                                                                                                                      |
-| -------------------- | ------------------------------ | ---- | -------------------------------------------------------------------------------------------------------------------------------- |
-| darkMode             | false                          |      | Boolean Value that dictates how to calculate colors. "true" will activate darkmode.                                              |
-| background           | #f4f4f4                        |      | Used to calculate color for items that should either be background colored or contrasting to the background.                     |
-| fontFamily           | "trebuchet ms", verdana, arial |      |                                                                                                                                  |
-| fontSize             | 16px                           |      | Font Size, in pixels                                                                                                             |
-| primaryColor         | #fff4dd                        |      | Color to be used as background in nodes, other colors will be derived from this                                                  |
-| primaryBorderColor   | based on primaryColor          | \*   | Color to be used as border in nodes using primaryColor                                                                           |
-| primaryTextColor     | based on darkMode #ddd/#333    | \*   | Color to be used as text color in nodes using primaryColor                                                                       |
-| secondaryColor       | based on primaryColor          | \*   |                                                                                                                                  |
-| secondaryBorderColor | based on secondaryColor        | \*   | Color to be used as border in nodes using secondaryColor                                                                         |
-| secondaryTextColor   | based on secondaryColor        | \*   | Color to be used as text color in nodes using secondaryColor                                                                     |
-| tertiaryColor        | based on primaryColor          | \*   |                                                                                                                                  |
-| tertiaryBorderColor  | based on tertiaryColor         | \*   | Color to be used as border in nodes using tertiaryColor                                                                          |
-| tertiaryTextColor    | based on tertiaryColor         | \*   | Color to be used as text color in nodes using tertiaryColor                                                                      |
-| noteBkgColor         | #fff5ad                        |      | Color used as background in notes                                                                                                |
-| noteTextColor        | #333                           |      | Text color in note rectangles.                                                                                                   |
-| noteBorderColor      | based on noteBkgColor          | \*   | Border color in note rectangles.                                                                                                 |
-| lineColor            | based on background            | \*   |                                                                                                                                  |
-| textColor            | based on primaryTextColor      | \*   | Text in diagram over the background for instance text on labels and on signals in sequence diagram or the title in gantt diagram |
-| mainBkg              | based on primaryColor          | \*   | Background in flowchart objects like rects/circles, class diagram classes, sequence diagram etc                                  |
-| errorBkgColor        | tertiaryColor                  | \*   | Color for syntax error message                                                                                                   |
-| errorTextColor       | tertiaryTextColor              | \*   | Color for syntax error message                                                                                                   |
-
-# What follows are Variables, specific to different diagrams and charts.
-
-## Some Theme Variables serve as, or affect the Default Values for Specific Diagram Variables, unless changed using `%%init%%` .
-
-## Flowchart
-
-| Variable            | Default/ Associated Value | Calc | Description                  |
-| ------------------- | ------------------------- | ---- | ---------------------------- |
-| nodeBorder          | primaryBorderColor        | \*   | Node Border Color            |
-| clusterBkg          | tertiaryColor             | \*   | Background in subgraphs      |
-| clusterBorder       | tertiaryBorderColor       | \*   | Cluster Border Color         |
-| defaultLinkColor    | lineColor                 | \*   | Link Color                   |
-| titleColor          | tertiaryTextColor         | \*   | Title Color                  |
-| edgeLabelBackground | based on secondaryColor   | \*   |                              |
-| nodeTextColor       | primaryTextColor          | \*   | Color for text inside Nodes. |
-
-# sequence diagram
-
-| name                  | Default value           | Calc | Description                 |
-| --------------------- | ----------------------- | ---- | --------------------------- |
-| actorBorder           | primaryBorderColor      | \*   | Actor Border Color          |
-| actorBkg              | mainBkg                 | \*   | Actor Background Color      |
-| actorTextColor        | primaryTextColor        | \*   | Actor Text Color            |
-| actorLineColor        | grey                    | \*   | Actor Line Color            |
-| signalColor           | textColor               | \*   | Signal Color                |
-| signalTextColor       | textColor               | \*   | Signal Text Color           |
-| labelBoxBkgColor      | actorBkg                | \*   | Label Box Background Color  |
-| labelBoxBorderColor   | actorBorder             | \*   | Label Box Border Color      |
-| labelTextColor        | actorTextColor          | \*   | Label Text Color            |
-| loopTextColor         | actorTextColor          | \*   | Loop ext Color              |
-| activationBorderColor | based on secondaryColor | \*   | Activation Border Color     |
-| activationBkgColor    | secondaryColor          | \*   | Activation Background Color |
-| sequenceNumberColor   | based on lineColor      | \*   | Sequence Number Color       |
-
-# state colors
-
-| name          | Default value    | Calc | Description                                  |
-| ------------- | ---------------- | ---- | -------------------------------------------- |
-| labelColor    | primaryTextColor | \*   |                                              |
-| altBackground | tertiaryColor    | \*   | Used for background in deep composite states |
-
-# class colors
-
-| name      | Default value | Calc | Description                     |
-| --------- | ------------- | ---- | ------------------------------- |
-| classText | textColor     | \*   | Color of Text in class diagrams |
-
-# User journey colors
-
-| name      | Default value           | Calc | Description                             |
-| --------- | ----------------------- | ---- | --------------------------------------- |
-| fillType0 | primaryColor            | \*   | Fill for 1st section in journey diagram |
-| fillType1 | secondaryColor          | \*   | Fill for 2nd section in journey diagram |
-| fillType2 | based on primaryColor   | \*   | Fill for 3rd section in journey diagram |
-| fillType3 | based on secondaryColor | \*   | Fill for 4th section in journey diagram |
-| fillType4 | based on primaryColor   | \*   | Fill for 5th section in journey diagram |
-| fillType5 | based on secondaryColor | \*   | Fill for 6th section in journey diagram |
-| fillType6 | based on primaryColor   | \*   | Fill for 7th section in journey diagram |
-| fillType7 | based on secondaryColor | \*   | Fill for 8th section in journey diagram |
-
-\*\*Notes: Values are meant to create an alternating look.
-
-# Here is an example of overriding `primaryColor` and giving everything a different look, using `%%init%%`.
-
-```mermaid-example
-%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#ff0000'}}}%%
-        graph TD
-          A[Christmas] -->|Get money| B(Go shopping)
-          B --> C{Let me think}
-          B --> G[/Another/]
-          C ==>|One| D[Laptop]
-          C -->|Two| E[iPhone]
-          C -->|Three| F[fa:fa-car Car]
-          subgraph section
-            C
-            D
-            E
-            F
-            G
-          end
-```
-
-\*\*This got a bit too dark and bit too colorful. With some easy steps this can be fixed:
-
-- Make the primary color a little lighter
-- set the tertiary color to a reddish shade as well
-- make the edge label background differ from the subgraph by setting the edgeLabelBackground
-
-```mermaid-example
-%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#ffcccc', 'edgeLabelBackground':'#ffffee', 'tertiaryColor': '#fff0f0'}}}%%
-        graph TD
-          A[Christmas] -->|Get money| B(Go shopping)
-          B --> C{Let me think}
-          B --> G[/Another/]
-          C ==>|One| D[Laptop]
-          C -->|Two| E[iPhone]
-          C -->|Three| F[fa:fa-car Car]
-          subgraph section
-            C
-            D
-            E
-            F
-            G
-          end
-```
-
-The Theming Engine does not admit color codes and will only accept proper color values. Color Names is not supported so for instance, the color value 'red' will not work, but '#ff0000' will work.
-
-# Common theming activities
-
-## How to change the color of the arrows
-
-# Examples:
-
-When adjusting a theme it might be helpful to look at how your preferred theme goes with the diagrams, to evaluate whether everything is visible and looks good.
-In the following examples, the directive `init` is used, with the `theme` being declared as `base`. For more information on using directives, read the documentation for [Version 8.6.0](/8.6.0_docs.md)
-
-### Flowchart
-
-```mermaid-example
-%%{init: {'securityLevel': 'loose', 'theme':'base'}}%%
-        graph TD
-          A[Christmas] -->|Get money| B(Go shopping)
-          B --> C{Let me think}
-          B --> G[/Another/]
-          C ==>|One| D[Laptop]
-          C -->|Two| E[iPhone]
-          C -->|Three| F[fa:fa-car Car]
-          subgraph section
-            C
-            D
-            E
-            F
-            G
-          end
-```
-
-### Flowchart (beta)
-
-```mermaid-example
-%%{init: {'securityLevel': 'loose', 'theme':'base'}}%%
-        flowchart TD
-          A[Christmas] -->|Get money| B(Go shopping)
-          B --> C{Let me think}
-          B --> G[Another]
-          C ==>|One| D[Laptop]
-          C x--x|Two| E[iPhone]
-          C o--o|Three| F[fa:fa-car Car]
-          subgraph section
-            C
-            D
-            E
-            F
-            G
-          end
-```
-
-### Sequence diagram
-
-```mermaid-example
-%%{init: {'securityLevel': 'loose', 'theme':'base'}}%%
-        sequenceDiagram
-          autonumber
-          par Action 1
-            Alice->>John: Hello John, how are you?
-          and Action 2
-            Alice->>Bob: Hello Bob, how are you?
-          end
-          Alice->>+John: Hello John, how are you?
-          Alice->>+John: John, can you hear me?
-          John-->>-Alice: Hi Alice, I can hear you!
-          Note right of John: John is perceptive
-          John-->>-Alice: I feel great!
-              loop Every minute
-                John-->Alice: Great!
-            end
-```
-
-### Class diagram
-
-```mermaid-example
-%%{init: {'securityLevel': 'loose', 'theme':'base'}}%%
-
-classDiagram
-	Animal "1" <|-- Duck
-	Animal <|-- Fish
-	Animal <--o Zebra
-	Animal : +int age
-	Animal : +String gender
-	Animal: +isMammal()
-	Animal: +mate()
-	class Duck{
-		+String beakColor
-		+swim()
-		+quack()
-	}
-	class Fish{
-		-int sizeInFeet
-		-canEat()
-	}
-	class Zebra{
-		+bool is_wild
-		+run()
-	}
-```
-
-### Gantt
-
-```mermaid-example
-gantt
-       dateFormat                YYYY-MM-DD
-       title                     Adding GANTT diagram functionality to mermaid
-       excludes                  :excludes the named dates/days from being included in a charted task..
-       section A section
-       Completed task            :done,    des1, 2014-01-06,2014-01-08
-       Active task               :active,  des2, 2014-01-09, 3d
-       Future task               :         des3, after des2, 5d
-       Future task2              :         des4, after des3, 5d
-
-       section Critical tasks
-       Completed task in the critical line :crit, done, 2014-01-06,24h
-       Implement parser and jison          :crit, done, after des1, 2d
-       Create tests for parser             :crit, active, 3d
-       Future task in critical line        :crit, 5d
-       Create tests for renderer           :2d
-       Add to mermaid                      :1d
-
-       section Documentation
-       Describe gantt syntax               :active, a1, after des1, 3d
-       Add gantt diagram to demo page      :after a1  , 20h
-       Add another diagram to demo page    :doc1, after a1  , 48h
-
-       section Last section
-       Describe gantt syntax               :after doc1, 3d
-       Add gantt diagram to demo page      :20h
-       Add another diagram to demo page    :48h
-```
-
-### State diagram
-
-```mermaid-example
-%%{init: {'securityLevel': 'loose', 'theme':'base'}}%%
-      stateDiagram
-        [*] --> Active
-
-        state Active {
-            [*] --> NumLockOff
-            NumLockOff --> NumLockOn : EvNumLockPressed
-            NumLockOn --> NumLockOff : EvNumLockPressed
-            --
-            [*] --> CapsLockOff
-            CapsLockOff --> CapsLockOn : EvCapsLockPressed
-            CapsLockOn --> CapsLockOff : EvCapsLockPressed
-            --
-            [*] --> ScrollLockOff
-            ScrollLockOff --> ScrollLockOn : EvCapsLockPressed
-            ScrollLockOn --> ScrollLockOff : EvCapsLockPressed
-        }
-        state SomethingElse {
-          A --> B
-          B --> A
-        }
-
-        Active --> SomethingElse
-        note right of SomethingElse : This is the note to the right.
-
-        SomethingElse --> [*]
-
-```
-
-### State diagram (beta)
-
-```mermaid-example
-%%{init: {'securityLevel': 'loose', 'theme':'base'}}%%
-stateDiagram-v2
-        [*] --> Active
-
-        state Active {
-            [*] --> NumLockOff
-            NumLockOff --> NumLockOn : EvNumLockPressed
-            NumLockOn --> NumLockOff : EvNumLockPressed
-            --
-            [*] --> CapsLockOff
-            CapsLockOff --> CapsLockOn : EvCapsLockPressed
-            CapsLockOn --> CapsLockOff : EvCapsLockPressed
-            --
-            [*] --> ScrollLockOff
-            ScrollLockOff --> ScrollLockOn : EvCapsLockPressed
-            ScrollLockOn --> ScrollLockOff : EvCapsLockPressed
-        }
-        state SomethingElse {
-          A --> B
-          B --> A
-        }
-
-        Active --> SomethingElse2
-        note right of SomethingElse2 : This is the note to the right.
-
-        SomethingElse2 --> [*]
-```
-
-### Entity Relations diagram
-
-```mermaid-example
-      erDiagram
-        CUSTOMER }|..|{ DELIVERY-ADDRESS : has
-        CUSTOMER ||--o{ ORDER : places
-        CUSTOMER ||--o{ INVOICE : "liable for"
-        DELIVERY-ADDRESS ||--o{ ORDER : receives
-        INVOICE ||--|{ ORDER : covers
-        ORDER ||--|{ ORDER-ITEM : includes
-        PRODUCT-CATEGORY ||--|{ PRODUCT : contains
-        PRODUCT ||--o{ ORDER-ITEM : "ordered in"
-```
-
-### User journey diagram
-
-```mermaid-example
-journey
-            title My working day
-            section Go to work
-              Make tea: 5: Me
-              Go upstairs: 3: Me
-              Do work: 1: Me, Cat
-            section Go home
-              Go downstairs: 5: Me
-              Sit down: 5: Me
-```
+## Color and Color Calculation
+
+To ensure diagram readability, the default value of certain variables is calculated or derived from other variables. For example, `primaryBorderColor` is derived from the `primaryColor` variable. So if the `primaryColor` variable is customized, Mermaid will adjust `primaryBorderColor` automatically. Adjustments can mean a color inversion, a hue change, a darkening/lightening by 10%, etc.
+
+The theming engine will only recognize hex colors and not color names. So, the value `#ff0000` will work, but `red` will not.
+
+## Theme Variables
+
+| Variable             | Default value                          | Description                                                                                                                      |
+| -------------------- | -------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
+| darkMode             | false                                  | Affects how derived colors are calculated. Set value to `true` for darkmode.                                                     |
+| background           | #f4f4f4                                | Used to calculate color for items that should either be background colored or contrasting to the background                      |
+| fontFamily           | trebuchet ms, verdana, arial           |                                                                                                                                  |
+| fontSize             | 16px                                   | Font size in pixels                                                                                                              |
+| primaryColor         | #fff4dd                                | Color to be used as background in nodes, other colors will be derived from this                                                  |
+| primaryBorderColor   | calculated from primaryColor           | Color to be used as border in nodes using `primaryColor`                                                                         |
+| primaryBorderColor   | calculated from primaryColor           | Color to be used as border in nodes using `primaryColor`                                                                         |
+| primaryTextColor     | calculated from darkMode #ddd/#333     | Color to be used as text color in nodes using `primaryColor`                                                                     |
+| secondaryColor       | calculated from primaryColor           |                                                                                                                                  |
+| primaryBorderColor   | calculated from primaryColor           | Color to be used as border in nodes using `primaryColor`                                                                         |
+| secondaryBorderColor | calculated from secondaryColor         | Color to be used as border in nodes using `secondaryColor`                                                                       |
+| primaryBorderColor   | calculated from primaryColor           | Color to be used as border in nodes using `primaryColor`                                                                         |
+| secondaryTextColor   | calculated from secondaryColor         | Color to be used as text color in nodes using `secondaryColor`                                                                   |
+| tertiaryColor        | calculated from primaryColor           |                                                                                                                                  |
+| tertiaryBorderColor  | calculated from tertiaryColor          | Color to be used as border in nodes using `tertiaryColor`                                                                        |
+| tertiaryTextColor    | calculated from tertiaryColor          | Color to be used as text color in nodes using `tertiaryColor`                                                                    |
+| noteBkgColor         | #fff5ad                                | Color used as background in notes                                                                                                |
+| noteTextColor        | #333                                   | Text color in note rectangles                                                                                                    |
+| noteBorderColor      | calculated from noteBkgColor           | Border color in note rectangles                                                                                                  |
+| lineColor            | calculated from background             |                                                                                                                                  |
+| textColor            | calculated from primaryTextColor       | Text in diagram over the background for instance text on labels and on signals in sequence diagram or the title in Gantt diagram |
+| mainBkg              | calculated from primaryColor           | Background in flowchart objects like rects/circles, class diagram classes, sequence diagram etc                                  |
+| errorBkgColor        | tertiaryColor                          | Color for syntax error message                                                                                                   |
+| errorTextColor       | tertiaryTextColor                      | Color for syntax error message                                                                                                   |
+
+## Flowchart Variables
+
+| Variable            | Default value                    | Description                  |
+| ------------------- | -------------------------------- | ---------------------------- |
+| nodeBorder          | primaryBorderColor               | Node Border Color            |
+| clusterBkg          | tertiaryColor                    | Background in subgraphs      |
+| clusterBorder       | tertiaryBorderColor              | Cluster Border Color         |
+| defaultLinkColor    | lineColor                        | Link Color                   |
+| titleColor          | tertiaryTextColor                | Title Color                  |
+| edgeLabelBackground | calculated from secondaryColor   |                              |
+| nodeTextColor       | primaryTextColor                 | Color for text inside Nodes  |
+
+## Sequence Diagram Variables
+
+| Variable              | Default value                  | Description                 |
+| --------------------- | ------------------------------ | --------------------------- |
+| actorBkg              | mainBkg                        | Actor Background Color      |
+| actorBorder           | primaryBorderColor             | Actor Border Color          |
+| actorTextColor        | primaryTextColor               | Actor Text Color            |
+| actorLineColor        | grey                           | Actor Line Color            |
+| signalColor           | textColor                      | Signal Color                |
+| signalTextColor       | textColor                      | Signal Text Color           |
+| labelBoxBkgColor      | actorBkg                       | Label Box Background Color  |
+| labelBoxBorderColor   | actorBorder                    | Label Box Border Color      |
+| labelTextColor        | actorTextColor                 | Label Text Color            |
+| loopTextColor         | actorTextColor                 | Loop Text Color              |
+| activationBorderColor | calculated from secondaryColor | Activation Border Color     |
+| activationBkgColor    | secondaryColor                 | Activation Background Color |
+| sequenceNumberColor   | calculated from lineColor      | Sequence Number Color       |
+
+## State Colors
+
+| Variable      | Default value    | Description                                  |
+| ------------- | ---------------- | -------------------------------------------- |
+| labelColor    | primaryTextColor |                                              |
+| altBackground | tertiaryColor    | Used for background in deep composite states |
+
+## Class Colors
+
+| Variable  | Default value | Description                     |
+| --------- | ------------- | ------------------------------- |
+| classText | textColor     | Color of Text in class diagrams |
+
+## User Journey Colors
+
+| Variable  | Default value                  | Description                             |
+| --------- | ------------------------------ | --------------------------------------- |
+| fillType0 | primaryColor                   | Fill for 1st section in journey diagram |
+| fillType1 | secondaryColor                 | Fill for 2nd section in journey diagram |
+| fillType2 | calculated from primaryColor   | Fill for 3rd section in journey diagram |
+| fillType3 | calculated from secondaryColor | Fill for 4th section in journey diagram |
+| fillType4 | calculated from primaryColor   | Fill for 5th section in journey diagram |
+| fillType5 | calculated from secondaryColor | Fill for 6th section in journey diagram |
+| fillType6 | calculated from primaryColor   | Fill for 7th section in journey diagram |
+| fillType7 | calculated from secondaryColor | Fill for 8th section in journey diagram |
\ No newline at end of file

From 24560b7d1329e9f7f239659a3dda4f67a15f91c0 Mon Sep 17 00:00:00 2001
From: steph 
Date: Sun, 4 Dec 2022 21:51:29 -0800
Subject: [PATCH 18/27] fix lint

---
 packages/mermaid/src/docs/config/theming.md | 78 ++++++++++-----------
 1 file changed, 39 insertions(+), 39 deletions(-)

diff --git a/packages/mermaid/src/docs/config/theming.md b/packages/mermaid/src/docs/config/theming.md
index 2dcc9a561..02b0c9a1c 100644
--- a/packages/mermaid/src/docs/config/theming.md
+++ b/packages/mermaid/src/docs/config/theming.md
@@ -49,8 +49,8 @@ To make a custom theme, modify `themeVariables` via `init`.
 
 You will need to use the [base](#available-themes) theme as it is the only modifiable theme.
 
-| Parameter      | Description                                                        | Type   | Properties                         |
-| -------------- | ------------------------------------------------------------------ | ------ | ---------------------------------- |
+| Parameter      | Description                          | Type   | Properties                                                                                          |
+| -------------- | ------------------------------------ | ------ | --------------------------------------------------------------------------------------------------- |
 | themeVariables | Modifiable with the `init` directive | Object | `primaryColor`, `primaryTextColor`, `lineColor` ([see full list](#theme-variables-reference-table)) |
 
 Example of modifying `themeVariables` using the `init` directive:
@@ -93,44 +93,44 @@ The theming engine will only recognize hex colors and not color names. So, the v
 
 ## Theme Variables
 
-| Variable             | Default value                          | Description                                                                                                                      |
-| -------------------- | -------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
-| darkMode             | false                                  | Affects how derived colors are calculated. Set value to `true` for darkmode.                                                     |
-| background           | #f4f4f4                                | Used to calculate color for items that should either be background colored or contrasting to the background                      |
-| fontFamily           | trebuchet ms, verdana, arial           |                                                                                                                                  |
-| fontSize             | 16px                                   | Font size in pixels                                                                                                              |
-| primaryColor         | #fff4dd                                | Color to be used as background in nodes, other colors will be derived from this                                                  |
-| primaryBorderColor   | calculated from primaryColor           | Color to be used as border in nodes using `primaryColor`                                                                         |
-| primaryBorderColor   | calculated from primaryColor           | Color to be used as border in nodes using `primaryColor`                                                                         |
-| primaryTextColor     | calculated from darkMode #ddd/#333     | Color to be used as text color in nodes using `primaryColor`                                                                     |
-| secondaryColor       | calculated from primaryColor           |                                                                                                                                  |
-| primaryBorderColor   | calculated from primaryColor           | Color to be used as border in nodes using `primaryColor`                                                                         |
-| secondaryBorderColor | calculated from secondaryColor         | Color to be used as border in nodes using `secondaryColor`                                                                       |
-| primaryBorderColor   | calculated from primaryColor           | Color to be used as border in nodes using `primaryColor`                                                                         |
-| secondaryTextColor   | calculated from secondaryColor         | Color to be used as text color in nodes using `secondaryColor`                                                                   |
-| tertiaryColor        | calculated from primaryColor           |                                                                                                                                  |
-| tertiaryBorderColor  | calculated from tertiaryColor          | Color to be used as border in nodes using `tertiaryColor`                                                                        |
-| tertiaryTextColor    | calculated from tertiaryColor          | Color to be used as text color in nodes using `tertiaryColor`                                                                    |
-| noteBkgColor         | #fff5ad                                | Color used as background in notes                                                                                                |
-| noteTextColor        | #333                                   | Text color in note rectangles                                                                                                    |
-| noteBorderColor      | calculated from noteBkgColor           | Border color in note rectangles                                                                                                  |
-| lineColor            | calculated from background             |                                                                                                                                  |
-| textColor            | calculated from primaryTextColor       | Text in diagram over the background for instance text on labels and on signals in sequence diagram or the title in Gantt diagram |
-| mainBkg              | calculated from primaryColor           | Background in flowchart objects like rects/circles, class diagram classes, sequence diagram etc                                  |
-| errorBkgColor        | tertiaryColor                          | Color for syntax error message                                                                                                   |
-| errorTextColor       | tertiaryTextColor                      | Color for syntax error message                                                                                                   |
+| Variable             | Default value                      | Description                                                                                                                      |
+| -------------------- | ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
+| darkMode             | false                              | Affects how derived colors are calculated. Set value to `true` for darkmode.                                                     |
+| background           | #f4f4f4                            | Used to calculate color for items that should either be background colored or contrasting to the background                      |
+| fontFamily           | trebuchet ms, verdana, arial       |                                                                                                                                  |
+| fontSize             | 16px                               | Font size in pixels                                                                                                              |
+| primaryColor         | #fff4dd                            | Color to be used as background in nodes, other colors will be derived from this                                                  |
+| primaryBorderColor   | calculated from primaryColor       | Color to be used as border in nodes using `primaryColor`                                                                         |
+| primaryBorderColor   | calculated from primaryColor       | Color to be used as border in nodes using `primaryColor`                                                                         |
+| primaryTextColor     | calculated from darkMode #ddd/#333 | Color to be used as text color in nodes using `primaryColor`                                                                     |
+| secondaryColor       | calculated from primaryColor       |                                                                                                                                  |
+| primaryBorderColor   | calculated from primaryColor       | Color to be used as border in nodes using `primaryColor`                                                                         |
+| secondaryBorderColor | calculated from secondaryColor     | Color to be used as border in nodes using `secondaryColor`                                                                       |
+| primaryBorderColor   | calculated from primaryColor       | Color to be used as border in nodes using `primaryColor`                                                                         |
+| secondaryTextColor   | calculated from secondaryColor     | Color to be used as text color in nodes using `secondaryColor`                                                                   |
+| tertiaryColor        | calculated from primaryColor       |                                                                                                                                  |
+| tertiaryBorderColor  | calculated from tertiaryColor      | Color to be used as border in nodes using `tertiaryColor`                                                                        |
+| tertiaryTextColor    | calculated from tertiaryColor      | Color to be used as text color in nodes using `tertiaryColor`                                                                    |
+| noteBkgColor         | #fff5ad                            | Color used as background in notes                                                                                                |
+| noteTextColor        | #333                               | Text color in note rectangles                                                                                                    |
+| noteBorderColor      | calculated from noteBkgColor       | Border color in note rectangles                                                                                                  |
+| lineColor            | calculated from background         |                                                                                                                                  |
+| textColor            | calculated from primaryTextColor   | Text in diagram over the background for instance text on labels and on signals in sequence diagram or the title in Gantt diagram |
+| mainBkg              | calculated from primaryColor       | Background in flowchart objects like rects/circles, class diagram classes, sequence diagram etc                                  |
+| errorBkgColor        | tertiaryColor                      | Color for syntax error message                                                                                                   |
+| errorTextColor       | tertiaryTextColor                  | Color for syntax error message                                                                                                   |
 
 ## Flowchart Variables
 
-| Variable            | Default value                    | Description                  |
-| ------------------- | -------------------------------- | ---------------------------- |
-| nodeBorder          | primaryBorderColor               | Node Border Color            |
-| clusterBkg          | tertiaryColor                    | Background in subgraphs      |
-| clusterBorder       | tertiaryBorderColor              | Cluster Border Color         |
-| defaultLinkColor    | lineColor                        | Link Color                   |
-| titleColor          | tertiaryTextColor                | Title Color                  |
-| edgeLabelBackground | calculated from secondaryColor   |                              |
-| nodeTextColor       | primaryTextColor                 | Color for text inside Nodes  |
+| Variable            | Default value                  | Description                 |
+| ------------------- | ------------------------------ | --------------------------- |
+| nodeBorder          | primaryBorderColor             | Node Border Color           |
+| clusterBkg          | tertiaryColor                  | Background in subgraphs     |
+| clusterBorder       | tertiaryBorderColor            | Cluster Border Color        |
+| defaultLinkColor    | lineColor                      | Link Color                  |
+| titleColor          | tertiaryTextColor              | Title Color                 |
+| edgeLabelBackground | calculated from secondaryColor |                             |
+| nodeTextColor       | primaryTextColor               | Color for text inside Nodes |
 
 ## Sequence Diagram Variables
 
@@ -145,7 +145,7 @@ The theming engine will only recognize hex colors and not color names. So, the v
 | labelBoxBkgColor      | actorBkg                       | Label Box Background Color  |
 | labelBoxBorderColor   | actorBorder                    | Label Box Border Color      |
 | labelTextColor        | actorTextColor                 | Label Text Color            |
-| loopTextColor         | actorTextColor                 | Loop Text Color              |
+| loopTextColor         | actorTextColor                 | Loop Text Color             |
 | activationBorderColor | calculated from secondaryColor | Activation Border Color     |
 | activationBkgColor    | secondaryColor                 | Activation Background Color |
 | sequenceNumberColor   | calculated from lineColor      | Sequence Number Color       |
@@ -174,4 +174,4 @@ The theming engine will only recognize hex colors and not color names. So, the v
 | fillType4 | calculated from primaryColor   | Fill for 5th section in journey diagram |
 | fillType5 | calculated from secondaryColor | Fill for 6th section in journey diagram |
 | fillType6 | calculated from primaryColor   | Fill for 7th section in journey diagram |
-| fillType7 | calculated from secondaryColor | Fill for 8th section in journey diagram |
\ No newline at end of file
+| fillType7 | calculated from secondaryColor | Fill for 8th section in journey diagram |

From f0aea0e6af42347f82675ac09186248329fdfff0 Mon Sep 17 00:00:00 2001
From: steph 
Date: Sun, 4 Dec 2022 22:04:20 -0800
Subject: [PATCH 19/27] fix cspell

---
 cSpell.json                                 | 1 +
 docs/config/theming.md                      | 2 +-
 packages/mermaid/src/docs/config/theming.md | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/cSpell.json b/cSpell.json
index 08fce1d1c..a4af6c785 100644
--- a/cSpell.json
+++ b/cSpell.json
@@ -59,6 +59,7 @@
     "playfair",
     "podlite",
     "ranksep",
+    "rect",
     "redmine",
     "sandboxed",
     "setupgraphviewbox",
diff --git a/docs/config/theming.md b/docs/config/theming.md
index 6c12ee75f..b34913af5 100644
--- a/docs/config/theming.md
+++ b/docs/config/theming.md
@@ -137,7 +137,7 @@ The theming engine will only recognize hex colors and not color names. So, the v
 
 | Variable             | Default value                      | Description                                                                                                                      |
 | -------------------- | ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
-| darkMode             | false                              | Affects how derived colors are calculated. Set value to `true` for darkmode.                                                     |
+| darkMode             | false                              | Affects how derived colors are calculated. Set value to `true` for dark mode.                                                    |
 | background           | #f4f4f4                            | Used to calculate color for items that should either be background colored or contrasting to the background                      |
 | fontFamily           | trebuchet ms, verdana, arial       |                                                                                                                                  |
 | fontSize             | 16px                               | Font size in pixels                                                                                                              |
diff --git a/packages/mermaid/src/docs/config/theming.md b/packages/mermaid/src/docs/config/theming.md
index 02b0c9a1c..2d4da9530 100644
--- a/packages/mermaid/src/docs/config/theming.md
+++ b/packages/mermaid/src/docs/config/theming.md
@@ -95,7 +95,7 @@ The theming engine will only recognize hex colors and not color names. So, the v
 
 | Variable             | Default value                      | Description                                                                                                                      |
 | -------------------- | ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
-| darkMode             | false                              | Affects how derived colors are calculated. Set value to `true` for darkmode.                                                     |
+| darkMode             | false                              | Affects how derived colors are calculated. Set value to `true` for dark mode.                                                    |
 | background           | #f4f4f4                            | Used to calculate color for items that should either be background colored or contrasting to the background                      |
 | fontFamily           | trebuchet ms, verdana, arial       |                                                                                                                                  |
 | fontSize             | 16px                               | Font size in pixels                                                                                                              |

From 2cce562bc43892afe5ec673b273d1c302e458b8d Mon Sep 17 00:00:00 2001
From: steph 
Date: Sun, 4 Dec 2022 22:10:33 -0800
Subject: [PATCH 20/27] fix cspell

---
 cSpell.json | 1 +
 1 file changed, 1 insertion(+)

diff --git a/cSpell.json b/cSpell.json
index a4af6c785..0849dc1d0 100644
--- a/cSpell.json
+++ b/cSpell.json
@@ -60,6 +60,7 @@
     "podlite",
     "ranksep",
     "rect",
+    "rects",
     "redmine",
     "sandboxed",
     "setupgraphviewbox",

From 7a086890fd180545f774a82ad08e15a0f2939894 Mon Sep 17 00:00:00 2001
From: MrCoder 
Date: Tue, 6 Dec 2022 19:44:14 +1100
Subject: [PATCH 21/27] Made mermaidConfig a local variable so that it cannot
 be shared cross rendering.

---
 .../mermaid/src/docs/.vitepress/theme/Mermaid.vue     | 11 +++++------
 packages/mermaid/src/docs/.vitepress/theme/mermaid.ts |  4 +---
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/packages/mermaid/src/docs/.vitepress/theme/Mermaid.vue b/packages/mermaid/src/docs/.vitepress/theme/Mermaid.vue
index c99141601..566543001 100644
--- a/packages/mermaid/src/docs/.vitepress/theme/Mermaid.vue
+++ b/packages/mermaid/src/docs/.vitepress/theme/Mermaid.vue
@@ -20,11 +20,6 @@ const props = defineProps({
 const svg = ref(null);
 let mut = null;
 
-const mermaidConfig = {
-  securityLevel: 'loose',
-  startOnLoad: false,
-};
-
 onMounted(async () => {
   mut = new MutationObserver(() => renderChart());
   mut.observe(document.documentElement, { attributes: true });
@@ -58,7 +53,11 @@ onUnmounted(() => mut.disconnect());
 const renderChart = async () => {
   console.log('rendering chart' + props.id + props.graph);
   const hasDarkClass = document.documentElement.classList.contains('dark');
-  mermaidConfig.theme = hasDarkClass ? 'dark' : 'default';
+  const mermaidConfig = {
+        securityLevel: 'loose',
+        startOnLoad: false,
+        theme: hasDarkClass ? 'dark' : 'default',
+      };
 
   console.log({ mermaidConfig });
   let svgCode = await render(props.id, decodeURIComponent(props.graph), mermaidConfig);
diff --git a/packages/mermaid/src/docs/.vitepress/theme/mermaid.ts b/packages/mermaid/src/docs/.vitepress/theme/mermaid.ts
index fef090ea9..b287346f9 100644
--- a/packages/mermaid/src/docs/.vitepress/theme/mermaid.ts
+++ b/packages/mermaid/src/docs/.vitepress/theme/mermaid.ts
@@ -8,9 +8,7 @@ try {
 }
 
 export const render = async (id: string, code: string, config: MermaidConfig): Promise => {
-  // make a clone of config, so we don't mutate the original
-  const mermaidConfig = { ...config };
-  mermaid.initialize(mermaidConfig);
+  mermaid.initialize(config);
   const svg = await mermaid.renderAsync(id, code);
   return svg;
 };

From fdf261bda3eed435fde103a268c1d74f70fce628 Mon Sep 17 00:00:00 2001
From: Sidharth Vinod 
Date: Tue, 6 Dec 2022 15:53:36 +0530
Subject: [PATCH 22/27] chore: Format Mermaid.vue

---
 packages/mermaid/src/docs/.vitepress/theme/Mermaid.vue | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/packages/mermaid/src/docs/.vitepress/theme/Mermaid.vue b/packages/mermaid/src/docs/.vitepress/theme/Mermaid.vue
index 566543001..85c13393c 100644
--- a/packages/mermaid/src/docs/.vitepress/theme/Mermaid.vue
+++ b/packages/mermaid/src/docs/.vitepress/theme/Mermaid.vue
@@ -54,10 +54,10 @@ const renderChart = async () => {
   console.log('rendering chart' + props.id + props.graph);
   const hasDarkClass = document.documentElement.classList.contains('dark');
   const mermaidConfig = {
-        securityLevel: 'loose',
-        startOnLoad: false,
-        theme: hasDarkClass ? 'dark' : 'default',
-      };
+    securityLevel: 'loose',
+    startOnLoad: false,
+    theme: hasDarkClass ? 'dark' : 'default',
+  };
 
   console.log({ mermaidConfig });
   let svgCode = await render(props.id, decodeURIComponent(props.graph), mermaidConfig);

From 792c1a8320fa12519b9d59acffa729917fc4ebe5 Mon Sep 17 00:00:00 2001
From: Sidharth Vinod 
Date: Wed, 7 Dec 2022 11:19:44 +0530
Subject: [PATCH 23/27] chore: Rebuild docs if linting fails

---
 .github/workflows/lint-docs.yml | 74 ---------------------------------
 .github/workflows/lint.yml      | 16 ++++++-
 2 files changed, 15 insertions(+), 75 deletions(-)
 delete mode 100644 .github/workflows/lint-docs.yml

diff --git a/.github/workflows/lint-docs.yml b/.github/workflows/lint-docs.yml
deleted file mode 100644
index d9f0ddae0..000000000
--- a/.github/workflows/lint-docs.yml
+++ /dev/null
@@ -1,74 +0,0 @@
-name: Lint Docs
-
-on:
-  pull_request:
-    types:
-      - opened
-      - synchronize
-      - ready_for_review
-
-permissions:
-  contents: write
-
-jobs:
-  lint:
-    runs-on: ubuntu-latest
-    strategy:
-      matrix:
-        node-version: [16.x]
-    steps:
-      - uses: actions/checkout@v3
-        with:
-          repository: ${{ github.event.pull_request.head.repo.full_name }}
-          ref: ${{ github.event.pull_request.head.ref }}
-
-      - name: Get branch name
-        id: branch-name
-        uses: tj-actions/branch-names@v5
-
-      - uses: nrwl/last-successful-commit-action@v1
-        id: last_successful_commit_pull_request
-        with:
-          branch: ${{ steps.branch-name.outputs.base_ref_branch }}
-          workflow_id: 'lint-docs.yml'
-          github_token: ${{ secrets.GITHUB_TOKEN }}
-
-      - name: Check if source docs are changed
-        id: changed-docs
-        uses: tj-actions/changed-files@v29
-        with:
-          base_sha: ${{ steps.last_successful_commit_pull_request.outputs.commit_hash }}
-          files: |
-            packages/mermaid/src/docs/*
-            packages/mermaid/src/docs.mts
-
-      - uses: pnpm/action-setup@v2
-        if: steps.changed-docs.outputs.only_modified == 'true'
-
-      - name: Setup Node.js ${{ matrix.node-version }}
-        uses: actions/setup-node@v3
-        if: steps.changed-docs.outputs.only_modified == 'true'
-        with:
-          cache: pnpm
-          node-version: ${{ matrix.node-version }}
-
-      - name: Install Packages
-        if: steps.changed-docs.outputs.only_modified == 'true'
-        run: |
-          pnpm install --frozen-lockfile
-        env:
-          CYPRESS_CACHE_FOLDER: .cache/Cypress
-
-      - name: Run step if any file(s) in the docs folder change
-        if: steps.changed-docs.outputs.only_modified == 'true'
-        run: |
-          echo "Only files in the src/docs folder has changed."
-          echo "List all the files that have changed: ${{ steps.changed-files-specific.outputs.all_changed_files }}"
-          yarn docs:build
-
-      - name: Commit changes
-        uses: EndBug/add-and-commit@v9
-        if: steps.changed-docs.outputs.only_modified == 'true'
-        with:
-          message: 'Update docs'
-          add: 'docs/*'
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 8ba06989d..917a2731c 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -9,7 +9,7 @@ on:
       - ready_for_review
 
 permissions:
-  contents: read
+  contents: write
 
 jobs:
   lint:
@@ -39,5 +39,19 @@ jobs:
         run: pnpm run lint
 
       - name: Verify Docs
+        id: verifyDocs
         working-directory: ./packages/mermaid
+        continue-on-error: true
         run: pnpm run docs:verify
+
+      - name: Rebuild Docs
+        if: ${{ steps.verifyDocs.outcome == 'failure' && github.event_name == 'push' }}
+        run: |
+          yarn docs:build
+
+      - name: Commit changes
+        uses: EndBug/add-and-commit@v9
+        if: ${{ steps.verifyDocs.outcome == 'failure' && github.event_name == 'push' }}
+        with:
+          message: 'Update docs'
+          add: 'docs/*'

From 755382798589f28c936300c311589a4606a1f9a0 Mon Sep 17 00:00:00 2001
From: Sidharth Vinod 
Date: Wed, 7 Dec 2022 11:40:17 +0530
Subject: [PATCH 24/27] fix: docs build command

---
 .github/workflows/lint.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 917a2731c..f1ab5726b 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -46,8 +46,8 @@ jobs:
 
       - name: Rebuild Docs
         if: ${{ steps.verifyDocs.outcome == 'failure' && github.event_name == 'push' }}
-        run: |
-          yarn docs:build
+        working-directory: ./packages/mermaid
+        run: pnpm run docs:build
 
       - name: Commit changes
         uses: EndBug/add-and-commit@v9

From b2489523f24ed271e7c9dc281078e859e6026619 Mon Sep 17 00:00:00 2001
From: sidharthv96 
Date: Wed, 7 Dec 2022 06:13:07 +0000
Subject: [PATCH 25/27] Update docs

---
 docs/syntax/classDiagram.md | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/docs/syntax/classDiagram.md b/docs/syntax/classDiagram.md
index 5870d0743..b6d48c9de 100644
--- a/docs/syntax/classDiagram.md
+++ b/docs/syntax/classDiagram.md
@@ -7,7 +7,8 @@
 # Class diagrams
 
 > "In software engineering, a class diagram in the Unified Modeling Language (UML) is a type of static structure diagram that describes the structure of a system by showing the system's classes, their attributes, operations (or methods), and the relationships among objects."
-> Wikipedia
+>
+> \-Wikipedia
 
 The class diagram is the main building block of object-oriented modeling. It is used for general conceptual modeling of the structure of the application, and for detailed modeling to translate the models into programming code. Class diagrams can also be used for data modeling. The classes in a class diagram represent both the main elements, interactions in the application, and the classes to be programmed.
 

From 1a767ee492f74aa3475cf50ecc0baf0f10545d3e Mon Sep 17 00:00:00 2001
From: Sidharth Vinod 
Date: Wed, 7 Dec 2022 11:48:51 +0530
Subject: [PATCH 26/27] chore: Update cspell

---
 cSpell.json | 1 +
 1 file changed, 1 insertion(+)

diff --git a/cSpell.json b/cSpell.json
index 64187e1ca..3ddf84102 100644
--- a/cSpell.json
+++ b/cSpell.json
@@ -64,6 +64,7 @@
     "phpbb",
     "plantuml",
     "playfair",
+    "pnpm",
     "podlite",
     "ranksep",
     "redmine",

From 59fdaa3b534e32437aeb7ac4ade9685511fb6a7e Mon Sep 17 00:00:00 2001
From: Sidharth Vinod 
Date: Wed, 7 Dec 2022 11:58:09 +0530
Subject: [PATCH 27/27] fix: Fail docs:verify on non push events

---
 .github/workflows/lint.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index f1ab5726b..d67144540 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -41,7 +41,7 @@ jobs:
       - name: Verify Docs
         id: verifyDocs
         working-directory: ./packages/mermaid
-        continue-on-error: true
+        continue-on-error: ${{ github.event_name == 'push' }}
         run: pnpm run docs:verify
 
       - name: Rebuild Docs