hexo-theme-stellar
hexo-theme-stellar copied to clipboard
希望能加入对数学公式的支持
Stellar是一个简洁而高级的主题,期待作者能完善对数学公式的支持,个人认为在学术笔记博客中还是数学公式频繁出现的。
十分感谢!
求个PR
同求加入对LaTeX的支持
这是我的做法使用 katex,效果还是很不错的,不过这个不好提PR
参考 https://www.micdz.cn/article/katex-on-volantis/
1.首先更换公式编译插件:
npm uninstall hexo-renderer-marked --save
npm install hexo-renderer-markdown-it-plus --save
2.在站点根文件中 _config.yml 设置:
# npm i hexo-renderer-markdown-it-plus
markdown_it_plus:
highlight: true
html: true
xhtmlOut: true
breaks: true
langPrefix:
linkify: true
typographer:
quotes: “”‘’
plugins:
- plugin:
name: markdown-it-mark
enable: false
3.根据进阶设定中的外部文件注入,在 _config.yml 中添加如下:
inject:
head:
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" integrity="sha384-AfEj0r4/OFrOo5t7NnNe46zW/tFgW6x/bCJG8FqQCEo3+Aro6EYUG4+cU+KJWu/X" crossorigin="anonymous">
- <script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js" integrity="sha384-g7c+Jr9ZivxKLnZTDUhnkOnsh30B4H0rpLUpJ4jAIKs4fnJI+sEnkvrMWph2EDg4" crossorigin="anonymous"></script>
- <script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js" integrity="sha384-mll67QQFJfxn0IYznZYonOWZ644AWYC+Pt2cHqMaRhXVrursRwvLnLaebdGIlYNa" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script>
script:
:wave: Hello, Your suggestion is great, we will add this feature in subsequent versions, thank you very much!
:wave: 您好, 您的建议很棒,我们将会在后续版本中加入这个功能,非常感谢!
今天我测试了下数学公式,用的是pandoc+mathjax,发现能编译复杂公式,但是换上pandoc后,时间线的显示有问题
不要用hexo-renderer-marked,用hexo-renderer-kramed,感觉完美 https://blog.pengfeima.cn/2022-11-18/uncategorized/使用数学公式/
不要用hexo-renderer-marked,用hexo-renderer-kramed,感觉完美 https://blog.pengfeima.cn/2022-11-18/uncategorized/使用数学公式/
@shaoyaoqian 很棒 👍 建议在「探索号」这里提交一下。
在使用数学公式时发现一个问题,下标不能正确识别,行内公式有_
时,需要替换成\_
,否则会被识别为markdown语言_斜体_
。

@shaoyaoqian 语法如此,都需要用 \
。
@shaoyaoqian 语法如此,都需要用
\
。
应该是hexo特有的吧,因为在vscode、typora这些编辑器里不需要,加了还会显示成别的。
@shaoyaoqian 啊,是我搞混了,太久没写了,想成写程序的时候要加 \
才能转义。我用的 katex
,在 hexo 里不需要加 \
,可以正确识别的。
$$
\mu_t=\beta_0+\beta_1t+\beta_2t+…+\beta_nt
$$
行间公式mathjax也不需要,行内公式需要
@shaoyaoqian 行内也不用:
其中对所有的$t$有$E(X)=0$。使用观测到的时间序列$Y_1,Y_2,…,Y_n$ 来估计$\mu$ 。则可由$OLSE$得出$\mu$的估计为样
@hermitlsr 谢谢你,我现在解决这个问题了,用 katex + hexo-renderer-markdown-it-plus 替换了 mathjax + hexo-renderer-kramed
请问一下,我使用了katex + hexo-renderer-markdown-it-plus来输入我的公式,公式是渲染成功了,但是在公式下面又出现了公式,有没有人遇到这个问题呢?是我写Markdown公式的格式不对吗?
今天解决问题了,不仅需要安装hexo-renderer-markdown-it-plus,还需要安装hexo-math。所以需要的命令有:
npm uninstall hexo-renderer-marked --save
npm install hexo-renderer-markdown-it-plus --save
npm install hexo-math --save
文档已经加上了
:wave: Hello, This issue has been marked as resolved. If there are other issues, please contact us with a new issue.
:wave: 您好, 此 issue 已经被标记为已解决,如果还有其它问题,请提出新的 issue 联系我们。