Skip to content

Commit

Permalink
feat: add katex support (#23)
Browse files Browse the repository at this point in the history
添加 KaTeX 的支持。

/kind feature

Fix #22 
Fix #8 

```release-note
None
```
  • Loading branch information
ruibaby authored Jul 13, 2023
1 parent 2d631db commit 45dc267
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 2 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
2. 安装,插件安装和更新方式可参考:<https://docs.halo.run/user-guide/plugins>
3. 安装完成之后,进入文章新建页面即可在右上角编辑器切换按钮中看到 ByteMD 编辑器。

## 常见问题

1. 如何支持编写数学公式

目前此插件已经支持编写数学公式,但需要同时安装 [plugin-katex](https://github.com/halo-sigs/plugin-katex) 插件才能够正常在编辑器预览区域渲染。另外,还需要在 KaTeX 插件设置中设置 dom 节点才能够在文章中正常渲染,可以参考:<https://github.com/halo-sigs/plugin-katex#%E6%96%87%E7%AB%A0%E9%A1%B5%E6%B8%B2%E6%9F%93%E5%85%AC%E5%BC%8F>

## 开发环境

```bash
Expand Down
3 changes: 2 additions & 1 deletion console/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
},
"dependencies": {
"@bytemd/plugin-gfm": "^1.20.2",
"@bytemd/plugin-math": "^1.21.0",
"@bytemd/vue-next": "^1.20.2",
"@halo-dev/components": "^1.1.0",
"@halo-dev/console-shared": "^2.2.0",
Expand All @@ -35,8 +36,8 @@
"eslint-plugin-vue": "^9.9.0",
"jsdom": "^19.0.0",
"npm-run-all": "^4.1.5",
"sass": "^1.58.0",
"prettier": "^2.8.4",
"sass": "^1.58.0",
"typescript": "~4.7.4",
"vite": "^4.1.1",
"vitest": "^0.24.5",
Expand Down
63 changes: 63 additions & 0 deletions console/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion console/src/components/bytemd.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import gfm from "@bytemd/plugin-gfm";
import { pluginSlug, vim } from "../plugins";
import { getProcessor } from "bytemd";
import { watch, onMounted, ref } from "vue";
import math from "@bytemd/plugin-math";
const plugins = ref([gfm(), pluginSlug()]);
const plugins = ref([gfm(), pluginSlug(), math()]);
const VimKeymap = "vim";
Expand Down

0 comments on commit 45dc267

Please sign in to comment.