使用Mathjax新增对数学公式的支持 (#88)
* 新增数学公式配置选项 * add * add mathjax.ejs * Update _config.yml * Update mathjax.ejs Co-authored-by: xaoxuu <16400144+xaoxuu@users.noreply.github.com>
This commit is contained in:
parent
3d4800458b
commit
e2b3b8901e
|
@ -84,7 +84,6 @@ article:
|
|||
auto_cover: true # 如果没有封面就根据 tags 作为关键词搜索封面,开了此项将不会自动从文章中提取首张图片作为封面了。
|
||||
|
||||
|
||||
|
||||
######## Comments ########
|
||||
comments:
|
||||
service: # beaudar, utterances, valine, twikoo, waline
|
||||
|
@ -304,6 +303,13 @@ plugins:
|
|||
css: https://unpkg.com/heti/umd/heti.min.css
|
||||
js: https://unpkg.com/heti/umd/heti-addon.min.js
|
||||
|
||||
# MathJax
|
||||
# 需在Markdown文件开头加入mathjax: true
|
||||
# 推荐使用Pandoc: npm uninstall hexo-renderer-marked --save & npm install hexo-renderer-pandoc --save
|
||||
mathjax:
|
||||
enable: false
|
||||
cdn: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.6/MathJax.js?config=TeX-AMS-MML_HTMLorMML
|
||||
|
||||
|
||||
style:
|
||||
darkmode: auto # auto / always / false
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
<% if (theme.plugins.mathjax.enable){ %>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
tex2jax: {
|
||||
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
|
||||
processEscapes: true
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
tex2jax: {
|
||||
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Queue(function() {
|
||||
var all = MathJax.Hub.getAllJax(), i;
|
||||
for(i=0; i < all.length; i += 1) {
|
||||
all[i].SourceElement().parentNode.className += ' has-jax';
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="<%- theme.plugins.mathjax.cdn %>"></script>
|
||||
<% } %>
|
|
@ -19,6 +19,9 @@ if (theme.plugins.heti && theme.plugins.heti.enable) {
|
|||
heti = ' heti';
|
||||
}
|
||||
%>
|
||||
<% if (page.mathjax == true){ %>
|
||||
<%- partial('mathjax') %>
|
||||
<% } %>
|
||||
<%- partial('_partial/main/navbar/breadcrumb') %>
|
||||
<article class='content<%- heti %> md <%- post.layout %><%- post.indent ? ' indent' : '' %><%- scrollreveal() %>'>
|
||||
<%- layoutTitle() %>
|
||||
|
|
Loading…
Reference in New Issue