Skip to content

Commit

Permalink
add mathjax
Browse files Browse the repository at this point in the history
  • Loading branch information
monniya committed Mar 5, 2017
1 parent ba5dea9 commit 7201201
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 12 deletions.
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ theme: new-vno


## Configuration 主题设置
设置文件:<code>_config.yml</code>
设置主题的配置文件:<code>_config.yml</code>

```yml
#menu子菜单,可自定义
Expand Down Expand Up @@ -106,4 +106,19 @@ date: 2016-03-03 10:46:46
tags: 分类
---
```
![百度统计](source/images/show/article.jpeg)
![百度统计](source/images/show/article.jpeg)

### 数学公式支持

# mathjax
mathjax: true
由于资源考虑,默认是不加载mathjax的,若需使用请在文章头部添加:
```yml
如下示例:
---
title: 侧耳倾听我的心
date: 2017-02-18 22:55:08
tags: 观观影
mathjax: true
---
```
4 changes: 3 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ social:
twitter: https://twitter.com/onlymonniya
google_plus:

page_comment: false
page_comment: true
logo: /images/avatar.jpg
background:
cover: /images/background-cover.jpg
Expand All @@ -28,3 +28,5 @@ google_analytics: UA-78918255-1
baidu_tongji: 9cdad07c755fa23f6aced510c6760e87
favicon: /images/avatar-small.png

#mathjax
mathjax: true
6 changes: 5 additions & 1 deletion layout/_partial/footer.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@
&copy; <%- date(Date.now(), 'YYYY') %> - 本站使用 <a href="https://github.com/monniya/hexo-theme-new-vno ">new-vno</a> 主题,
由<a href="https://monniya.com ">@Monniya</a> 修改自 <a href="https://github.com/lenbo-ma/hexo-theme-vno" target="_blank">Vno</a>, 原创出自<a href="http://github.com/onevcat/vno" target="_blank">onevcat</a>
</span>
</footer>
<% if (page.mathjax){ %>
<%- partial('_partial/mathjax') %>
<% } %>
</footer>

3 changes: 1 addition & 2 deletions layout/_partial/head.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,5 @@

<% if (theme.social["google_plus"]) { %>
<link rel="author" href="<%= theme.social['google_plus'] %>"/>
<% } %>

<% } %>
</head>
18 changes: 18 additions & 0 deletions layout/_partial/mathjax.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<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>
2 changes: 1 addition & 1 deletion layout/_partial/side-panel.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@
</div>

<div class="panel-cover--overlay <%= theme.background.color %>"></div>
</div>
</div>
</header>
2 changes: 1 addition & 1 deletion layout/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@
<% } %>
</nav>
<% } %>

<%- partial('_partial/mathjax') %>
</div>

5 changes: 1 addition & 4 deletions layout/layout.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@
</div>
</div>



<%- partial('_partial/google_analytics') %>
<%- partial('_partial/baidu_tongji') %>
<script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js">
<script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>

</script>

</body>
</html>

0 comments on commit 7201201

Please sign in to comment.