From 582ea30459d49ec6fc606993fc51f9a277c31b5e Mon Sep 17 00:00:00 2001
From: Cotes Chung <11371340+cotes2020@users.noreply.github.com>
Date: Tue, 26 May 2020 23:20:40 +0800
Subject: [PATCH] Support the mathematical expressions (#55).
---
README.md | 3 ++-
_includes/head.html | 8 ++++++--
_posts/2019-08-08-text-and-typography.md | 14 ++++++++++++--
_posts/2019-08-08-write-a-new-post.md | 15 ++++++++++++++-
4 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
index ca2c2f7..8316086 100644
--- a/README.md
+++ b/README.md
@@ -28,6 +28,7 @@ A minimal, sidebar, responsive web design Jekyll theme, focusing on text present
* Table of Contents
* Automatically recommend related posts
* Syntax highlighting
+* Mathematical expressions
* Search
* Atom Feeds
* Disqus Comments
@@ -39,7 +40,7 @@ A minimal, sidebar, responsive web design Jekyll theme, focusing on text present
### Prerequisites
-Follow the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installtion of basic environment (`Ruby `, `RubyGems` and `Bundler`).
+Follow the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installtion of basic environment (`Ruby`, `RubyGems` and `Bundler`).
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:
diff --git a/_includes/head.html b/_includes/head.html
index d272a1f..8c1f40e 100644
--- a/_includes/head.html
+++ b/_includes/head.html
@@ -100,15 +100,19 @@
{% endif %}
- {% endif %}
+ {% if page.math %}
+
+
+
+ {% endif %}
+ {% endif %}
-
{% if page.layout == 'home' or page.layout == 'post' %}
diff --git a/_posts/2019-08-08-text-and-typography.md b/_posts/2019-08-08-text-and-typography.md
index a149e8f..c5dd293 100644
--- a/_posts/2019-08-08-text-and-typography.md
+++ b/_posts/2019-08-08-text-and-typography.md
@@ -4,9 +4,10 @@ author: Cotes Chung
date: 2019-08-08 11:33:00 +0800
categories: [Blogging, Demo]
tags: [typography]
+math: true
---
-This Jekyll template totally compatible with Markdown syntax. Now, let's take a look for the text and typography in this theme.
+This Jekyll template totally compatible with Markdown syntax. Now, let's take a look for the text and typography in here.
## Titles
@@ -49,7 +50,7 @@ Fluttering and dancing in the breeze.
## Link
-[http://127.0.0.1:4000](http://127.0.0.1:4000)
+
## Footnote
@@ -66,6 +67,15 @@ Click the hook will locate the footnote[^footnote].
This is an example of `Inline Code`.
+## Mathematics
+
+The mathematics powered by [**MathJax**](https://www.mathjax.org/):
+
+$$ \sum_{n=1}^\infty 1/n^2 = \frac{\pi^2}{6} $$
+
+When \\(a \ne 0\\), there are two solutions to \\(ax^2 + bx + c = 0\\) and they are
+
+$$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$
## Code Snippet
diff --git a/_posts/2019-08-08-write-a-new-post.md b/_posts/2019-08-08-write-a-new-post.md
index a20caed..c449f28 100644
--- a/_posts/2019-08-08-write-a-new-post.md
+++ b/_posts/2019-08-08-write-a-new-post.md
@@ -113,6 +113,17 @@ comments: false
```
+## Mathematics
+
+For website performance reasons, the mathematical feature won't be loaded by default. But it can be enabled by:
+
+```yaml
+---
+math: true
+---
+```
+
+
## Code Block
Markdown symbols ``` can easily create a code block as following examples.
@@ -136,7 +147,7 @@ items:
quantity: 4
```
-#### Liquid codes
+#### Liquid Codes
If you want to display the **Liquid** snippet, surround the liquid code with `{% raw %}{%{% endraw %} raw {%raw%}%}{%endraw%}` and `{% raw %}{%{% endraw %} endraw {%raw%}%}{%endraw%}` .
@@ -148,6 +159,8 @@ If you want to display the **Liquid** snippet, surround the liquid code with `{%
```
{% endraw %}
+
## Learn More
+
For more knowledge about Jekyll posts, visit the [Jekyll Docs: Posts](https://jekyllrb.com/docs/posts/).