dewfall123 / ruabick

Dumi like tool based on vitepress.
https://dewfall123.github.io/ruabick/
144 stars 32 forks source link

Markdown 标签渲染规则错误 #2

Closed haiweilian closed 2 years ago

haiweilian commented 2 years ago

由于 mdit-vue/plugin-component 插件,现在 demo 标签解析为 html_inline ( vitepress>= 1.0.0-alpha.9)。代码中的 md.renderer.rules.html_block 规则未命中。

更换规则类型

const defaultRender = md.renderer.rules.html_inline;
md.renderer.rules.html_inline = (tokens, idx, options, env, self) => {}

或者两种兼容。

const genRule = (rule: string) => {
    const defaultRender = md.renderer.rules[rule];
    md.renderer.rules[rule] =  (tokens, idx, options, env, self) => {}
}

genRule('html_block');
genRule('html_inline');
dewfall123 commented 2 years ago

:+1: