-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from LiHowe/dev
dev merge v0.1.16
- Loading branch information
Showing
14 changed files
with
4,213 additions
and
14,956 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,112 @@ | ||
# vuepress-plugin-mermaid-next | ||
|
||
[中文说明](./README_ZH.md) | ||
 | ||
 | ||
 | ||
|
||
> This plugin is only for [`vuepress-next`](https://vuepress.github.io) | ||
> 该插件仅适用于 [`vuepress-next`](https://vuepress.github.io) | ||
## Installation | ||
[English Version](./README_EN.md) | ||
|
||
 | ||
|
||
## 安装 | ||
|
||
```shell | ||
# use npm | ||
npm install mermaid vuepress-plugin-mermaid-next | ||
|
||
# use yarn | ||
yarn add mermaid vuepress-plugin-mermaid-next | ||
``` | ||
|
||
## Usage | ||
## 使用 | ||
|
||
### 基础使用 | ||
|
||
### `.vuepress/config.ts` or (`config.js`) | ||
在 `.vuepress/config.ts` or (`config.js`) 中配置 | ||
|
||
```typescript | ||
import { MermaidPlugin, Themes } from 'vuepress-plugin-mermaid-next' | ||
|
||
export default { | ||
// ... | ||
plugins: [ | ||
// ...other plugins | ||
['mermaid-next', {}] | ||
] | ||
// ... | ||
MermaidPlugin({ | ||
theme: Themes.forest, | ||
darkTheme: 'forest', // 非必填, 默认值为 `dark` | ||
}), | ||
], | ||
} | ||
// or | ||
import MermaidPlugin from 'vuepress-plugin-mermaid-next' | ||
``` | ||
|
||
本插件支持明亮模式与暗黑模式独立配置, 需要在配置中表明 `darkTheme` 即可. | ||
如未提供 `darkTheme` 配置, 则使用 `dark` 作为默认暗黑主题. | ||
|
||
### Mermaid 配置 | ||
|
||
你可以传入插件配置来自定义mermaid, 传入的配置将会用于 `mermaid.initialize()` | ||
|
||
Mermaid 完整的配置字段可以查看 [Mermaid - Configuration](https://mermaid-js.github.io/mermaid/#/./Setup?id=mermaidapi-configuration-defaults) | ||
|
||
### 主题配置 | ||
|
||
除了mermaid提供的开箱即用的主题外, 插件还补充了以下主题: | ||
|
||
#### 明亮主题 | ||
|
||
+ `Themes.sky`: 浅蓝色调 | ||
 | ||
+ `Themes.ocean`: 深蓝色调 | ||
|
||
#### 暗黑主题 | ||
|
||
+ `Themes.brown` | ||
 | ||
|
||
#### 自定义主题 | ||
|
||
如果你想修改内置主题的部分颜色, 可以在配置中添加 `themeVariables` 来覆盖主题颜色, 具体可覆盖颜色参考[官网](https://mermaid.js.org/config/theming.html) | ||
|
||
```ts | ||
import { MermaidPlugin, Themes } from 'vuepress-plugin-mermaid-next' | ||
export default { | ||
plugins: [ | ||
MermaidPlugin({ | ||
// *optional, plugin option | ||
theme: Themes.sky, | ||
themeVariables: { | ||
fontSize: '14px', | ||
primaryColor: '#FFC3A1', | ||
} | ||
}) | ||
] | ||
} | ||
``` | ||
|
||
### Customization | ||
|
||
You can config mermaid by using plugin settings. | ||
如果你想完全自定义一个主题, 本插件提供了 `registerTheme` 来自定义主题. | ||
|
||
The settings you configured will be use in `mermaid.initialize()` | ||
API: `registerTheme(id, themeVariables)` | ||
|
||
Fully configuration fields can be find in [Mermaid - Configuration](https://mermaid-js.github.io/mermaid/#/./Setup?id=mermaidapi-configuration-defaults) | ||
```ts | ||
import { MermaidPlugin, Themes, registerTheme } from 'vuepress-plugin-mermaid-next' | ||
|
||
const fire = registerTheme('fire', { | ||
background: '#FFC3A1', | ||
fontSize: '14px', | ||
primaryColor: '#FFC3A1', | ||
noteBkgColor: '#F0997D', | ||
noteTextColor: '#333', | ||
lineColor: '#A75D5D', | ||
}) | ||
|
||
## Feature | ||
export default { | ||
plugins: [ | ||
MermaidPlugin({ | ||
theme: fire, | ||
}) | ||
] | ||
} | ||
``` | ||
|
||
[x] Dark mode supported | ||
[x] mermaid config supported | ||
[ ] External Diagrams | ||
[ ] Preset themes | ||
## 功能 | ||
|
||
+ [x] Dark mode supported | ||
+ [x] mermaid config supported | ||
+ [x] Preset themes | ||
+ [ ] External Diagrams(MindMap) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
# vuepress-plugin-mermaid-next | ||
|
||
 | ||
 | ||
 | ||
|
||
> This plugin is only for [`vuepress-next`](https://vuepress.github.io) | ||
 | ||
|
||
## Installation | ||
|
||
```shell | ||
# use npm | ||
npm install mermaid vuepress-plugin-mermaid-next | ||
``` | ||
|
||
## Usage | ||
|
||
### `.vuepress/config.ts` or (`config.js`) | ||
|
||
```typescript | ||
import { MermaidPlugin, Themes } from 'vuepress-plugin-mermaid-next' | ||
|
||
export default { | ||
plugins: [ | ||
MermaidPlugin({ | ||
theme: Themes.sky, | ||
darkTheme: Themes.forest, // not required, default value is `dark` | ||
}), | ||
], | ||
} | ||
``` | ||
|
||
The plugin support out-of-the-box dark mode , you can specified dark mode theme with `darkTheme` field. | ||
If `darkTheme` is null or unavaliable value, it use `dark` as default. | ||
|
||
### Mermaid config | ||
|
||
You can use the plugin config to customize the Mermaid, the config will be used for `mermaid.initialize(config)` | ||
|
||
The full list of Mermaid configuration can be found in [Mermaid - Configuration](https://mermaid-js.github.io/mermaid/#/./Setup?id=mermaidapi-configuration-defaults) | ||
|
||
### Theme config | ||
|
||
Except Mermaid built-in theme, the plugin add some additional themes like: | ||
|
||
#### Light Mode Themes | ||
|
||
+ `Themes.sky`: light blue | ||
 | ||
+ `Themes.ocean`: dark blue | ||
|
||
#### Dark Mode Themes | ||
|
||
+ `Themes.brown` | ||
 | ||
|
||
#### Theme customization | ||
|
||
If you want to modify the part of theme colors, you can use `themeVariables` field to overwrite the theme color configuration. | ||
|
||
The full list of `themeVariables` can be found in [Mermaid Theming](https://mermaid.js.org/config/theming.html) | ||
|
||
```ts | ||
import { MermaidPlugin, Themes } from 'vuepress-plugin-mermaid-next' | ||
export default { | ||
plugins: [ | ||
MermaidPlugin({ | ||
theme: Themes.sky, | ||
themeVariables: { | ||
fontSize: '14px', | ||
primaryColor: '#FFC3A1', | ||
} | ||
}) | ||
] | ||
} | ||
``` | ||
|
||
Or you want to create a new theme, just use `registerTheme(id, themeVariables)`. | ||
|
||
```ts | ||
import { MermaidPlugin, Themes, registerTheme } from 'vuepress-plugin-mermaid-next' | ||
|
||
const fire = registerTheme('fire', { | ||
background: '#FFC3A1', | ||
fontSize: '14px', | ||
primaryColor: '#FFC3A1', | ||
noteBkgColor: '#F0997D', | ||
noteTextColor: '#333', | ||
lineColor: '#A75D5D', | ||
}) | ||
|
||
export default { | ||
plugins: [ | ||
MermaidPlugin({ | ||
theme: fire, | ||
}) | ||
] | ||
} | ||
``` | ||
|
||
## Feature | ||
|
||
+ [x] Dark mode supported | ||
+ [x] mermaid config supported | ||
+ [x] Preset themes | ||
+ [ ] External Diagrams(MindMap) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,30 @@ | ||
// import mermaidPlugin from '../../lib/node/index' | ||
import { MermaidPlugin, Themes, registerTheme } from '../../lib/node' | ||
|
||
const cc = registerTheme('fire', { | ||
background: '#EFF5F5', | ||
fontSize: '14px', | ||
primaryColor: '#EFF5F5', | ||
noteBkgColor: '#497174', | ||
noteTextColor: '#333', | ||
darkMode: true, | ||
lineColor: '#EB6440', | ||
primaryBorderColor: '#D6E4E5', | ||
primaryTextColor: '#497174', | ||
git0: '#D6E4E5', | ||
git1: '#D6E4E5', | ||
git2: '#D6E4E5', | ||
git3: '#D6E4E5', | ||
git4: '#D6E4E5', | ||
git5: '#D6E4E5', | ||
git6: '#D6E4E5', | ||
git7: '#D6E4E5', | ||
}) | ||
|
||
export default { | ||
plugins: [ | ||
// mermaidPlugin({}) | ||
MermaidPlugin({ | ||
theme: cc, | ||
darkTheme: cc, | ||
}) | ||
] | ||
} |
Oops, something went wrong.