Skip to content
This repository has been archived by the owner on Jul 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #85 from BeautyYuYanli/master
Browse files Browse the repository at this point in the history
添加mathjax支持
  • Loading branch information
Fechin authored Mar 9, 2020
2 parents a020ca3 + 1676252 commit 47c8036
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ welcome_cover: # /img/welcome-cover.jpg
# 默认文章封面图
cover: /img/cover.jpg

# 是否使用mathjax
mathjax: false

# Gitalk 评论插件(https://github.com/gitalk/gitalk)
gitalk:
# 是否自动展开评论框
Expand Down
3 changes: 3 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ welcome_cover: # /img/welcome-cover.jpg
# 默认文章封面图
cover: /img/cover.jpg

# 是否使用mathjax
mathjax: false

# 是否关闭默认滚动条
scrollbar: true

Expand Down
20 changes: 20 additions & 0 deletions layout/_partial/mathjax.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<% if (theme.mathjax){ %>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({"HTML-CSS": { preferredFont: "TeX", availableFonts: ["STIX","TeX"], linebreaks: { automatic:true }, EqnChunk: (MathJax.Hub.Browser.isMobile ? 10 : 50) },
tex2jax: { inlineMath: [ ["$", "$"], ["\\(","\\)"] ], processEscapes: true, ignoreClass: "tex2jax_ignore|dno",skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']},
TeX: { noUndefined: { attributes: { mathcolor: "red", mathbackground: "#FFEEEE", mathsize: "90%" } }, Macros: { href: "{}" } },
messageStyle: "none"
});
</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="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<% } %>
1 change: 1 addition & 0 deletions layout/layout.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
<%- body %>
</body>
<%- partial('_partial/scripts', null, {cache: true}) %>
<%- partial('_partial/mathjax', null, {cache: true}) %>
<%- partial("_partial/google-analytics", {cache: true}) %>
</html>

0 comments on commit 47c8036

Please sign in to comment.