Skip to content

Commit c69844e

Browse files
author
chenyvehtung
committed
add support for mathjax
1 parent b370d96 commit c69844e

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-2
lines changed

README-zh-cn.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ google_analytics_id: UA-72449510-4 # google 分析追踪id
236236

237237
### 4. 写文章
238238

239-
`_posts`目录下存放文章信息,文章头部注明 layout(布局)、title、date、categories、tags、author(可选),如下:
239+
`_posts`目录下存放文章信息,文章头部注明 layout(布局)、title、date、categories、tags、author(可选)、mathjax(可选,点击[这里](https://www.mathjax.org/)查看更多关于`Mathjax`),如下:
240240

241241
```
242242
---
@@ -246,6 +246,7 @@ date: 2016-03-12 11:40:18 +0800
246246
categories: jekyll
247247
tags: jekyll 端口 markdown Foxit RubyGems HTML CSS
248248
author: Haoyang Gao
249+
mathjax: true
249250
---
250251
```
251252

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ When you done, you can see UV, PV, location etc. info at your own Google Analyti
237237

238238
### 4. Write post
239239

240-
You can write posts at folder `_posts`. At the beginning of the post, you should declare layout、title、date、categories、tags、author(optional) info.
240+
You can write posts at folder `_posts`. At the beginning of the post, you should declare layout、title、date、categories、tags、author(optional) info、mathjax(optional,click [here](https://www.mathjax.org/) for more detail about `Mathjax`).
241241

242242
```
243243
---
@@ -247,6 +247,7 @@ date: 2016-03-12 11:40:18 +0800
247247
categories: jekyll
248248
tags: jekyll 端口 markdown Foxit RubyGems HTML CSS
249249
author: Haoyang Gao
250+
mathjax: true
250251
---
251252
```
252253

_includes/head.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,18 @@
3939

4040
</script>
4141
{% endif %}
42+
43+
{% if page.mathjax %}
44+
<script type="text/x-mathjax-config">
45+
MathJax.Hub.Config({
46+
tex2jax: { inlineMath: [["$","$"],["\\(","\\)"]] },
47+
"HTML-CSS": {
48+
linebreaks: { automatic: true, width: "container" }
49+
}
50+
});
51+
</script>
52+
<script type="text/javascript"
53+
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
54+
</script>
55+
{% endif %}
4256
</head>

_posts/2015-02-10-welcome-to-jekyll.markdown

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ date: 2015-02-10 15:14:54
55
categories: jekyll
66
tags: jekyll
77
excerpt: 当年创建 jekyll 时默认的一篇文章,没什么意义,我也一直没删除,留个纪念吧。
8+
mathjax: true
89
---
910

1011
You’ll find this post in your `_posts` directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run `jekyll serve`, which launches a web server and auto-regenerates your site when a file is updated.
@@ -26,3 +27,12 @@ Check out the [Jekyll docs][jekyll] for more info on how to get the most out of
2627
[jekyll]: http://jekyllrb.com
2728
[jekyll-gh]: https://github.com/jekyll/jekyll
2829
[jekyll-help]: https://github.com/jekyll/jekyll-help
30+
31+
Block Mathjax
32+
33+
$$
34+
f(x) = ax + b
35+
$$
36+
37+
Inline Mathjax $a \neq b$
38+

0 commit comments

Comments
 (0)