diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 845c763e8..34b14c395 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -17,4 +17,4 @@ jobs: - name: 'Checkout Repository' uses: actions/checkout@v3 - name: 'Dependency Review' - uses: actions/dependency-review-action@v2 + uses: actions/dependency-review-action@v3 diff --git a/.github/workflows/pr-labeler.yml b/.github/workflows/pr-labeler.yml index 107743c6a..0a53c6e42 100644 --- a/.github/workflows/pr-labeler.yml +++ b/.github/workflows/pr-labeler.yml @@ -8,6 +8,6 @@ jobs: runs-on: ubuntu-latest steps: - name: Label PR - uses: TimonVS/pr-labeler-action@v3 + uses: TimonVS/pr-labeler-action@v4 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index 85bc79f6e..2153e11be 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -40,7 +40,7 @@ jobs: run: pnpm install --frozen-lockfile - name: Setup Pages - uses: actions/configure-pages@v2 + uses: actions/configure-pages@v3 - name: Run Build run: pnpm --filter mermaid run docs:build:vitepress diff --git a/.lintstagedrc.mjs b/.lintstagedrc.mjs index ff1d8c107..ac2623093 100644 --- a/.lintstagedrc.mjs +++ b/.lintstagedrc.mjs @@ -1,5 +1,11 @@ export default { - '!(docs/**/*)*.{ts,js,json,html,md,mts}': ['eslint --fix', 'prettier --write'], + '!(docs/**/*)*.{ts,js,json,html,md,mts}': [ + 'eslint --cache --cache-strategy content --fix', + // don't cache prettier yet, since we use `prettier-plugin-jsdoc`, + // and prettier doesn't invalidate cache on plugin updates" + // https://prettier.io/docs/en/cli.html#--cache + 'prettier --write', + ], 'cSpell.json': ['ts-node-esm scripts/fixCSpell.ts'], '**/*.jison': ['pnpm -w run lint:jison'], }; diff --git a/.vite/build.ts b/.vite/build.ts index 1261e375b..019461c49 100644 --- a/.vite/build.ts +++ b/.vite/build.ts @@ -41,11 +41,6 @@ const packageOptions = { packageName: 'mermaid-mindmap', file: 'detector.ts', }, - // 'mermaid-example-diagram-detector': { - // name: 'mermaid-example-diagram-detector', - // packageName: 'mermaid-example-diagram', - // file: 'detector.ts', - // }, }; interface BuildOptions { @@ -119,11 +114,7 @@ export const getBuildConfig = ({ minify, core, watch, entryName }: BuildOptions) if (watch && config.build) { config.build.watch = { - include: [ - 'packages/mermaid-mindmap/src/**', - 'packages/mermaid/src/**', - // 'packages/mermaid-example-diagram/src/**', - ], + include: ['packages/mermaid-mindmap/src/**', 'packages/mermaid/src/**'], }; } @@ -149,7 +140,6 @@ if (watch) { build(getBuildConfig({ minify: false, watch, core: false, entryName: 'mermaid' })); if (!mermaidOnly) { build(getBuildConfig({ minify: false, watch, entryName: 'mermaid-mindmap' })); - // build(getBuildConfig({ minify: false, watch, entryName: 'mermaid-example-diagram' })); } } else if (visualize) { await build(getBuildConfig({ minify: false, core: true, entryName: 'mermaid' })); diff --git a/.vite/server.ts b/.vite/server.ts index 334398dd8..aced396ec 100644 --- a/.vite/server.ts +++ b/.vite/server.ts @@ -1,6 +1,5 @@ import express, { NextFunction, Request, Response } from 'express'; import { createServer as createViteServer } from 'vite'; -// import { getBuildConfig } from './build'; const cors = (req: Request, res: Response, next: NextFunction) => { res.header('Access-Control-Allow-Origin', '*'); @@ -22,7 +21,7 @@ async function createServer() { app.use(cors); app.use(express.static('./packages/mermaid/dist')); - app.use(express.static('./packages/mermaid-example-diagram/dist')); + // app.use(express.static('./packages/mermaid-example-diagram/dist')); app.use(express.static('./packages/mermaid-mindmap/dist')); app.use(vite.middlewares); app.use(express.static('demos')); @@ -33,5 +32,4 @@ async function createServer() { }); } -// build(getBuildConfig({ minify: false, watch: true })); createServer(); diff --git a/README.md b/README.md index 9fed47a69..f4cf8e105 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,37 @@ -# mermaid +
+
+
+Generate diagrams from markdown-like text. +
+
-[](https://github.com/mermaid-js/mermaid/actions/workflows/build.yml) [](https://www.npmjs.com/package/mermaid) [](https://bundlephobia.com/package/mermaid) [](https://coveralls.io/github/mermaid-js/mermaid?branch=master) [](https://www.jsdelivr.com/package/npm/mermaid) [](https://www.npmjs.com/package/mermaid) [](https://join.slack.com/t/mermaid-talk/shared_invite/enQtNzc4NDIyNzk4OTAyLWVhYjQxOTI2OTg4YmE1ZmJkY2Y4MTU3ODliYmIwOTY3NDJlYjA0YjIyZTdkMDMyZTUwOGI0NjEzYmEwODcwOTE) [](https://twitter.com/mermaidjs_) +
+Live Editor! +
++ 📖 Documentation | 🚀 Getting Started | 🌐 CDN | 🙌 Join Us +
++简体中文 +
-English | [简体中文](./README.zh-CN.md) +
+
+
+通过解析类 Markdown 的文本语法来实现图表的创建和动态修改。 +
+
-[](https://github.com/mermaid-js/mermaid/actions/workflows/build.yml) [](https://www.npmjs.com/package/mermaid) [](https://bundlephobia.com/package/mermaid) [](https://coveralls.io/github/mermaid-js/mermaid?branch=master) [](https://www.jsdelivr.com/package/npm/mermaid) [](https://www.npmjs.com/package/mermaid) [](https://join.slack.com/t/mermaid-talk/shared_invite/enQtNzc4NDIyNzk4OTAyLWVhYjQxOTI2OTg4YmE1ZmJkY2Y4MTU3ODliYmIwOTY3NDJlYjA0YjIyZTdkMDMyZTUwOGI0NjEzYmEwODcwOTE) [](https://twitter.com/mermaidjs_) +
+Live Editor! +
++ 📖 文档 | 🚀 入门 | 🌐 CDN | 🙌 加入我们 +
++English +
-[English](./README.md) | 简体中文 ++ timeline + title My day + section section with no tasks + section Go to work at the dog office + 1930 : first step : second step is a long step + : third step + 1940 : fourth step : fifth step + section Go home + 1950 : India got independent and already won war against Pakistan + 1960 : India fights poverty, looses war to China and gets nuclear weapons from USA and USSR + 1970 : Green Revolution comes to india + section Another section with no tasks + I am a big big big tasks + I am not so big tasks ++
+ timeline + title MermaidChart 2023 Timeline + section 2023 Q1+ +
Release Personal Tier + Buttet 1 : sub-point 1a : sub-point 1b + : sub-point 1c + Bullet 2 : sub-point 2a : sub-point 2b + section 2023 Q2
Release XYZ Tier + Buttet 3 : sub-point
3a : sub-point 3b + : sub-point 3c + Bullet 4 : sub-point 4a : sub-point 4b + +
+ timeline + title England's History Timeline + section Stone Age + 7600 BC : Britain's oldest known house was built in Orkney, Scotland + 6000 BC : Sea levels rise and Britain becomes an island. The people who live here are hunter-gatherers. + section Broze Age + 2300 BC : People arrive from Europe and settle in Britain. They bring farming and metalworking. + : New styles of pottery and ways of burying the dead appear. + 2200 BC : The last major building works are completed at Stonehenge. People now bury their dead in stone circles. + : The first metal objects are made in Britain.Some other nice things happen. it is a good time to be alive. + ++
+ %%{'init': { 'logLevel': 'debug', 'theme': 'default', 'timeline': {'disableMulticolor':false} } }%% + timeline + title History of Social Media Platform + 2002 : LinkedIn + 2004 : Facebook : Google : Pixar + 2005 : Youtube + 2006 : Twitter + 2007 : Tumblr + 2008s : Instagram + 2010 : Pinterest ++
+ %%{init: { 'logLevel': 'debug', 'theme': 'base', 'themeVariables': { + 'cScale0': '#ff0000', + 'cScale1': '#00ff00', + 'cScale2': '#ff0000' + } } }%% + timeline + title History of Social Media Platform + 2002 : LinkedIn + 2004 : Facebook : Google : Pixar + 2005 : Youtube + 2006 : Twitter + 2007 : Tumblr + 2008s : Instagram + 2010 : Pinterest ++ +
+ %%{init: { 'logLevel': 'debug', 'theme': 'default' , 'themeVariables': { + 'cScale0': '#ff0000', + 'cScale1': '#00ff00', + 'cScale2': '#0000ff' + } } }%% + timeline + title History of Social Media Platform + 2002 : LinkedIn + 2004 : Facebook : Google + 2005 : Youtube + 2006 : Twitter + 2007 : Tumblr + 2008 : Instagram + 2010 : Pinterest + ++ +
+ timeline + title History of Social Media Platform + 2002 : LinkedIn + 2004 : Facebook : Google + 2005 : Youtube + 2006 : Twitter + 2007 : Tumblr + 2008s : Instagram + 2010 : Pinterest ++
+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-elk TB + a --> b + a --> c + b --> d + c --> d ++ + + + + + + + diff --git a/cypress/platform/class.html b/cypress/platform/class.html index 85fae2a77..1d72c34a5 100644 --- a/cypress/platform/class.html +++ b/cypress/platform/class.html @@ -46,13 +46,9 @@
%%{init: {'theme': 'base', 'fontFamily': 'courier', 'themeVariables': { 'primaryColor': '#fff000'}}}%% classDiagram-v2 - class BankAccount{ - +String owner - +BigDecimal balance - +deposit(amount) bool - +withdrawl(amount) int - } - cssClass "BankAccount" customCss +classA <|-- classB : implements +classC *-- classD : composition +classE o-- classF : aggregation
%%{init: {'theme': 'base', 'fontFamily': 'courier', 'themeVariables': { 'primaryColor': '#fff000'}}}%% diff --git a/cypress/platform/knsv2.html b/cypress/platform/knsv2.html index afc12dbe9..e28184627 100644 --- a/cypress/platform/knsv2.html +++ b/cypress/platform/knsv2.html @@ -54,7 +54,7 @@ -+%%{init: {"flowchart": {"defaultRenderer": "elk"}} }%% graph TB a --> b @@ -62,14 +62,14 @@ graph TB b --> d c --> d-+flowchart-elk TB a --> b a --> c b --> d c --> d-+%%{init: {"flowchart": {"defaultRenderer": "elk"}} }%% flowchart TB %% I could not figure out how to use double quotes in labels in Mermaid @@ -125,7 +125,7 @@ flowchart TB
-+flowchart TB %% I could not figure out how to use double quotes in labels in Mermaid subgraph ibm[IBM Espresso CPU] @@ -227,14 +227,24 @@ sequenceDiagram Customer->>+Merchant: Receives goods or services-- gantt - title Style today marker (vertical line should be 5px wide and half-transparent blue) - dateFormat YYYY-MM-DD - axisFormat %d - todayMarker stroke-width:5px,stroke:#00f,opacity:0.5 - section Section1 - Today: 1, -1h ++mindmap + root((mindmap)) + Origins + Long history + ::icon(fa fa-book) + Popularisation + British popular psychology author Tony Buzan + Research + On effectiveness@@ -252,7 +262,7 @@ sequenceDiagram // console.error('Mermaid error: ', err); }; mermaid.initialize({ - // theme: 'forest', + theme: 'dark', startOnLoad: true, logLevel: 0, flowchart: { diff --git a/demos/sequence.html b/demos/sequence.html index 2000d489a..891dc90ba 100644 --- a/demos/sequence.html +++ b/demos/sequence.html @@ -128,6 +128,22 @@
and features + On Automatic creation + Uses + Creative techniques + Strategic planning + Argument mapping + Tools + Pen and paper + Mermaid
++ sequenceDiagram + box lightgreen Alice & John + participant A + participant J + end + box Another Group very very long description not wrapped + participant B + end + A->>J: Hello John, how are you? + J->>A: Great! + A->>B: Hello Bob, how are you ? ++
+ + + +