diff --git a/.github/gh-pages-publish.yml b/.github/gh-pages-publish.yml deleted file mode 100644 index ef50a8d000..0000000000 --- a/.github/gh-pages-publish.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Build and Deploy Docs -on: - push: - branches: - - master -permissions: - contents: write -jobs: - build-and-deploy: - runs-on: ubuntu-latest - steps: - - name: Checkout 🛎️ - uses: actions/checkout@v3 - - - name: Install pnpm - uses: pnpm/action-setup@v2.2.4 - - - name: Install deps - run: pnpm install - - - name: Install and Build 🔧 - run: | - cd ./packages/mermaid - pnpm docs:build:vitepress - - - name: Deploy 🚀📕 - uses: JamesIves/github-pages-deploy-action@v4.3.3 - with: - branch: gh-pages - folder: packages/mermaid/src/vitepress/.vitepress/dist diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 2d50e97bac..8ba06989d0 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -39,4 +39,5 @@ jobs: run: pnpm run lint - name: Verify Docs - run: cd packages/mermaid && pnpm docs:verify + working-directory: ./packages/mermaid + run: pnpm run docs:verify diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b3543557fb..71eed23bb5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -72,16 +72,16 @@ flowchart LR If you want to preview the whole documentation site on your machine: ```sh -$ cd mermaid -$ pnpm i -$ pnpm docs:dev +cd mermaid +pnpm i +pnpm docs:dev ``` You can now build and serve the documentation site: ```sh -$ pnpm docs:build:vitepress -$ pnpm docs:serve +pnpm docs:build:vitepress +pnpm docs:serve ``` ## Branching diff --git a/package.json b/package.json index f76588dcf1..9aa5c2b7ad 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,6 @@ "coveralls": "3.1.1", "cypress": "10.10.0", "cypress-image-snapshot": "4.0.1", - "documentation": "13.2.5", "esbuild": "0.15.12", "eslint": "8.25.0", "eslint-config-prettier": "8.5.0", diff --git a/packages/mermaid/src/docs/.vitepress/config.ts b/packages/mermaid/src/docs/.vitepress/config.ts index 2dde653ac4..077ec86db2 100644 --- a/packages/mermaid/src/docs/.vitepress/config.ts +++ b/packages/mermaid/src/docs/.vitepress/config.ts @@ -104,7 +104,7 @@ function sidebarSyntax() { { text: 'Gantt', link: '/syntax/gantt' }, { text: 'Pie Chart', link: '/syntax/pie' }, { text: 'Requirement Diagram', link: '/syntax/requirementDiagram' }, - { text: 'Gitgraph (Git) Diagram 🔥', link: '/syntax/gitGraph' }, + { text: 'Gitgraph (Git) Diagram 🔥', link: '/syntax/gitgraph' }, { text: 'C4C Diagram (Context) Diagram 🦺⚠️', link: '/syntax/c4c' }, { text: 'Other Examples', link: '/syntax/examples' }, ], @@ -120,7 +120,7 @@ function sidebarConfig() { items: [ { text: 'Tutorials', link: '/config/Tutorials' }, { text: 'API-Usage', link: '/config/usage' }, - { text: 'Mermaid API Configuration', link: '/config/setup/modules' }, + { text: 'Mermaid API Configuration', link: '/config/setup/README' }, { text: 'Directives', link: '/config/directives' }, { text: 'Theming', link: '/config/theming' }, { text: 'Accessibility', link: '/config/accessibility' }, @@ -156,7 +156,6 @@ function sidebarCommunity() { text: 'Development and Contribution', link: '/community/development', }, - { text: 'Changelog', link: '/community/CHANGELOG' }, { text: 'Adding Diagrams', link: '/community/newDiagram' }, { text: 'Security', link: '/community/security' }, ], diff --git a/packages/mermaid/src/docs/config/setup/modules/mermaidAPI.md b/packages/mermaid/src/docs/config/setup/modules/mermaidAPI.md index 79307c4ff4..b9e7e90de2 100644 --- a/packages/mermaid/src/docs/config/setup/modules/mermaidAPI.md +++ b/packages/mermaid/src/docs/config/setup/modules/mermaidAPI.md @@ -12,9 +12,69 @@ Renames and re-exports [mermaidAPI](mermaidAPI.md#mermaidapi) • `Const` **mermaidAPI**: `Readonly`<{ `defaultConfig`: `MermaidConfig` = configApi.defaultConfig; `getConfig`: () => `MermaidConfig` = configApi.getConfig; `getSiteConfig`: () => `MermaidConfig` = configApi.getSiteConfig; `globalReset`: () => `void` ; `initialize`: (`options`: `MermaidConfig`) => `Promise`<`void`\> ; `parse`: (`text`: `string`, `parseError?`: `ParseErrorFunction`) => `boolean` ; `parseDirective`: (`p`: `any`, `statement`: `string`, `context`: `string`, `type`: `string`) => `void` ; `render`: (`id`: `string`, `text`: `string`, `cb`: (`svgCode`: `string`, `bindFunctions?`: (`element`: `Element`) => `void`) => `void`, `container?`: `Element`) => `Promise`<`void`\> ; `reset`: () => `void` ; `setConfig`: (`conf`: `MermaidConfig`) => `MermaidConfig` = configApi.setConfig; `updateSiteConfig`: (`conf`: `MermaidConfig`) => `MermaidConfig` = configApi.updateSiteConfig }\> +## mermaidAPI configuration defaults + +```ts +const config = { + theme: 'default', + logLevel: 'fatal', + securityLevel: 'strict', + startOnLoad: true, + arrowMarkerAbsolute: false, + + er: { + diagramPadding: 20, + layoutDirection: 'TB', + minEntityWidth: 100, + minEntityHeight: 75, + entityPadding: 15, + stroke: 'gray', + fill: 'honeydew', + fontSize: 12, + useMaxWidth: true, + }, + flowchart: { + diagramPadding: 8, + htmlLabels: true, + curve: 'basis', + }, + sequence: { + diagramMarginX: 50, + diagramMarginY: 10, + actorMargin: 50, + width: 150, + height: 65, + boxMargin: 10, + boxTextMargin: 5, + noteMargin: 10, + messageMargin: 35, + messageAlign: 'center', + mirrorActors: true, + bottomMarginAdj: 1, + useMaxWidth: true, + rightAngles: false, + showSequenceNumbers: false, + }, + gantt: { + titleTopMargin: 25, + barHeight: 20, + barGap: 4, + topPadding: 50, + leftPadding: 75, + gridLineStartPadding: 35, + fontSize: 11, + fontFamily: '"Open Sans", sans-serif', + numberSectionStyles: 4, + axisFormat: '%Y-%m-%d', + topAxis: false, + }, +}; +mermaid.initialize(config); +``` + #### Defined in -mermaidAPI.ts:485 +mermaidAPI.ts:546 ## Functions diff --git a/packages/mermaid/src/mermaidAPI.ts b/packages/mermaid/src/mermaidAPI.ts index d6bc9672a9..384b456f82 100644 --- a/packages/mermaid/src/mermaidAPI.ts +++ b/packages/mermaid/src/mermaidAPI.ts @@ -482,32 +482,10 @@ async function initialize(options: MermaidConfig) { addDiagrams(); } -export const mermaidAPI = Object.freeze({ - render, - parse, - parseDirective, - initialize, - getConfig: configApi.getConfig, - setConfig: configApi.setConfig, - getSiteConfig: configApi.getSiteConfig, - updateSiteConfig: configApi.updateSiteConfig, - reset: () => { - configApi.reset(); - }, - globalReset: () => { - configApi.reset(configApi.defaultConfig); - }, - defaultConfig: configApi.defaultConfig, -}); - -setLogLevel(configApi.getConfig().logLevel); -configApi.reset(configApi.getConfig()); -export default mermaidAPI; /** * ## mermaidAPI configuration defaults * - * ```html - * * ``` */ +export const mermaidAPI = Object.freeze({ + render, + parse, + parseDirective, + initialize, + getConfig: configApi.getConfig, + setConfig: configApi.setConfig, + getSiteConfig: configApi.getSiteConfig, + updateSiteConfig: configApi.updateSiteConfig, + reset: () => { + configApi.reset(); + }, + globalReset: () => { + configApi.reset(configApi.defaultConfig); + }, + defaultConfig: configApi.defaultConfig, +}); + +setLogLevel(configApi.getConfig().logLevel); +configApi.reset(configApi.getConfig()); + +export default mermaidAPI; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ed23652b04..468212ce4f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -34,7 +34,6 @@ importers: d3: 7.6.1 dagre: 0.8.5 dagre-d3: 0.6.4 - documentation: 13.2.5 dompurify: 2.4.0 esbuild: 0.15.12 eslint: 8.25.0 @@ -119,7 +118,6 @@ importers: coveralls: 3.1.1 cypress: 10.10.0 cypress-image-snapshot: 4.0.1_i53o2fh6a5o5tv3qlenzwcubc4 - documentation: 13.2.5 esbuild: 0.15.12 eslint: 8.25.0 eslint-config-prettier: 8.5.0_eslint@8.25.0