mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-22 08:50:13 +02:00
Compare commits
12 Commits
v9.2.0
...
3659_heigh
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4be66554b3 | ||
![]() |
57b883c7dd | ||
![]() |
af0f0ca526 | ||
![]() |
bc9ed8e1bd | ||
![]() |
673a2e8228 | ||
![]() |
75c67ed948 | ||
![]() |
353895dceb | ||
![]() |
e5c85cbc64 | ||
![]() |
2bb0cf17d1 | ||
![]() |
622b441eb0 | ||
![]() |
6f05d4b05a | ||
![]() |
ab5111e84f |
4
.github/workflows/docs.yml
vendored
4
.github/workflows/docs.yml
vendored
@@ -16,9 +16,9 @@ jobs:
|
|||||||
name: 'Docs: Spellcheck'
|
name: 'Docs: Spellcheck'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
name: Check out the code
|
name: Check out the code
|
||||||
- uses: actions/setup-node@v1
|
- uses: actions/setup-node@v3
|
||||||
name: Setup node
|
name: Setup node
|
||||||
with:
|
with:
|
||||||
node-version: '16'
|
node-version: '16'
|
||||||
|
@@ -56,21 +56,10 @@
|
|||||||
<body>
|
<body>
|
||||||
<div>Security check</div>
|
<div>Security check</div>
|
||||||
<pre id="diagram" class="mermaid">
|
<pre id="diagram" class="mermaid">
|
||||||
classDiagram
|
flowchart TD
|
||||||
direction LR
|
A --> B
|
||||||
class Student {
|
B --> C
|
||||||
-idCard : IdCard
|
A --> C
|
||||||
}
|
|
||||||
class IdCard{
|
|
||||||
-id : int
|
|
||||||
-name : string
|
|
||||||
}
|
|
||||||
class Bike{
|
|
||||||
-id : int
|
|
||||||
-name : string
|
|
||||||
}
|
|
||||||
Student "1" --o "1" IdCard : carries
|
|
||||||
Student "1" --o "1" Bike : rides
|
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram" class="mermaid2">
|
<pre id="diagram" class="mermaid2">
|
||||||
mindmap
|
mindmap
|
||||||
@@ -98,8 +87,14 @@ mindmap
|
|||||||
::icon(mdi mdi-fire)
|
::icon(mdi mdi-fire)
|
||||||
gc7((grand<br/>grand<br/>child 8))
|
gc7((grand<br/>grand<br/>child 8))
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram" class="mermaid2">
|
<pre id="diagram" class="mermaid">
|
||||||
example-diagram
|
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
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<!-- <div id="cy"></div> -->
|
<!-- <div id="cy"></div> -->
|
||||||
@@ -116,13 +111,18 @@ mindmap
|
|||||||
theme: 'forest',
|
theme: 'forest',
|
||||||
startOnLoad: true,
|
startOnLoad: true,
|
||||||
logLevel: 0,
|
logLevel: 0,
|
||||||
// basePath: './packages/',
|
flowchart: {
|
||||||
// themeVariables: { darkMode: true },
|
useMaxWidth: false,
|
||||||
|
htmlLabels: true,
|
||||||
|
},
|
||||||
|
gantt: {
|
||||||
|
useMaxWidth: false,
|
||||||
|
},
|
||||||
|
useMaxWidth: false,
|
||||||
lazyLoadedDiagrams: [
|
lazyLoadedDiagrams: [
|
||||||
'./mermaid-mindmap-detector.esm.mjs',
|
'./mermaid-mindmap-detector.esm.mjs',
|
||||||
'./mermaid-example-diagram-detector.esm.mjs',
|
'./mermaid-example-diagram-detector.esm.mjs',
|
||||||
],
|
],
|
||||||
// lazyLoadedDiagrams: ['../../mermaid-mindmap/registry.ts'],
|
|
||||||
});
|
});
|
||||||
function callback() {
|
function callback() {
|
||||||
alert('It worked');
|
alert('It worked');
|
||||||
|
@@ -315,13 +315,13 @@ flowchart LR
|
|||||||
### Dotted link
|
### Dotted link
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
flowchart LR;
|
flowchart LR
|
||||||
A-.->B;
|
A-.->B
|
||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
flowchart LR;
|
flowchart LR
|
||||||
A-.->B;
|
A-.->B
|
||||||
```
|
```
|
||||||
|
|
||||||
### Dotted link with text
|
### Dotted link with text
|
||||||
@@ -866,13 +866,13 @@ A shorter form of adding a class is to attach the classname to the node using th
|
|||||||
```mermaid-example
|
```mermaid-example
|
||||||
flowchart LR
|
flowchart LR
|
||||||
A:::someclass --> B
|
A:::someclass --> B
|
||||||
classDef someclass fill:#f96;
|
classDef someclass fill:#f96
|
||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
flowchart LR
|
flowchart LR
|
||||||
A:::someclass --> B
|
A:::someclass --> B
|
||||||
classDef someclass fill:#f96;
|
classDef someclass fill:#f96
|
||||||
```
|
```
|
||||||
|
|
||||||
### Css classes
|
### Css classes
|
||||||
@@ -895,14 +895,14 @@ below:
|
|||||||
**Example definition**
|
**Example definition**
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
flowchart LR;
|
flowchart LR
|
||||||
A-->B[AAA<span>BBB</span>]
|
A-->B[AAA<span>BBB</span>]
|
||||||
B-->D
|
B-->D
|
||||||
class A cssClass
|
class A cssClass
|
||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
flowchart LR;
|
flowchart LR
|
||||||
A-->B[AAA<span>BBB</span>]
|
A-->B[AAA<span>BBB</span>]
|
||||||
B-->D
|
B-->D
|
||||||
class A cssClass
|
class A cssClass
|
||||||
@@ -924,7 +924,7 @@ The icons are accessed via the syntax fa:#icon class name#.
|
|||||||
flowchart TD
|
flowchart TD
|
||||||
B["fab:fa-twitter for peace"]
|
B["fab:fa-twitter for peace"]
|
||||||
B-->C[fa:fa-ban forbidden]
|
B-->C[fa:fa-ban forbidden]
|
||||||
B-->D(fa:fa-spinner);
|
B-->D(fa:fa-spinner)
|
||||||
B-->E(A fa:fa-camera-retro perhaps?)
|
B-->E(A fa:fa-camera-retro perhaps?)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -932,7 +932,7 @@ flowchart TD
|
|||||||
flowchart TD
|
flowchart TD
|
||||||
B["fab:fa-twitter for peace"]
|
B["fab:fa-twitter for peace"]
|
||||||
B-->C[fa:fa-ban forbidden]
|
B-->C[fa:fa-ban forbidden]
|
||||||
B-->D(fa:fa-spinner);
|
B-->D(fa:fa-spinner)
|
||||||
B-->E(A fa:fa-camera-retro perhaps?)
|
B-->E(A fa:fa-camera-retro perhaps?)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@@ -35,7 +35,7 @@ import { exec } from 'child_process';
|
|||||||
import { globby } from 'globby';
|
import { globby } from 'globby';
|
||||||
import { JSDOM } from 'jsdom';
|
import { JSDOM } from 'jsdom';
|
||||||
import type { Code, Root } from 'mdast';
|
import type { Code, Root } from 'mdast';
|
||||||
import { join, dirname } from 'path';
|
import { posix, dirname } from 'path';
|
||||||
import prettier from 'prettier';
|
import prettier from 'prettier';
|
||||||
import { remark } from 'remark';
|
import { remark } from 'remark';
|
||||||
// @ts-ignore No typescript declaration file
|
// @ts-ignore No typescript declaration file
|
||||||
@@ -210,30 +210,28 @@ const transformHtml = (filename: string) => {
|
|||||||
copyTransformedContents(filename, !verifyOnly, formattedHTML);
|
copyTransformedContents(filename, !verifyOnly, formattedHTML);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getFilesFromGlobs = async (globs: string[]): Promise<string[]> => {
|
||||||
|
return await globby(globs, { dot: true });
|
||||||
|
};
|
||||||
|
|
||||||
/** Main method (entry point) */
|
/** Main method (entry point) */
|
||||||
(async () => {
|
(async () => {
|
||||||
if (verifyOnly) {
|
if (verifyOnly) {
|
||||||
console.log('Verifying that all files are in sync with the source files');
|
console.log('Verifying that all files are in sync with the source files');
|
||||||
}
|
}
|
||||||
const sourceDirGlob = join('.', SOURCE_DOCS_DIR, '**');
|
const sourceDirGlob = posix.join('.', SOURCE_DOCS_DIR, '**');
|
||||||
const includeFilesStartingWithDot = true;
|
const action = verifyOnly ? 'Verifying' : 'Transforming';
|
||||||
|
|
||||||
console.log('Transforming markdown files...');
|
const mdFiles = await getFilesFromGlobs([posix.join(sourceDirGlob, '*.md')]);
|
||||||
const mdFiles = await globby([join(sourceDirGlob, '*.md')], {
|
console.log(`${action} ${mdFiles.length} markdown files...`);
|
||||||
dot: includeFilesStartingWithDot,
|
|
||||||
});
|
|
||||||
mdFiles.forEach(transformMarkdown);
|
mdFiles.forEach(transformMarkdown);
|
||||||
|
|
||||||
console.log('Transforming html files...');
|
const htmlFiles = await getFilesFromGlobs([posix.join(sourceDirGlob, '*.html')]);
|
||||||
const htmlFiles = await globby([join(sourceDirGlob, '*.html')], {
|
console.log(`${action} ${htmlFiles.length} html files...`);
|
||||||
dot: includeFilesStartingWithDot,
|
|
||||||
});
|
|
||||||
htmlFiles.forEach(transformHtml);
|
htmlFiles.forEach(transformHtml);
|
||||||
|
|
||||||
console.log('Transforming all other files...');
|
const otherFiles = await getFilesFromGlobs([sourceDirGlob, '!**/*.md', '!**/*.html']);
|
||||||
const otherFiles = await globby([sourceDirGlob, '!**/*.md', '!**/*.html'], {
|
console.log(`${action} ${otherFiles.length} other files...`);
|
||||||
dot: includeFilesStartingWithDot,
|
|
||||||
});
|
|
||||||
otherFiles.forEach((file: string) => {
|
otherFiles.forEach((file: string) => {
|
||||||
copyTransformedContents(file, !verifyOnly); // no transformation
|
copyTransformedContents(file, !verifyOnly); // no transformation
|
||||||
});
|
});
|
||||||
@@ -244,7 +242,7 @@ const transformHtml = (filename: string) => {
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
if (git) {
|
if (git) {
|
||||||
console.log('Adding changes in ${FINAL_DOCS_DIR} folder to git');
|
console.log(`Adding changes in ${FINAL_DOCS_DIR} folder to git`);
|
||||||
exec('git add docs');
|
exec('git add docs');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -198,8 +198,8 @@ flowchart LR
|
|||||||
### Dotted link
|
### Dotted link
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
flowchart LR;
|
flowchart LR
|
||||||
A-.->B;
|
A-.->B
|
||||||
```
|
```
|
||||||
|
|
||||||
### Dotted link with text
|
### Dotted link with text
|
||||||
@@ -587,7 +587,7 @@ A shorter form of adding a class is to attach the classname to the node using th
|
|||||||
```mermaid-example
|
```mermaid-example
|
||||||
flowchart LR
|
flowchart LR
|
||||||
A:::someclass --> B
|
A:::someclass --> B
|
||||||
classDef someclass fill:#f96;
|
classDef someclass fill:#f96
|
||||||
```
|
```
|
||||||
|
|
||||||
### Css classes
|
### Css classes
|
||||||
@@ -610,7 +610,7 @@ below:
|
|||||||
**Example definition**
|
**Example definition**
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
flowchart LR;
|
flowchart LR
|
||||||
A-->B[AAA<span>BBB</span>]
|
A-->B[AAA<span>BBB</span>]
|
||||||
B-->D
|
B-->D
|
||||||
class A cssClass
|
class A cssClass
|
||||||
@@ -634,7 +634,7 @@ The icons are accessed via the syntax fa:#icon class name#.
|
|||||||
flowchart TD
|
flowchart TD
|
||||||
B["fab:fa-twitter for peace"]
|
B["fab:fa-twitter for peace"]
|
||||||
B-->C[fa:fa-ban forbidden]
|
B-->C[fa:fa-ban forbidden]
|
||||||
B-->D(fa:fa-spinner);
|
B-->D(fa:fa-spinner)
|
||||||
B-->E(A fa:fa-camera-retro perhaps?)
|
B-->E(A fa:fa-camera-retro perhaps?)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@@ -26,6 +26,7 @@ export const calculateSvgSizeAttrs = function (height, width, useMaxWidth) {
|
|||||||
attrs.set('width', '100%');
|
attrs.set('width', '100%');
|
||||||
attrs.set('style', `max-width: ${width}px;`);
|
attrs.set('style', `max-width: ${width}px;`);
|
||||||
} else {
|
} else {
|
||||||
|
attrs.set('height', height);
|
||||||
attrs.set('width', width);
|
attrs.set('width', width);
|
||||||
}
|
}
|
||||||
return attrs;
|
return attrs;
|
||||||
|
Reference in New Issue
Block a user