Skip to content

Commit

Permalink
chore: fix most of aloisklink reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
emersonbottero committed Oct 31, 2022
1 parent fed3260 commit f87d163
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 67 deletions.
30 changes: 0 additions & 30 deletions .github/gh-pages-publish.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 2 additions & 3 deletions packages/mermaid/src/docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
],
Expand All @@ -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' },
Expand Down Expand Up @@ -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' },
],
Expand Down
62 changes: 61 additions & 1 deletion packages/mermaid/src/docs/config/setup/modules/mermaidAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
47 changes: 23 additions & 24 deletions packages/mermaid/src/mermaidAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
* <script>
* ```ts
* const config = {
* theme: 'default',
* logLevel: 'fatal',
Expand Down Expand Up @@ -563,6 +541,27 @@ export default mermaidAPI;
* },
* };
* mermaid.initialize(config);
* </script>
* ```
*/
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;
2 changes: 0 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f87d163

Please sign in to comment.