[Bug Report] MathJax 无法渲染
Prerequisites
- [X] There isn't an existing issue that reports the same bug to avoid duplicates.
- [X] The provided information offers a minimal reproducible example of the bug.
- [X] For Q&A, please open a GitHub Discussion instead.
Describe the Bug
公式无法正常渲染,相关的配置文档也不详细;
mathBlock: {
engine: 'MathJax', // katex or MathJax
src: 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js',
plugins: true, // Default load plug-in
},
inlineMath: {
engine: 'MathJax', // katex or MathJax
},
另外经实践发现,根据当前的文档描述,mermaid的异步引入会出错,同样需要使用default解构才可以正常工作
const registerPlugin = async () => {
const [{ default: CherryMermaidPlugin }, { default: mermaid }] = await Promise.all([
import('cherry-markdown/src/addons/cherry-code-block-mermaid-plugin'),
// import('cherry-markdown/src/addons/cherry-code-block-plantuml-plugin'),
import('mermaid'),
// import('mathjax/es5/tex-mml-svg'),
]);
console.info(CherryMermaidPlugin, mermaid)
Cherry.usePlugin(CherryMermaidPlugin, {
mermaid, // pass in mermaid object
});
};
Reproduction Steps
No response
System Information
No response
Contributing
None
配置问题吧,我这里是正常的:
mathBlock: {
engine: "MathJax", // katex或MathJax
src: import.meta.env.BASE_URL + "/mathjax/es5/tex-svg.js",
plugins: true, // 默认加载插件
},
inlineMath: {
engine: "MathJax", // katex或MathJax
src: import.meta.env.BASE_URL + "/mathjax/es5/tex-svg.js",
},
import CherryMermaidPlugin from "cherry-markdown/dist/addons/cherry-code-block-mermaid-plugin";
import mermaid from "mermaid";
Cherry.usePlugin(CherryMermaidPlugin, {
mermaid,
});
配置问题吧,我这里是正常的:
mathBlock: { engine: "MathJax", // katex或MathJax src: import.meta.env.BASE_URL + "/mathjax/es5/tex-svg.js", plugins: true, // 默认加载插件 }, inlineMath: { engine: "MathJax", // katex或MathJax src: import.meta.env.BASE_URL + "/mathjax/es5/tex-svg.js", },import CherryMermaidPlugin from "cherry-markdown/dist/addons/cherry-code-block-mermaid-plugin"; import mermaid from "mermaid"; Cherry.usePlugin(CherryMermaidPlugin, { mermaid, });
你是指其他配置项可能影响到公式吗?直觉上来说都是独立的不应该呀
另外我是用的最新版本的markdown+mermaid9+echarts4(READMD文档上的版本号)
再者,您可以试下异步import看看mermaid的导入方式是不是如我所说
你是指其他配置项可能影响到公式吗?直觉上来说都是独立的不应该呀 另外我是用的最新版本的markdown+mermaid9+echarts4(READMD文档上的版本号) 再者,您可以试下异步import看看mermaid的导入方式是不是如我所说
我也是最新版本,不过我没有用异步加载耶~ 很早之前在其他项目用过异步加载,感觉问题比较多处理、调试起来都很麻烦,意义也不大,所以后来就不用了,直接copy demo代码就能调通的事就不折腾了。
Prerequisites
- [x] There isn't an existing issue that reports the same bug to avoid duplicates.
- [x] The provided information offers a minimal reproducible example of the bug.
- [x] For Q&A, please open a GitHub Discussion instead.
Describe the Bug
公式无法正常渲染,相关的配置文档也不详细;
mathBlock: { engine: 'MathJax', // katex or MathJax src: 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js', plugins: true, // Default load plug-in }, inlineMath: { engine: 'MathJax', // katex or MathJax },
另外经实践发现,根据当前的文档描述,mermaid的异步引入会出错,同样需要使用default解构才可以正常工作
const registerPlugin = async () => { const [{ default: CherryMermaidPlugin }, { default: mermaid }] = await Promise.all([ import('cherry-markdown/src/addons/cherry-code-block-mermaid-plugin'), // import('cherry-markdown/src/addons/cherry-code-block-plantuml-plugin'), import('mermaid'), // import('mathjax/es5/tex-mml-svg'), ]); console.info(CherryMermaidPlugin, mermaid) Cherry.usePlugin(CherryMermaidPlugin, { mermaid, // pass in mermaid object }); };Reproduction Steps
No response
System Information
No response
Contributing
None
又看了一遍你的配置,确实是少了一行,你只配置了Block块级公式的src,Inline行级公式的src没有配置,而你截图里插入的都是行级公式的代码,当然无法解析。
Prerequisites
有块级公式吧,双$中间就是
实测:
- 在vite+vue初始化工程下,最简配置下将cherry-markdown版本回退到0.8.45公式渲染就正常了
- 在我的复杂工程下,将cherry-markdown版本回退到0.8.40公式也正常渲染
- 最新0.8.46在以上工程下都无法正常工作
您好,我版本改到0.8.45还是没有渲染成功该怎么办呀
您好,我版本改到0.8.45还是没有渲染成功该怎么办呀 见: https://github.com/Tencent/cherry-markdown/issues/961
您好,我版本改到0.8.45还是没有渲染成功该怎么办呀 见: #961
这个不稳定,偶尔成功,经常失败
您好,我版本改到0.8.45还是没有渲染成功该怎么办呀 见: #961
这个不稳定,偶尔成功,经常失败
mathjax 资源下载到本地引用
在哪下载到本地然后使用呀
在哪下载到本地然后使用呀 https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js 打开链接,右键保存到本地。
如有其他问题请新开Discussions 寻求帮助,如遇到错误,请新开Issues,尽量不要在他人issue下进行多次寻求帮助讨论以免对其他用户造成噪音干扰。
抱歉,我用本地的,还是偶然成功,经常失败
抱歉,我用本地的,还是偶然成功,经常失败
请新开问题,提供一个复现视频和可复现代码片段。
