diff --git a/.eslintignore b/.eslintignore index 04348c410..1db5125d0 100644 --- a/.eslintignore +++ b/.eslintignore @@ -4,4 +4,5 @@ docs/Setup.md cypress.config.js cypress/plugins/index.js coverage -*.json \ No newline at end of file +*.json +node_modules diff --git a/.vite/build.ts b/.vite/build.ts index c2f8f08f5..a8cfe919c 100644 --- a/.vite/build.ts +++ b/.vite/build.ts @@ -44,6 +44,11 @@ const packageOptions = { packageName: 'mermaid-example-diagram', file: 'detector.ts', }, + 'mermaid-zenuml': { + name: 'mermaid-zenuml', + packageName: 'mermaid-zenuml', + file: 'detector.ts', + }, }; interface BuildOptions { @@ -146,6 +151,7 @@ if (watch) { build(getBuildConfig({ minify: false, watch, core: false, entryName: 'mermaid' })); if (!mermaidOnly) { build(getBuildConfig({ minify: false, watch, entryName: 'mermaid-example-diagram' })); + build(getBuildConfig({ minify: false, watch, entryName: 'mermaid-zenuml' })); } } else if (visualize) { await build(getBuildConfig({ minify: false, core: true, entryName: 'mermaid' })); diff --git a/.vite/server.ts b/.vite/server.ts index 5a86b3d5b..41e510c83 100644 --- a/.vite/server.ts +++ b/.vite/server.ts @@ -15,6 +15,7 @@ async function createServer() { app.use(cors()); app.use(express.static('./packages/mermaid/dist')); + app.use(express.static('./packages/mermaid-zenuml/dist')); app.use(express.static('./packages/mermaid-example-diagram/dist')); app.use(vite.middlewares); app.use(express.static('demos')); diff --git a/cSpell.json b/cSpell.json index 154d01a99..3fcc6ff4a 100644 --- a/cSpell.json +++ b/cSpell.json @@ -7,6 +7,7 @@ "alois", "aloisklink", "antiscript", + "antlr", "appli", "applitools", "asciidoctor", @@ -134,7 +135,8 @@ "vitepress", "vueuse", "xlink", - "yash" + "yash", + "zenuml" ], "patterns": [ { "name": "Markdown links", "pattern": "\\((.*)\\)", "description": "" }, diff --git a/cypress/integration/rendering/zenuml.spec.js b/cypress/integration/rendering/zenuml.spec.js new file mode 100644 index 000000000..f317fbe82 --- /dev/null +++ b/cypress/integration/rendering/zenuml.spec.js @@ -0,0 +1,19 @@ +import { imgSnapshotTest } from '../../helpers/util.js'; + +describe('Zen UML', () => { + it('Basic Zen UML diagram', () => { + imgSnapshotTest( + ` + zenuml + A.method() { + if(x) { + B.method() { + selfCall() { return X } + } + } + } + `, + {} + ); + }); +}); diff --git a/cypress/platform/viewer.js b/cypress/platform/viewer.js index a99c150f1..0b566e329 100644 --- a/cypress/platform/viewer.js +++ b/cypress/platform/viewer.js @@ -1,5 +1,6 @@ import mermaid2 from './mermaid.esm.mjs'; import externalExample from '../../packages/mermaid-example-diagram/dist/mermaid-example-diagram.core.mjs'; +import zenUml from '../../packages/mermaid-zenuml/dist/mermaid-zenuml.core.mjs'; function b64ToUtf8(str) { return decodeURIComponent(escape(window.atob(str))); @@ -44,7 +45,7 @@ const contentLoaded = async function () { document.getElementsByTagName('body')[0].appendChild(div); } - await mermaid2.registerExternalDiagrams([externalExample]); + await mermaid2.registerExternalDiagrams([externalExample, zenUml]); mermaid2.initialize(graphObj.mermaid); await mermaid2.run(); } diff --git a/demos/index.html b/demos/index.html index 0843cbabe..5299c2202 100644 --- a/demos/index.html +++ b/demos/index.html @@ -66,6 +66,9 @@