Compare commits

...

12 Commits

Author SHA1 Message Date
Knut Sveidqvist
4be66554b3 #3659 Adding height when not using maxWidth 2022-10-13 14:26:05 +02:00
Sidharth Vinod
57b883c7dd Merge pull request #3605 from arpansaha13/sidv/fixWindowsPath
Fix windows paths for `docs:build`
2022-10-13 12:59:07 +05:30
Sidharth Vinod
af0f0ca526 Merge pull request #3657 from revolter/patch-1
Remove inconsistent and deprecated semicolons
2022-10-13 11:29:43 +05:30
Alois Klink
bc9ed8e1bd Merge pull request #3646 from mermaid-js/renovate/actions-setup-node-3.x
chore(deps): update actions/setup-node action to v3
2022-10-13 00:00:09 +01:00
renovate[bot]
673a2e8228 chore(deps): update actions/setup-node action to v3 2022-10-12 22:52:41 +00:00
Alois Klink
75c67ed948 Merge pull request #3645 from mermaid-js/renovate/actions-checkout-3.x
chore(deps): update actions/checkout action to v3
2022-10-12 23:51:51 +01:00
Iulian Onofrei
353895dceb Remove inconsistent and deprecated semicolons 2022-10-12 23:01:29 +03:00
renovate[bot]
e5c85cbc64 chore(deps): update actions/checkout action to v3 2022-10-11 20:56:31 +00:00
lemontreejs
2bb0cf17d1 refactor: use posix.join() instead of replacing \ 2022-10-09 21:03:57 +05:30
lemontreejs
622b441eb0 fix: docs path in windows 2022-10-08 20:06:57 +05:30
Sidharth Vinod
6f05d4b05a fix: docs path in windows 2022-10-08 12:16:39 +08:00
Sidharth Vinod
ab5111e84f fix: Remove hard coded Path separator 2022-10-08 12:16:24 +08:00
6 changed files with 52 additions and 53 deletions

View File

@@ -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'

View File

@@ -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');

View File

@@ -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?)
``` ```

View File

@@ -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');
} }
} }

View File

@@ -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?)
``` ```

View File

@@ -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;