我能问一下我的问题吗?我正在尝试将注释-数学应用到我的elder.js博客中。它没有正确地呈现。就像这样。
减价
$$
\sin^2x + \cos^2x = 1
h \circ (g \circ f) = (h \circ g) \circ f = h \circ g \circ f
$$呈现为html
<div class="math math-display">
\sin^2x + \cos^2x = 1
h \circ (g \circ f) = (h \circ g) \circ f = h \circ g \circ f
</div>现在是我博客的链接
https://twinstae.github.io/category-for-functional/
我做了下面的事。
remark-katex
elder.config.js
plugins: {
'@elderjs/plugin-markdown': {
routes: ['blog'],
remarkPlugins: [
frontmatter, // 'remark-frontmatter' package
[extractFrontmatter, { name: 'frontmatter', yaml: yaml.parse }], // 'remark-extract-frontmatter' and 'yaml' packages.
remarkSlug, // 'remark-slug' package
remarkMath,
remarkKatex,
remarkHtml, // 'remark-html' package
],
},
...
}elder.config.js link https://github.com/twinstae/twinstae.github.io/blob/master/elder.config.js
备注用文档-插件链接
https://www.npmjs.com/package/@elderjs/plugin-markdown#remark-plugins
我正在尝试几个插件命令,搜索,再读Elder.js文档.
感谢您的阅读。:)
发布于 2021-07-10 13:34:13
我找到了答案!rehype-katex是rehype的插件
新elder.config.js
const remarkMath = require('remark-math');
const remark2rehype = require('remark-rehype');
const rehypeKatex = require('rehype-katex');
const rehypeStringify = require('rehype-stringify');
... (default plugins),
remarkMath,
remark2rehype, <- I missed this
rehypeKatex,
rehypeStringify, <- I missed this toohttps://stackoverflow.com/questions/68327052
复制相似问题