![](/img/trans.png)
[英]How can I make Svelte for VSCode extension take my prettier configuration and apply it to my svelte files when formatting?
[英]How Can I apply remark-math, katex to my Elder.js Blog?
我可以問你我的問題嗎? 我正在嘗試將 remark-math 應用於我的 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/
我做了以下。
配置文件
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 鏈接https://github.com/twinstae/twinstae.github.io/blob/master/elder.config.js
備注插件鏈接的文檔
https://www.npmjs.com/package/@elderjs/plugin-markdown#remark-plugins
我正在嘗試幾個插件訂單,搜索,再次閱讀 Elder.js 文檔......
感謝您的閱讀。 :)
我找到了答案! 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 too
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.