Skip to content

Commit ef3fc7e

Browse files
committed
Support the mathematical expressions (cotes2020#55).
1 parent b44608b commit ef3fc7e

File tree

4 files changed

+34
-6
lines changed

4 files changed

+34
-6
lines changed

Diff for: README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ A minimal, sidebar, responsive web design Jekyll theme, focusing on text present
2828
* Table of Contents
2929
* Automatically recommend related posts
3030
* Syntax highlighting
31+
* Mathematical expressions
3132
* Search
3233
* Atom Feeds
3334
* Disqus Comments
@@ -39,7 +40,7 @@ A minimal, sidebar, responsive web design Jekyll theme, focusing on text present
3940

4041
### Prerequisites
4142

42-
Follow the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installtion of basic environment (`Ruby `, `RubyGems` and `Bundler`).
43+
Follow the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installtion of basic environment (`Ruby`, `RubyGems` and `Bundler`).
4344

4445
To improve the writing experience, we need to use some script tools. If your machine is running Debian or macOS, make sure that [GNU coreutils](https://www.gnu.org/software/coreutils/) is installed. Otherwise, install by:
4546

Diff for: _includes/head.html

+6-2
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,19 @@
100100
<link rel="stylesheet" href="{{ site.baseurl }}/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.css" />
101101
{% endif %}
102102

103-
{% endif %}
103+
{% if page.math %}
104+
<!-- MathJax -->
105+
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
106+
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js" async></script>
107+
{% endif %}
104108

109+
{% endif %}
105110

106111
<link rel="preload" as="script"
107112
href="https://cdn.jsdelivr.net/combine/npm/jquery@3.4.1,npm/popper.js@1.15.0,npm/bootstrap@4.0.0/dist/js/bootstrap.min.js" crossorigin>
108113

109114
<script src="https://cdn.jsdelivr.net/combine/npm/jquery@3.4.1,npm/popper.js@1.15.0,npm/bootstrap@4.0.0/dist/js/bootstrap.min.js"></script>
110115

111-
112116
<script src="{{ site.baseurl }}/assets/js/dist/commons.js" async></script>
113117

114118
{% if page.layout == 'home' or page.layout == 'post' %}

Diff for: _posts/2019-08-08-text-and-typography.md

+12-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ author: Cotes Chung
44
date: 2019-08-08 11:33:00 +0800
55
categories: [Blogging, Demo]
66
tags: [typography]
7+
math: true
78
---
89

9-
This Jekyll template totally compatible with Markdown syntax. Now, let's take a look for the text and typography in this theme.
10+
This Jekyll template totally compatible with Markdown syntax. Now, let's take a look for the text and typography in here.
1011

1112
## Titles
1213

@@ -49,7 +50,7 @@ Fluttering and dancing in the breeze.
4950

5051
## Link
5152

52-
[http://127.0.0.1:4000](http://127.0.0.1:4000)
53+
<http://127.0.0.1:4000>
5354

5455

5556
## Footnote
@@ -66,6 +67,15 @@ Click the hook will locate the footnote[^footnote].
6667

6768
This is an example of `Inline Code`.
6869

70+
## Mathematics
71+
72+
The mathematics powered by [**MathJax**](https://www.mathjax.org/):
73+
74+
$$ \sum_{n=1}^\infty 1/n^2 = \frac{\pi^2}{6} $$
75+
76+
When \\(a \ne 0\\), there are two solutions to \\(ax^2 + bx + c = 0\\) and they are
77+
78+
$$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$
6979

7080
## Code Snippet
7181

Diff for: _posts/2019-08-08-write-a-new-post.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,17 @@ comments: false
113113
```
114114

115115

116+
## Mathematics
117+
118+
For website performance reasons, the mathematical feature won't be loaded by default. But it can be enabled by:
119+
120+
```yaml
121+
---
122+
math: true
123+
---
124+
```
125+
126+
116127
## Code Block
117128

118129
Markdown symbols <code class="highlighter-rouge">```</code> can easily create a code block as following examples.
@@ -136,7 +147,7 @@ items:
136147
quantity: 4
137148
```
138149

139-
#### Liquid codes
150+
#### Liquid Codes
140151

141152
If you want to display the **Liquid** snippet, surround the liquid code with `{% raw %}{%{% endraw %} raw {%raw%}%}{%endraw%}` and `{% raw %}{%{% endraw %} endraw {%raw%}%}{%endraw%}` .
142153

@@ -148,6 +159,8 @@ If you want to display the **Liquid** snippet, surround the liquid code with `{%
148159
```
149160
{% endraw %}
150161

162+
151163
## Learn More
164+
152165
For more knowledge about Jekyll posts, visit the [Jekyll Docs: Posts](https://jekyllrb.com/docs/posts/).
153166

0 commit comments

Comments
 (0)