hashmd
hashmd copied to clipboard
数学求和公式 可视化问题
在使用https://bytemd.js.org/playground/ 时,发现如下问题(截图):
在上图中,数学表达式显示错误。正确的Latex公式解析应该显示为(github解析markdown生成的):
$$R_N(h) = \frac{1}{N} \sum_{i=1}^N l(x_i, y_i))$$
Math plugin 使用的是 https://katex.org/ ,可能与 MathJax 的渲染逻辑有一些区别
先引入 css,然后插件配置一下
import mathLocal from '@bytemd/plugin-math/locales/zh_Hans.json'; // 中文包
import 'katex/dist/katex.css'; // 样式
const plugins = [
math({
locale: mathLocal,
katexOptions: { output: 'html' }, // https://github.com/KaTeX/KaTeX/issues/2796
}),
...otherPlugins
];
This issue is stale because it has been open for 60 days with no activity.
This issue was closed because it has been inactive for 7 days since being marked as stale.
先引入 css,然后插件配置一下
import mathLocal from '@bytemd/plugin-math/locales/zh_Hans.json'; // 中文包 import 'katex/dist/katex.css'; // 样式 const plugins = [ math({ locale: mathLocal, katexOptions: { output: 'html' }, // https://github.com/KaTeX/KaTeX/issues/2796 }), ...otherPlugins ];
@lesonky 大佬,katexOptions 是怎么导入的呢?能分享下代码吗?