Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add plugin-markdown-chart #249

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,33 @@
"cSpell.words": [
"artalk",
"bumpp",
"chartjs",
"composables",
"darkmode",
"devtool",
"docsearch",
"echarts",
"envinfo",
"esbuild",
"frontmatter",
"fullscreen",
"gantt",
"giscus",
"globby",
"gtag",
"jsonld",
"lazyload",
"lightmode",
"katex",
"markmap",
"mathjax",
"mdit",
"mindmap",
"nord",
"nprogress",
"pageview",
"photoswipe",
"plantuml",
"prefetch",
"preload",
"prismjs",
Expand Down
9 changes: 9 additions & 0 deletions docs/.vuepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { catalogPlugin } from '@vuepress/plugin-catalog'
import { commentPlugin } from '@vuepress/plugin-comment'
import { docsearchPlugin } from '@vuepress/plugin-docsearch'
import { feedPlugin } from '@vuepress/plugin-feed'
import { markdownChartPlugin } from '@vuepress/plugin-markdown-chart'
import { markdownImagePlugin } from '@vuepress/plugin-markdown-image'
import { markdownMathPlugin } from '@vuepress/plugin-markdown-math'
import { redirectPlugin } from '@vuepress/plugin-redirect'
Expand Down Expand Up @@ -91,6 +92,14 @@ export default defineUserConfig({
json: true,
rss: true,
}),
markdownChartPlugin({
chartjs: true,
echarts: true,
flowchart: true,
markmap: true,
mermaid: true,
plantuml: true,
}),
markdownImagePlugin({
figure: true,
mark: true,
Expand Down
12 changes: 10 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@vuepress/plugin-copy-code": "workspace:*",
"@vuepress/plugin-docsearch": "workspace:*",
"@vuepress/plugin-feed": "workspace:*",
"@vuepress/plugin-markdown-chart": "workspace:*",
"@vuepress/plugin-markdown-image": "workspace:*",
"@vuepress/plugin-markdown-math": "workspace:*",
"@vuepress/plugin-markdown-tab": "workspace:*",
Expand All @@ -33,9 +34,16 @@
"@vuepress/plugin-shiki": "workspace:*",
"@vuepress/plugin-cache": "workspace:*",
"@vuepress/theme-default": "workspace:*",
"chart.js": "^4.4.4",
"echarts": "^5.5.1",
"flowchart.ts": "^3.0.1",
"katex": "0.16.11",
"mathjax-full": "3.2.2",
"sass-embedded": "1.79.4",
"markmap-lib": "^0.17.2",
"markmap-toolbar": "^0.17.2",
"markmap-view": "^0.17.2",
"mathjax-full": "^3.2.2",
"mermaid": "^11.2.1",
"sass-embedded": "^1.79.4",
"sass-loader": "^16.0.2",
"vue": "^3.5.10",
"vuepress": "2.0.0-rc.17"
Expand Down
58 changes: 58 additions & 0 deletions docs/plugins/markdown/markdown-chart/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# markdown-chart

<NpmBadge package="@vuepress/plugin-markdown-chart" />

Add powerful charts to your VuePress site.

This plugin provides 6 ways to let you insert charts into your markdown file.

- chart.js: A lightweight, easy-to-use, highly customizable chart library.

chart.js is lighter comparing to echarts.

- echarts: A powerful, interactive charting and visualization library for browser.

echarts is more powerful comparing to chart.js.

- Flowchart: A simple markdown extension to generate flowcharts and sequence diagrams.

Lightweight, only focusing on flowcharts.

- Markmap: Create mindmap with markdown

The runtime is very heavy, not recommended.

- Mermaid: Generation of diagram and flowchart from text in a similar manner as markdown.

Powerful collection of common charts.

- Plantuml: UML diagram driven by Java.

No runtime, diagram render is processed on plantuml server.

## Usage

```bash
npm i -D @vuepress/plugin-markdown-chart@next
```

```ts
import { markdownChartPlugin } from '@vuepress/plugin-markdown-chart'

export default {
plugins: [
markdownChartPlugin({
// Enable chart.js
chartjs: true,
// Enable echarts
echarts: true,
// Enable flowchart.ts
flowchart: true,
// Enable markmap
markmap: true,
// Enable mermaid
mermaid: true,
}),
],
}
```
Loading
Loading