rspress-plugin-mermaid 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/README.md +10 -8
- package/dist/index.js +15 -5
- package/doc_build/static/search_index.8a52de80.json +1 -0
- package/package.json +10 -8
- package/src/index.ts +19 -5
- package/doc_build/static/search_index.e342ad1c.json +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# rspress-plugin-mermaid
|
|
2
|
+
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 546dcf0: release beta
|
|
8
|
+
- 5e28903: fixup publish config
|
|
9
|
+
- Updated dependencies [546dcf0]
|
|
10
|
+
- Updated dependencies [5e28903]
|
|
11
|
+
- rspress-plugin-devkit@0.1.1
|
|
12
|
+
|
|
13
|
+
## 0.1.1-beta.0
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 546dcf0: release beta
|
|
18
|
+
- Updated dependencies [546dcf0]
|
|
19
|
+
- rspress-plugin-devkit@0.1.1-beta.0
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# rspress-plugin-mermaid
|
|
1
|
+
# rspress-plugin-mermaid 
|
|
2
2
|
|
|
3
3
|
Rspress plugin to render mermaid diagrams in markdown files.
|
|
4
4
|
|
|
@@ -16,7 +16,7 @@ flowchart TD
|
|
|
16
16
|
````
|
|
17
17
|
|
|
18
18
|
<div align="center">
|
|
19
|
-
<img src="./image.png" alt="sample" width="400" height="
|
|
19
|
+
<img src="./image.png" alt="sample" width="400" height="560" />
|
|
20
20
|
</div>
|
|
21
21
|
|
|
22
22
|
## Usage
|
|
@@ -52,10 +52,12 @@ import mermaid from 'rspress-plugin-mermaid';
|
|
|
52
52
|
|
|
53
53
|
export default defineConfig({
|
|
54
54
|
root: path.join(__dirname, 'docs'),
|
|
55
|
-
plugins: [
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
plugins: [
|
|
56
|
+
mermaid({
|
|
57
|
+
mermaidConfig: {
|
|
58
|
+
theme: 'forest',
|
|
59
|
+
},
|
|
60
|
+
}),
|
|
61
|
+
],
|
|
60
62
|
});
|
|
61
|
-
```
|
|
63
|
+
```
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
-
import {
|
|
2
|
+
import { PresetConfigMutator, RemarkCodeBlockToGlobalComponentPluginFactory, } from 'rspress-plugin-devkit';
|
|
3
3
|
export default function rspressPluginMermaid(options = {}) {
|
|
4
4
|
const { mermaidConfig = {} } = options;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
transformers: [
|
|
5
|
+
const remarkMermaid = new RemarkCodeBlockToGlobalComponentPluginFactory({
|
|
6
|
+
components: [
|
|
8
7
|
{
|
|
9
8
|
lang: 'mermaid',
|
|
10
9
|
componentPath: path.join(__dirname, './components/MermaidRender.tsx'),
|
|
@@ -19,5 +18,16 @@ export default function rspressPluginMermaid(options = {}) {
|
|
|
19
18
|
},
|
|
20
19
|
},
|
|
21
20
|
],
|
|
22
|
-
})
|
|
21
|
+
});
|
|
22
|
+
return {
|
|
23
|
+
name: 'rspress-plugin-mermaid',
|
|
24
|
+
config(config) {
|
|
25
|
+
return new PresetConfigMutator(config).disableMdxRs().toConfig();
|
|
26
|
+
},
|
|
27
|
+
markdown: {
|
|
28
|
+
remarkPlugins: [remarkMermaid.remarkPlugin],
|
|
29
|
+
globalComponents: remarkMermaid.mdxComponents,
|
|
30
|
+
},
|
|
31
|
+
builderConfig: remarkMermaid.builderConfig,
|
|
32
|
+
};
|
|
23
33
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"id":0,"title":"RSPress x Mermaid","content":"#\n\nMERMAID\n\nflowchart TD\n\nA[Christmas] -->|Get money| B(Go shopping)\n\nB --> C{Let me think}\n\nC -->|One| D[Laptop]\n\nC -->|Two| E[iPhone]\n\nC -->|Three| F[fa:fa-car Car]","routePath":"/","lang":"","toc":[],"domain":"","frontmatter":{},"version":""}]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rspress-plugin-mermaid",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Rspress plugin to render mermaid diagrams",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rspress",
|
|
@@ -19,15 +19,18 @@
|
|
|
19
19
|
"author": "Linbudu <linbudu599@gmail.com> (https://github.com/linbudu599)",
|
|
20
20
|
"main": "dist/index.js",
|
|
21
21
|
"types": "dist/index.d.ts",
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
22
25
|
"dependencies": {
|
|
23
|
-
"@rspress/shared": "^1.
|
|
26
|
+
"@rspress/shared": "^1.17.1",
|
|
24
27
|
"mermaid": "^10.9.0",
|
|
25
|
-
"rspress-plugin-devkit": "^0.1.
|
|
28
|
+
"rspress-plugin-devkit": "^0.1.1"
|
|
26
29
|
},
|
|
27
30
|
"devDependencies": {
|
|
28
|
-
"@types/node": "^20.12.
|
|
29
|
-
"@types/react": "^18.2.
|
|
30
|
-
"typescript": "^5"
|
|
31
|
+
"@types/node": "^20.12.5",
|
|
32
|
+
"@types/react": "^18.2.74",
|
|
33
|
+
"typescript": "^5.4.4"
|
|
31
34
|
},
|
|
32
35
|
"peerDependencies": {
|
|
33
36
|
"rspress": "*"
|
|
@@ -36,7 +39,6 @@
|
|
|
36
39
|
"build": "tsc --declarationMap false",
|
|
37
40
|
"dev": "tsc -w",
|
|
38
41
|
"docs:build": "rspress build",
|
|
39
|
-
"docs:dev": "rspress dev"
|
|
40
|
-
"prepublish": "npm run build"
|
|
42
|
+
"docs:dev": "rspress dev"
|
|
41
43
|
}
|
|
42
44
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
PresetConfigMutator,
|
|
5
|
+
RemarkCodeBlockToGlobalComponentPluginFactory,
|
|
6
|
+
} from 'rspress-plugin-devkit';
|
|
4
7
|
|
|
5
8
|
import type { RspressPlugin } from '@rspress/shared';
|
|
6
9
|
import type { MermaidConfig } from 'mermaid';
|
|
@@ -15,9 +18,8 @@ export default function rspressPluginMermaid(
|
|
|
15
18
|
): RspressPlugin {
|
|
16
19
|
const { mermaidConfig = {} } = options;
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
transformers: [
|
|
21
|
+
const remarkMermaid = new RemarkCodeBlockToGlobalComponentPluginFactory({
|
|
22
|
+
components: [
|
|
21
23
|
{
|
|
22
24
|
lang: 'mermaid',
|
|
23
25
|
componentPath: path.join(__dirname, './components/MermaidRender.tsx'),
|
|
@@ -32,5 +34,17 @@ export default function rspressPluginMermaid(
|
|
|
32
34
|
},
|
|
33
35
|
},
|
|
34
36
|
],
|
|
35
|
-
})
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
name: 'rspress-plugin-mermaid',
|
|
41
|
+
config(config) {
|
|
42
|
+
return new PresetConfigMutator(config).disableMdxRs().toConfig();
|
|
43
|
+
},
|
|
44
|
+
markdown: {
|
|
45
|
+
remarkPlugins: [remarkMermaid.remarkPlugin],
|
|
46
|
+
globalComponents: remarkMermaid.mdxComponents,
|
|
47
|
+
},
|
|
48
|
+
builderConfig: remarkMermaid.builderConfig,
|
|
49
|
+
};
|
|
36
50
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[{"id":0,"title":"RSPress x Mermaid","content":"#\n\n","routePath":"/","lang":"","toc":[],"domain":"","frontmatter":{},"version":""}]
|