Support the mathematical expressions (#55).

This commit is contained in:
Cotes Chung 2020-05-26 23:20:40 +08:00
parent 064cefd9ff
commit 582ea30459
4 changed files with 34 additions and 6 deletions

View file

@ -28,6 +28,7 @@ A minimal, sidebar, responsive web design Jekyll theme, focusing on text present
* Table of Contents * Table of Contents
* Automatically recommend related posts * Automatically recommend related posts
* Syntax highlighting * Syntax highlighting
* Mathematical expressions
* Search * Search
* Atom Feeds * Atom Feeds
* Disqus Comments * Disqus Comments
@ -39,7 +40,7 @@ A minimal, sidebar, responsive web design Jekyll theme, focusing on text present
### Prerequisites ### 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: 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:

View file

@ -100,15 +100,19 @@
<link rel="stylesheet" href="{{ site.baseurl }}/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.css" /> <link rel="stylesheet" href="{{ site.baseurl }}/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.css" />
{% endif %} {% endif %}
{% if page.math %}
<!-- MathJax -->
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js" async></script>
{% endif %} {% endif %}
{% endif %}
<link rel="preload" as="script" <link rel="preload" as="script"
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> 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>
<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> <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>
<script src="{{ site.baseurl }}/assets/js/dist/commons.js" async></script> <script src="{{ site.baseurl }}/assets/js/dist/commons.js" async></script>
{% if page.layout == 'home' or page.layout == 'post' %} {% if page.layout == 'home' or page.layout == 'post' %}

View file

@ -4,9 +4,10 @@ author: Cotes Chung
date: 2019-08-08 11:33:00 +0800 date: 2019-08-08 11:33:00 +0800
categories: [Blogging, Demo] categories: [Blogging, Demo]
tags: [typography] 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 ## Titles
@ -49,7 +50,7 @@ Fluttering and dancing in the breeze.
## Link ## Link
[http://127.0.0.1:4000](http://127.0.0.1:4000) <http://127.0.0.1:4000>
## Footnote ## Footnote
@ -66,6 +67,15 @@ Click the hook will locate the footnote[^footnote].
This is an example of `Inline Code`. 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 ## Code Snippet

View file

@ -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 ## Code Block
Markdown symbols <code class="highlighter-rouge">```</code> can easily create a code block as following examples. Markdown symbols <code class="highlighter-rouge">```</code> can easily create a code block as following examples.
@ -136,7 +147,7 @@ items:
quantity: 4 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%}` . 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 %} {% endraw %}
## Learn More ## Learn More
For more knowledge about Jekyll posts, visit the [Jekyll Docs: Posts](https://jekyllrb.com/docs/posts/). For more knowledge about Jekyll posts, visit the [Jekyll Docs: Posts](https://jekyllrb.com/docs/posts/).