From dbcadc1d0bc1c7ea8ff7b5bb96755ee1123b65f9 Mon Sep 17 00:00:00 2001 From: CNOCTAVE Date: Mon, 13 Oct 2025 13:56:04 +0800 Subject: [PATCH 01/17] add doc to use marmaid.js in GNU Octave --- docs/ecosystem/tutorials.md | 39 +++++++++++++++++++ .../mermaid/src/docs/ecosystem/tutorials.md | 39 +++++++++++++++++++ 2 files changed, 78 insertions(+) diff --git a/docs/ecosystem/tutorials.md b/docs/ecosystem/tutorials.md index 8a6a9e8e2..207ea79f6 100644 --- a/docs/ecosystem/tutorials.md +++ b/docs/ecosystem/tutorials.md @@ -87,3 +87,42 @@ graph LR; ![Example graph of the Python integration](img/python-mermaid-integration.png) + +## GNU Octave Integration with mermaid-js + +Here's an example of GNU Octave integration with mermaid-js which uses the +octave_mermaid_js package to save graph image. + +```python +pkg load octave_mermaid_js +graph = { + "graph LR;" + " A--> B & C & D" + " B--> A & E" + " C--> A & E" + " D--> A & E" + " E--> B & C & D" +} +graph = strjoin(graph, "\n") +[ret, status] = mermaid_js_save(graph, "result.png") +``` + +Here's an example of GNU Octave integration with mermaid-js which uses the +octave_mermaid_js package to show graph image. + +```python +pkg load octave_mermaid_js +graph = { + "graph LR;" + " A--> B & C & D" + " B--> A & E" + " C--> A & E" + " D--> A & E" + " E--> B & C & D" +} +graph = strjoin(graph, "\n") +[ret, status] = mermaid_js_imshow(graph) +``` + +Here's a journal article about octave_mermaid_js. +[octave_mermaid_js: Integrating Mermaid.js Diagram Generation into GNU Octave](https://engrxiv.org/preprint/view/5547) diff --git a/packages/mermaid/src/docs/ecosystem/tutorials.md b/packages/mermaid/src/docs/ecosystem/tutorials.md index 9f0f351a2..d4b92fff5 100644 --- a/packages/mermaid/src/docs/ecosystem/tutorials.md +++ b/packages/mermaid/src/docs/ecosystem/tutorials.md @@ -81,3 +81,42 @@ graph LR; ![Example graph of the Python integration](img/python-mermaid-integration.png) + +## GNU Octave Integration with mermaid-js + +Here's an example of GNU Octave integration with mermaid-js which uses the +octave_mermaid_js package to save graph image. + +```python +pkg load octave_mermaid_js +graph = { + "graph LR;" + " A--> B & C & D" + " B--> A & E" + " C--> A & E" + " D--> A & E" + " E--> B & C & D" +} +graph = strjoin(graph, "\n") +[ret, status] = mermaid_js_save(graph, "result.png") +``` + +Here's an example of GNU Octave integration with mermaid-js which uses the +octave_mermaid_js package to show graph image. + +```python +pkg load octave_mermaid_js +graph = { + "graph LR;" + " A--> B & C & D" + " B--> A & E" + " C--> A & E" + " D--> A & E" + " E--> B & C & D" +} +graph = strjoin(graph, "\n") +[ret, status] = mermaid_js_imshow(graph) +``` + +Here's a journal article about octave_mermaid_js. +[octave_mermaid_js: Integrating Mermaid.js Diagram Generation into GNU Octave](https://engrxiv.org/preprint/view/5547) From 32ac2c689d1df551282601eaf49a965861578cdb Mon Sep 17 00:00:00 2001 From: CNOCTAVE Date: Mon, 13 Oct 2025 15:02:46 +0800 Subject: [PATCH 02/17] add doc to use marmaid.js in GNU Octave --- .changeset/full-clubs-learn.md | 5 +++++ .changeset/true-parrots-build.md | 5 +++++ packages/mermaid/src/docs/ecosystem/tutorials.md | 4 ++-- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 .changeset/full-clubs-learn.md create mode 100644 .changeset/true-parrots-build.md diff --git a/.changeset/full-clubs-learn.md b/.changeset/full-clubs-learn.md new file mode 100644 index 000000000..879d34c80 --- /dev/null +++ b/.changeset/full-clubs-learn.md @@ -0,0 +1,5 @@ +--- +'mermaid': major +--- + +add doc to use marmaid.js in GNU Octave diff --git a/.changeset/true-parrots-build.md b/.changeset/true-parrots-build.md new file mode 100644 index 000000000..64ff97c96 --- /dev/null +++ b/.changeset/true-parrots-build.md @@ -0,0 +1,5 @@ +--- +'mermaid': major +--- + +feat: add doc to use marmaid.js in GNU Octave diff --git a/packages/mermaid/src/docs/ecosystem/tutorials.md b/packages/mermaid/src/docs/ecosystem/tutorials.md index d4b92fff5..abe8f5b63 100644 --- a/packages/mermaid/src/docs/ecosystem/tutorials.md +++ b/packages/mermaid/src/docs/ecosystem/tutorials.md @@ -87,7 +87,7 @@ graph LR; Here's an example of GNU Octave integration with mermaid-js which uses the octave_mermaid_js package to save graph image. -```python +```matlab pkg load octave_mermaid_js graph = { "graph LR;" @@ -104,7 +104,7 @@ graph = strjoin(graph, "\n") Here's an example of GNU Octave integration with mermaid-js which uses the octave_mermaid_js package to show graph image. -```python +```matlab pkg load octave_mermaid_js graph = { "graph LR;" From 34f40f07948245e38b039a9d6198caea4cc678a0 Mon Sep 17 00:00:00 2001 From: CNOCTAVE Date: Mon, 13 Oct 2025 15:11:44 +0800 Subject: [PATCH 03/17] add doc to use marmaid.js in GNU Octave --- .changeset/full-clubs-learn.md | 2 +- docs/ecosystem/tutorials.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.changeset/full-clubs-learn.md b/.changeset/full-clubs-learn.md index 879d34c80..64ff97c96 100644 --- a/.changeset/full-clubs-learn.md +++ b/.changeset/full-clubs-learn.md @@ -2,4 +2,4 @@ 'mermaid': major --- -add doc to use marmaid.js in GNU Octave +feat: add doc to use marmaid.js in GNU Octave diff --git a/docs/ecosystem/tutorials.md b/docs/ecosystem/tutorials.md index 207ea79f6..72fd4d238 100644 --- a/docs/ecosystem/tutorials.md +++ b/docs/ecosystem/tutorials.md @@ -93,7 +93,7 @@ graph LR; Here's an example of GNU Octave integration with mermaid-js which uses the octave_mermaid_js package to save graph image. -```python +```matlab pkg load octave_mermaid_js graph = { "graph LR;" @@ -110,7 +110,7 @@ graph = strjoin(graph, "\n") Here's an example of GNU Octave integration with mermaid-js which uses the octave_mermaid_js package to show graph image. -```python +```matlab pkg load octave_mermaid_js graph = { "graph LR;" From c7f8a11dedc4231c31d0cd1431c6a5a34e184f8c Mon Sep 17 00:00:00 2001 From: Arnaud Renaud Date: Mon, 27 Oct 2025 14:16:35 +0100 Subject: [PATCH 04/17] Add speccharts to `integrations-community.md` --- packages/mermaid/src/docs/ecosystem/integrations-community.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/mermaid/src/docs/ecosystem/integrations-community.md b/packages/mermaid/src/docs/ecosystem/integrations-community.md index a4a68e6ab..59ed935ae 100644 --- a/packages/mermaid/src/docs/ecosystem/integrations-community.md +++ b/packages/mermaid/src/docs/ecosystem/integrations-community.md @@ -267,6 +267,7 @@ Communication tools and platforms - [reveal.js-mermaid-plugin](https://github.com/ludwick/reveal.js-mermaid-plugin) - [Reveal CK](https://github.com/jedcn/reveal-ck) - [reveal-ck-mermaid-plugin](https://github.com/tmtm/reveal-ck-mermaid-plugin) +- [speccharts: Turn your test suites into specification diagrams](https://github.com/arnaudrenaud/speccharts) - [Vitepress Plugin](https://github.com/sametcn99/vitepress-mermaid-renderer) From 1e7b71a085fff28eb78f7554de68b448a5520412 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Mon, 3 Nov 2025 23:30:27 -0800 Subject: [PATCH 05/17] Refactor GitHub Actions workflow for lockfile validation Removed Node.js setup step and pnpm action version. Co-authored-by: Alois Klink --- .github/workflows/validate-lockfile.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/validate-lockfile.yml b/.github/workflows/validate-lockfile.yml index 119f43180..dcfb255b6 100644 --- a/.github/workflows/validate-lockfile.yml +++ b/.github/workflows/validate-lockfile.yml @@ -18,13 +18,6 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} repository: ${{ github.event.pull_request.head.repo.full_name }} - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - - - uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 - - name: Validate pnpm-lock.yaml entries id: validate # give this step an ID so we can reference its outputs run: | From cf0d1248a4f6b53f5dac781c28f89fc58434a7c3 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Tue, 4 Nov 2025 18:42:42 +0700 Subject: [PATCH 06/17] chore: Add speccharts to cspell --- .cspell/libraries.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/.cspell/libraries.txt b/.cspell/libraries.txt index feee10fd1..4fceed5bb 100644 --- a/.cspell/libraries.txt +++ b/.cspell/libraries.txt @@ -64,6 +64,7 @@ rscratch shiki Slidev sparkline +speccharts sphinxcontrib ssim stylis From 974236bbb8b4dafbbda5c06245985b3c35b1fbce Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Tue, 4 Nov 2025 11:48:23 +0000 Subject: [PATCH 07/17] [autofix.ci] apply automated fixes --- docs/ecosystem/integrations-community.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/ecosystem/integrations-community.md b/docs/ecosystem/integrations-community.md index 6bc16e3e2..33c99a4f3 100644 --- a/docs/ecosystem/integrations-community.md +++ b/docs/ecosystem/integrations-community.md @@ -272,6 +272,7 @@ Communication tools and platforms - [reveal.js-mermaid-plugin](https://github.com/ludwick/reveal.js-mermaid-plugin) - [Reveal CK](https://github.com/jedcn/reveal-ck) - [reveal-ck-mermaid-plugin](https://github.com/tmtm/reveal-ck-mermaid-plugin) +- [speccharts: Turn your test suites into specification diagrams](https://github.com/arnaudrenaud/speccharts) - [Vitepress Plugin](https://github.com/sametcn99/vitepress-mermaid-renderer) From 57530076aaaeea3940db8dc851020b8aa353423b Mon Sep 17 00:00:00 2001 From: CNOCTAVE Date: Tue, 4 Nov 2025 20:29:53 +0800 Subject: [PATCH 08/17] add doc to use marmaid.js in GNU Octave add doc to use marmaid.js in GNU Octave. Resolve #7073 --- .changeset/7123.md | 5 +++++ .../mermaid/src/docs/ecosystem/integrations-community.md | 6 ++++++ 2 files changed, 11 insertions(+) create mode 100644 .changeset/7123.md diff --git a/.changeset/7123.md b/.changeset/7123.md new file mode 100644 index 000000000..120650eeb --- /dev/null +++ b/.changeset/7123.md @@ -0,0 +1,5 @@ +--- +'mermaid': patch +--- + +feat: add doc to use marmaid.js in GNU Octave. Resolve #7073 diff --git a/packages/mermaid/src/docs/ecosystem/integrations-community.md b/packages/mermaid/src/docs/ecosystem/integrations-community.md index 59ed935ae..0fc1f6d8e 100644 --- a/packages/mermaid/src/docs/ecosystem/integrations-community.md +++ b/packages/mermaid/src/docs/ecosystem/integrations-community.md @@ -52,6 +52,12 @@ To add an integration to this list, see the [Integrations - create page](./integ - [GitHub Writer](https://github.com/ckeditor/github-writer) - [SVG diagram generator](https://github.com/SimonKenyonShepard/mermaidjs-github-svg-generator) - [GitLab](https://docs.gitlab.com/ee/user/markdown.html#diagrams-and-flowcharts) ✅ +- [GNU Octave](https://octave.org/) ✅ + - [Octave Repo Index](https://gnu-octave.github.io/packages/octave_mermaid_js/) ✅ + - [News](https://github.com/CNOCTAVE/octave_mermaid_js/blob/main/NEWS) ✅ + - [Source Code](https://github.com/CNOCTAVE/octave_mermaid_js) ✅ + - [Function Reference](https://cnoctave.github.io/octave_mermaid_js/index.html) ✅ + - [Bug Tracker](https://github.com/CNOCTAVE/octave_mermaid_js/issues) ✅ - [Mermaid Plugin for JetBrains IDEs](https://plugins.jetbrains.com/plugin/20146-mermaid) - [MonsterWriter](https://www.monsterwriter.com/) ✅ - [Joplin](https://joplinapp.org) ✅ From 38c289818ce6c33c97014448edf509431adfd2f8 Mon Sep 17 00:00:00 2001 From: CNOCTAVE Date: Tue, 4 Nov 2025 20:34:13 +0800 Subject: [PATCH 09/17] feat: add doc to use marmaid.js in GNU Octave feat: add doc to use marmaid.js in GNU Octave. Resolve #7073 --- docs/ecosystem/tutorials.md | 39 ------------------- .../mermaid/src/docs/ecosystem/tutorials.md | 39 ------------------- 2 files changed, 78 deletions(-) diff --git a/docs/ecosystem/tutorials.md b/docs/ecosystem/tutorials.md index 72fd4d238..8a6a9e8e2 100644 --- a/docs/ecosystem/tutorials.md +++ b/docs/ecosystem/tutorials.md @@ -87,42 +87,3 @@ graph LR; ![Example graph of the Python integration](img/python-mermaid-integration.png) - -## GNU Octave Integration with mermaid-js - -Here's an example of GNU Octave integration with mermaid-js which uses the -octave_mermaid_js package to save graph image. - -```matlab -pkg load octave_mermaid_js -graph = { - "graph LR;" - " A--> B & C & D" - " B--> A & E" - " C--> A & E" - " D--> A & E" - " E--> B & C & D" -} -graph = strjoin(graph, "\n") -[ret, status] = mermaid_js_save(graph, "result.png") -``` - -Here's an example of GNU Octave integration with mermaid-js which uses the -octave_mermaid_js package to show graph image. - -```matlab -pkg load octave_mermaid_js -graph = { - "graph LR;" - " A--> B & C & D" - " B--> A & E" - " C--> A & E" - " D--> A & E" - " E--> B & C & D" -} -graph = strjoin(graph, "\n") -[ret, status] = mermaid_js_imshow(graph) -``` - -Here's a journal article about octave_mermaid_js. -[octave_mermaid_js: Integrating Mermaid.js Diagram Generation into GNU Octave](https://engrxiv.org/preprint/view/5547) diff --git a/packages/mermaid/src/docs/ecosystem/tutorials.md b/packages/mermaid/src/docs/ecosystem/tutorials.md index abe8f5b63..9f0f351a2 100644 --- a/packages/mermaid/src/docs/ecosystem/tutorials.md +++ b/packages/mermaid/src/docs/ecosystem/tutorials.md @@ -81,42 +81,3 @@ graph LR; ![Example graph of the Python integration](img/python-mermaid-integration.png) - -## GNU Octave Integration with mermaid-js - -Here's an example of GNU Octave integration with mermaid-js which uses the -octave_mermaid_js package to save graph image. - -```matlab -pkg load octave_mermaid_js -graph = { - "graph LR;" - " A--> B & C & D" - " B--> A & E" - " C--> A & E" - " D--> A & E" - " E--> B & C & D" -} -graph = strjoin(graph, "\n") -[ret, status] = mermaid_js_save(graph, "result.png") -``` - -Here's an example of GNU Octave integration with mermaid-js which uses the -octave_mermaid_js package to show graph image. - -```matlab -pkg load octave_mermaid_js -graph = { - "graph LR;" - " A--> B & C & D" - " B--> A & E" - " C--> A & E" - " D--> A & E" - " E--> B & C & D" -} -graph = strjoin(graph, "\n") -[ret, status] = mermaid_js_imshow(graph) -``` - -Here's a journal article about octave_mermaid_js. -[octave_mermaid_js: Integrating Mermaid.js Diagram Generation into GNU Octave](https://engrxiv.org/preprint/view/5547) From 7b0763f26276cb16a73391092f923bc06b60d42f Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Tue, 4 Nov 2025 12:43:03 +0000 Subject: [PATCH 10/17] [autofix.ci] apply automated fixes --- docs/ecosystem/integrations-community.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/ecosystem/integrations-community.md b/docs/ecosystem/integrations-community.md index 33c99a4f3..54622d679 100644 --- a/docs/ecosystem/integrations-community.md +++ b/docs/ecosystem/integrations-community.md @@ -57,6 +57,12 @@ To add an integration to this list, see the [Integrations - create page](./integ - [GitHub Writer](https://github.com/ckeditor/github-writer) - [SVG diagram generator](https://github.com/SimonKenyonShepard/mermaidjs-github-svg-generator) - [GitLab](https://docs.gitlab.com/ee/user/markdown.html#diagrams-and-flowcharts) ✅ +- [GNU Octave](https://octave.org/) ✅ + - [Octave Repo Index](https://gnu-octave.github.io/packages/octave_mermaid_js/) ✅ + - [News](https://github.com/CNOCTAVE/octave_mermaid_js/blob/main/NEWS) ✅ + - [Source Code](https://github.com/CNOCTAVE/octave_mermaid_js) ✅ + - [Function Reference](https://cnoctave.github.io/octave_mermaid_js/index.html) ✅ + - [Bug Tracker](https://github.com/CNOCTAVE/octave_mermaid_js/issues) ✅ - [Mermaid Plugin for JetBrains IDEs](https://plugins.jetbrains.com/plugin/20146-mermaid) - [MonsterWriter](https://www.monsterwriter.com/) ✅ - [Joplin](https://joplinapp.org) ✅ From 7f5160fa4de961bf606264b0614fe810af2fd2d0 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Tue, 4 Nov 2025 21:12:10 +0700 Subject: [PATCH 11/17] chore: Remove NPM_TOKEN from release workflow --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7dbf85d94..ece84ac20 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,5 +42,4 @@ jobs: publish: pnpm changeset:publish env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NPM_CONFIG_PROVENANCE: true From 287a9a3fcb89ec379fae287f3564daf4f799fef3 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Tue, 4 Nov 2025 21:21:58 +0700 Subject: [PATCH 12/17] chore: Add missing clean scripts Co-authored-by: Alois Klink --- packages/mermaid-layout-elk/package.json | 4 +++- packages/mermaid-layout-tidy-tree/package.json | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/mermaid-layout-elk/package.json b/packages/mermaid-layout-elk/package.json index 91c1ae81f..e47d64edf 100644 --- a/packages/mermaid-layout-elk/package.json +++ b/packages/mermaid-layout-elk/package.json @@ -18,7 +18,9 @@ "elk", "mermaid" ], - "scripts": {}, + "scripts": { + "clean": "rimraf dist" + }, "repository": { "type": "git", "url": "https://github.com/mermaid-js/mermaid" diff --git a/packages/mermaid-layout-tidy-tree/package.json b/packages/mermaid-layout-tidy-tree/package.json index bdc15869f..2abaaa211 100644 --- a/packages/mermaid-layout-tidy-tree/package.json +++ b/packages/mermaid-layout-tidy-tree/package.json @@ -19,7 +19,9 @@ "mermaid", "layout" ], - "scripts": {}, + "scripts": { + "clean": "rimraf dist" + }, "repository": { "type": "git", "url": "https://github.com/mermaid-js/mermaid" From b76ccae0652d0a4f908b23f8d0a00661f6222869 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Tue, 4 Nov 2025 23:49:54 +0700 Subject: [PATCH 13/17] feat: Optimize bundling to remove shipping package.json inside mermaid's JS bundle. Move all build time injected variables to `injected.` namespace to avoid conflicts. --- .esbuild/util.ts | 9 +++++---- .vite/build.ts | 6 ++---- .../mermaid/src/diagram-api/diagram-orchestration.ts | 2 +- packages/mermaid/src/diagrams/common/common.ts | 2 +- packages/mermaid/src/diagrams/info/infoDb.ts | 3 +-- packages/mermaid/src/docs/.vitepress/config.ts | 2 +- packages/mermaid/src/mermaidAPI.ts | 5 ++--- packages/mermaid/src/rendering-util/render.ts | 2 +- packages/mermaid/src/type.d.ts | 5 ++++- vite.config.ts | 3 ++- 10 files changed, 20 insertions(+), 19 deletions(-) diff --git a/.esbuild/util.ts b/.esbuild/util.ts index 3a0ec6b41..a3e2ffe55 100644 --- a/.esbuild/util.ts +++ b/.esbuild/util.ts @@ -71,6 +71,9 @@ export const getBuildConfig = (options: MermaidBuildOptions): BuildOptions => { const external: string[] = ['require', 'fs', 'path']; const outFileName = getFileName(name, options); + const { dependencies, version } = JSON.parse( + readFileSync(resolve(__dirname, `../packages/${packageName}/package.json`), 'utf-8') + ); const output: BuildOptions = buildOptions({ ...rest, absWorkingDir: resolve(__dirname, `../packages/${packageName}`), @@ -82,15 +85,13 @@ export const getBuildConfig = (options: MermaidBuildOptions): BuildOptions => { chunkNames: `chunks/${outFileName}/[name]-[hash]`, define: { // This needs to be stringified for esbuild - includeLargeFeatures: `${includeLargeFeatures}`, + 'injected.includeLargeFeatures': `${includeLargeFeatures}`, + 'injected.version': `'${version}'`, 'import.meta.vitest': 'undefined', }, }); if (core) { - const { dependencies } = JSON.parse( - readFileSync(resolve(__dirname, `../packages/${packageName}/package.json`), 'utf-8') - ); // Core build is used to generate file without bundled dependencies. // This is used by downstream projects to bundle dependencies themselves. // Ignore dependencies and any dependencies of dependencies diff --git a/.vite/build.ts b/.vite/build.ts index 480dd6b30..d59f0fac3 100644 --- a/.vite/build.ts +++ b/.vite/build.ts @@ -78,6 +78,8 @@ export const getBuildConfig = ({ minify, core, watch, entryName }: BuildOptions) }, define: { 'import.meta.vitest': 'undefined', + 'injected.includeLargeFeatures': 'true', + 'injected.version': `'0.0.0'`, }, resolve: { extensions: [], @@ -94,10 +96,6 @@ export const getBuildConfig = ({ minify, core, watch, entryName }: BuildOptions) }), ...visualizerOptions(packageName, core), ], - define: { - // Needs to be string - includeLargeFeatures: 'true', - }, }; if (watch && config.build) { diff --git a/packages/mermaid/src/diagram-api/diagram-orchestration.ts b/packages/mermaid/src/diagram-api/diagram-orchestration.ts index 97b9852ff..fa90e1df9 100644 --- a/packages/mermaid/src/diagram-api/diagram-orchestration.ts +++ b/packages/mermaid/src/diagram-api/diagram-orchestration.ts @@ -72,7 +72,7 @@ export const addDiagrams = () => { } ); - if (includeLargeFeatures) { + if (injected.includeLargeFeatures) { registerLazyLoadedDiagrams(flowchartElk, mindmap, architecture); } diff --git a/packages/mermaid/src/diagrams/common/common.ts b/packages/mermaid/src/diagrams/common/common.ts index 045a729f7..444c9e930 100644 --- a/packages/mermaid/src/diagrams/common/common.ts +++ b/packages/mermaid/src/diagrams/common/common.ts @@ -333,7 +333,7 @@ const renderKatexUnsanitized = async (text: string, config: MermaidConfig): Prom return text.replace(katexRegex, 'MathML is unsupported in this environment.'); } - if (includeLargeFeatures) { + if (injected.includeLargeFeatures) { const { default: katex } = await import('katex'); const outputMode = config.forceLegacyMathML || (!isMathMLSupported() && config.legacyMathML) diff --git a/packages/mermaid/src/diagrams/info/infoDb.ts b/packages/mermaid/src/diagrams/info/infoDb.ts index 169ceaf27..4c1a6778c 100644 --- a/packages/mermaid/src/diagrams/info/infoDb.ts +++ b/packages/mermaid/src/diagrams/info/infoDb.ts @@ -1,8 +1,7 @@ import type { InfoFields, InfoDB } from './infoTypes.js'; -import packageJson from '../../../package.json' assert { type: 'json' }; export const DEFAULT_INFO_DB: InfoFields = { - version: packageJson.version + (includeLargeFeatures ? '' : '-tiny'), + version: injected.version + (injected.includeLargeFeatures ? '' : '-tiny'), } as const; export const getVersion = (): string => DEFAULT_INFO_DB.version; diff --git a/packages/mermaid/src/docs/.vitepress/config.ts b/packages/mermaid/src/docs/.vitepress/config.ts index 066fde693..55bed31da 100644 --- a/packages/mermaid/src/docs/.vitepress/config.ts +++ b/packages/mermaid/src/docs/.vitepress/config.ts @@ -1,6 +1,6 @@ import type { MarkdownOptions } from 'vitepress'; import { defineConfig } from 'vitepress'; -import packageJson from '../../../package.json' assert { type: 'json' }; +import packageJson from '../../../package.json' with { type: 'json' }; import { addCanonicalUrls } from './canonical-urls.js'; import MermaidExample from './mermaid-markdown-all.js'; diff --git a/packages/mermaid/src/mermaidAPI.ts b/packages/mermaid/src/mermaidAPI.ts index cf08d02f8..80deda740 100644 --- a/packages/mermaid/src/mermaidAPI.ts +++ b/packages/mermaid/src/mermaidAPI.ts @@ -7,7 +7,6 @@ import { select } from 'd3'; import { compile, serialize, stringify } from 'stylis'; import DOMPurify from 'dompurify'; import isEmpty from 'lodash-es/isEmpty.js'; -import packageJson from '../package.json' assert { type: 'json' }; import { addSVGa11yTitleDescription, setA11yDiagramInfo } from './accessibility.js'; import assignWithDepth from './assignWithDepth.js'; import * as configApi from './config.js'; @@ -421,12 +420,12 @@ const render = async function ( // ------------------------------------------------------------------------------- // Draw the diagram with the renderer try { - await diag.renderer.draw(text, id, packageJson.version, diag); + await diag.renderer.draw(text, id, injected.version, diag); } catch (e) { if (config.suppressErrorRendering) { removeTempElements(); } else { - errorRenderer.draw(text, id, packageJson.version); + errorRenderer.draw(text, id, injected.version); } throw e; } diff --git a/packages/mermaid/src/rendering-util/render.ts b/packages/mermaid/src/rendering-util/render.ts index aa4bceca3..c14af2391 100644 --- a/packages/mermaid/src/rendering-util/render.ts +++ b/packages/mermaid/src/rendering-util/render.ts @@ -42,7 +42,7 @@ const registerDefaultLayoutLoaders = () => { name: 'dagre', loader: async () => await import('./layout-algorithms/dagre/index.js'), }, - ...(includeLargeFeatures + ...(injected.includeLargeFeatures ? [ { name: 'cose-bilkent', diff --git a/packages/mermaid/src/type.d.ts b/packages/mermaid/src/type.d.ts index 0c88e4866..515c774b4 100644 --- a/packages/mermaid/src/type.d.ts +++ b/packages/mermaid/src/type.d.ts @@ -1,2 +1,5 @@ // eslint-disable-next-line no-var -declare var includeLargeFeatures: boolean; +declare var injected: { + version: string; + includeLargeFeatures: boolean; +}; diff --git a/vite.config.ts b/vite.config.ts index c4738458e..f86711e9a 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -35,7 +35,8 @@ export default defineConfig({ }, define: { // Needs to be string - includeLargeFeatures: 'true', + 'injected.includeLargeFeatures': 'true', 'import.meta.vitest': 'undefined', + packageVersion: "'0.0.0'", }, }); From 6546aed482f7210e18b19f198f0c5284119e6148 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Wed, 5 Nov 2025 00:07:30 +0700 Subject: [PATCH 14/17] chore: forbid use of `viewbox` in code --- .cspell/code-terms.txt | 2 ++ cypress/helpers/util.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/.cspell/code-terms.txt b/.cspell/code-terms.txt index 8b549f888..5f72ea221 100644 --- a/.cspell/code-terms.txt +++ b/.cspell/code-terms.txt @@ -1,3 +1,5 @@ +!viewbox +# It should be viewBox # This file contains coding related terms ALPHANUM antiscript diff --git a/cypress/helpers/util.ts b/cypress/helpers/util.ts index d02e9da87..0332178f6 100644 --- a/cypress/helpers/util.ts +++ b/cypress/helpers/util.ts @@ -99,6 +99,7 @@ export const openURLAndVerifyRendering = ( cy.visit(url); cy.window().should('have.property', 'rendered', true); cy.get('svg').should('be.visible'); + // cspell:ignore viewbox cy.get('svg').should('not.have.attr', 'viewbox'); if (validation) { From c0e1662e50c1ac99445dd79476bc43cb2da16db0 Mon Sep 17 00:00:00 2001 From: CNOCTAVE Date: Wed, 5 Nov 2025 01:08:04 +0800 Subject: [PATCH 15/17] Update packages/mermaid/src/docs/ecosystem/integrations-community.md Co-authored-by: Sidharth Vinod --- .../mermaid/src/docs/ecosystem/integrations-community.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/mermaid/src/docs/ecosystem/integrations-community.md b/packages/mermaid/src/docs/ecosystem/integrations-community.md index 0fc1f6d8e..9ac390367 100644 --- a/packages/mermaid/src/docs/ecosystem/integrations-community.md +++ b/packages/mermaid/src/docs/ecosystem/integrations-community.md @@ -53,11 +53,7 @@ To add an integration to this list, see the [Integrations - create page](./integ - [SVG diagram generator](https://github.com/SimonKenyonShepard/mermaidjs-github-svg-generator) - [GitLab](https://docs.gitlab.com/ee/user/markdown.html#diagrams-and-flowcharts) ✅ - [GNU Octave](https://octave.org/) ✅ - - [Octave Repo Index](https://gnu-octave.github.io/packages/octave_mermaid_js/) ✅ - - [News](https://github.com/CNOCTAVE/octave_mermaid_js/blob/main/NEWS) ✅ - - [Source Code](https://github.com/CNOCTAVE/octave_mermaid_js) ✅ - - [Function Reference](https://cnoctave.github.io/octave_mermaid_js/index.html) ✅ - - [Bug Tracker](https://github.com/CNOCTAVE/octave_mermaid_js/issues) ✅ + - [octave_mermaid_js](https://github.com/CNOCTAVE/octave_mermaid_js) ✅ - [Mermaid Plugin for JetBrains IDEs](https://plugins.jetbrains.com/plugin/20146-mermaid) - [MonsterWriter](https://www.monsterwriter.com/) ✅ - [Joplin](https://joplinapp.org) ✅ From e4cf266c1d200e210743bb584be433c60fa3fc32 Mon Sep 17 00:00:00 2001 From: CNOCTAVE Date: Wed, 5 Nov 2025 01:12:15 +0800 Subject: [PATCH 16/17] remove changeset remove changeset --- .changeset/7123.md | 5 ----- .changeset/full-clubs-learn.md | 5 ----- .changeset/true-parrots-build.md | 5 ----- 3 files changed, 15 deletions(-) delete mode 100644 .changeset/7123.md delete mode 100644 .changeset/full-clubs-learn.md delete mode 100644 .changeset/true-parrots-build.md diff --git a/.changeset/7123.md b/.changeset/7123.md deleted file mode 100644 index 120650eeb..000000000 --- a/.changeset/7123.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'mermaid': patch ---- - -feat: add doc to use marmaid.js in GNU Octave. Resolve #7073 diff --git a/.changeset/full-clubs-learn.md b/.changeset/full-clubs-learn.md deleted file mode 100644 index 64ff97c96..000000000 --- a/.changeset/full-clubs-learn.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'mermaid': major ---- - -feat: add doc to use marmaid.js in GNU Octave diff --git a/.changeset/true-parrots-build.md b/.changeset/true-parrots-build.md deleted file mode 100644 index 64ff97c96..000000000 --- a/.changeset/true-parrots-build.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'mermaid': major ---- - -feat: add doc to use marmaid.js in GNU Octave From 545801e144873aea2461a0e9ee92242d0b4fd049 Mon Sep 17 00:00:00 2001 From: CNOCTAVE Date: Wed, 5 Nov 2025 01:16:17 +0800 Subject: [PATCH 17/17] Update integrations-community.md --- docs/ecosystem/integrations-community.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/docs/ecosystem/integrations-community.md b/docs/ecosystem/integrations-community.md index 54622d679..4cb73eb67 100644 --- a/docs/ecosystem/integrations-community.md +++ b/docs/ecosystem/integrations-community.md @@ -58,11 +58,7 @@ To add an integration to this list, see the [Integrations - create page](./integ - [SVG diagram generator](https://github.com/SimonKenyonShepard/mermaidjs-github-svg-generator) - [GitLab](https://docs.gitlab.com/ee/user/markdown.html#diagrams-and-flowcharts) ✅ - [GNU Octave](https://octave.org/) ✅ - - [Octave Repo Index](https://gnu-octave.github.io/packages/octave_mermaid_js/) ✅ - - [News](https://github.com/CNOCTAVE/octave_mermaid_js/blob/main/NEWS) ✅ - - [Source Code](https://github.com/CNOCTAVE/octave_mermaid_js) ✅ - - [Function Reference](https://cnoctave.github.io/octave_mermaid_js/index.html) ✅ - - [Bug Tracker](https://github.com/CNOCTAVE/octave_mermaid_js/issues) ✅ + - [octave_mermaid_js](https://github.com/CNOCTAVE/octave_mermaid_js) ✅ - [Mermaid Plugin for JetBrains IDEs](https://plugins.jetbrains.com/plugin/20146-mermaid) - [MonsterWriter](https://www.monsterwriter.com/) ✅ - [Joplin](https://joplinapp.org) ✅