使用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 作为关键词搜索封面,开了此项将不会自动从文章中提取首张图片作为封面了。
|
auto_cover: true # 如果没有封面就根据 tags 作为关键词搜索封面,开了此项将不会自动从文章中提取首张图片作为封面了。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
######## Comments ########
|
######## Comments ########
|
||||||
comments:
|
comments:
|
||||||
service: # beaudar, utterances, valine, twikoo, waline
|
service: # beaudar, utterances, valine, twikoo, waline
|
||||||
|
@ -303,6 +302,13 @@ plugins:
|
||||||
enable: false
|
enable: false
|
||||||
css: https://unpkg.com/heti/umd/heti.min.css
|
css: https://unpkg.com/heti/umd/heti.min.css
|
||||||
js: https://unpkg.com/heti/umd/heti-addon.min.js
|
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:
|
style:
|
||||||
|
|
|
@ -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';
|
heti = ' heti';
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
|
<% if (page.mathjax == true){ %>
|
||||||
|
<%- partial('mathjax') %>
|
||||||
|
<% } %>
|
||||||
<%- partial('_partial/main/navbar/breadcrumb') %>
|
<%- partial('_partial/main/navbar/breadcrumb') %>
|
||||||
<article class='content<%- heti %> md <%- post.layout %><%- post.indent ? ' indent' : '' %><%- scrollreveal() %>'>
|
<article class='content<%- heti %> md <%- post.layout %><%- post.indent ? ' indent' : '' %><%- scrollreveal() %>'>
|
||||||
<%- layoutTitle() %>
|
<%- layoutTitle() %>
|
||||||
|
|
Loading…
Reference in New Issue