Skip to content

Commit

Permalink
feat: add chart plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Hope committed Dec 25, 2024
1 parent 6209ed0 commit 1b9f741
Show file tree
Hide file tree
Showing 60 changed files with 6,900 additions and 87 deletions.
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,20 @@
"artalk",
"bumpp",
"commitlint",
"chartjs",
"composables",
"darkmode",
"devtool",
"docsearch",
"domhandler",
"echarts",
"envinfo",
"esbuild",
"execa",
"fflate",
"frontmatter",
"fullscreen",
"gantt",
"giscus",
"globby",
"gtag",
Expand All @@ -46,16 +49,19 @@
"lazyload",
"lightmode",
"linkify",
"markmap",
"mathjax",
"mdit",
"meteorlxy",
"mindmap",
"nord",
"npmmirror",
"nprogress",
"pageview",
"pageviews",
"pengzhanbo",
"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 { commentPlugin } from '@vuepress/plugin-comment'
import { docsearchPlugin } from '@vuepress/plugin-docsearch'
import { feedPlugin } from '@vuepress/plugin-feed'
import { markdownExtPlugin } from '@vuepress/plugin-markdown-ext'
import { markdownChartPlugin } from '@vuepress/plugin-markdown-chart'

Check failure on line 11 in docs/.vuepress/config.ts

View workflow job for this annotation

GitHub Actions / bundle-check

`@vuepress/plugin-markdown-chart` import should occur before import of `@vuepress/plugin-markdown-ext`

Check failure on line 11 in docs/.vuepress/config.ts

View workflow job for this annotation

GitHub Actions / bundle-check

`@vuepress/plugin-markdown-chart` import should occur before import of `@vuepress/plugin-markdown-ext`
import { markdownImagePlugin } from '@vuepress/plugin-markdown-image'
import { markdownIncludePlugin } from '@vuepress/plugin-markdown-include'
import { markdownMathPlugin } from '@vuepress/plugin-markdown-math'
Expand Down Expand Up @@ -85,6 +86,14 @@ export default defineUserConfig({
json: true,
rss: true,
}),
markdownChartPlugin({
chartjs: true,
echarts: true,
flowchart: true,
markmap: true,
mermaid: true,
plantuml: true,
}),
markdownExtPlugin({
gfm: true,
component: true,
Expand Down
7 changes: 7 additions & 0 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-ext": "workspace:*",
"@vuepress/plugin-markdown-image": "workspace:*",
"@vuepress/plugin-markdown-include": "workspace:*",
Expand All @@ -35,7 +36,13 @@
"@vuepress/plugin-search": "workspace:*",
"@vuepress/plugin-shiki": "workspace:*",
"@vuepress/theme-default": "workspace:*",
"chart.js": "4.4.6",
"echarts": "5.5.1",
"flowchart.ts": "3.0.1",
"katex": "0.16.18",
"markmap-lib": "0.17.2",
"markmap-toolbar": "0.17.2",
"markmap-view": "0.17.2",
"mathjax-full": "3.2.2",
"sass-embedded": "catalog:",
"sass-loader": "^16.0.4",
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

0 comments on commit 1b9f741

Please sign in to comment.