From e3e0bf0e78b8000d92b125df768c567906c108a7 Mon Sep 17 00:00:00 2001 From: Wafer Li Date: Mon, 22 Jan 2018 10:55:58 +0900 Subject: [PATCH 1/3] Flip per_page behavior and update docs --- _config.yml | 6 +++--- docs/MATH.md | 12 ++++++------ docs/zh-Hans/MATH.md | 12 ++++++------ layout/_third-party/math/index.swig | 3 +-- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/_config.yml b/_config.yml index 40daac61b2..2d285c54f1 100644 --- a/_config.yml +++ b/_config.yml @@ -375,10 +375,10 @@ font: math: enable: false - # Default(false) will load mathjax/katex srcipt EVERY PAGE - # If you set to true, you need to add 'mathjax: true' in Front Matter of post + # Default(true) will load mathjax/katex srcipt EVERY PAGE + # If you set to false, you need to add 'mathjax: true' in Front Matter of post # in order to render math equations in post - per_page: false + per_page: true engine: mathjax #engine: katex diff --git a/docs/MATH.md b/docs/MATH.md index 5a0eb74da3..a42acee7f3 100644 --- a/docs/MATH.md +++ b/docs/MATH.md @@ -138,10 +138,10 @@ If your content of config just directly after the config name, then a space is n math: enable: false - # Default(false) will load mathjax/katex srcipt EVERY PAGE - # If you set to true, you need to add 'mathjax: true' in Front Matter of post + # Default(true) will load mathjax/katex srcipt EVERY PAGE + # If you set to false, you need to add 'mathjax: true' in Front Matter of post # in order to render math equations in post - per_page: false + per_page: true engine: mathjax #engine: katex @@ -173,13 +173,13 @@ math: ### per_page -`true` or `false`, default is `false`. +`true` or `false`, default is `true`. This option is to control whether to render Math Equations every page. -The behavior of default (`false`) is to render Math Equations on **every page**. +The behavior of default (`true`) is to render Math Equations on **every page**. -When you set it to `true`, it will only render the post with `mathjax: true` Front Matter. +When you set it to `false`, it will only render the post with `mathjax: true` Front Matter. If your post's Front Matter doesn't have `mathjax: true` or you set `mathjax: false`, then NexT will not render Math Equations for those posts. diff --git a/docs/zh-Hans/MATH.md b/docs/zh-Hans/MATH.md index 536821da5f..0550c64c23 100644 --- a/docs/zh-Hans/MATH.md +++ b/docs/zh-Hans/MATH.md @@ -140,10 +140,10 @@ markdown: math: enable: false - # Default(false) will load mathjax/katex srcipt EVERY PAGE - # If you set to true, you need to add 'mathjax: true' in Front Matter of post + # Default(true) will load mathjax/katex srcipt EVERY PAGE + # If you set to false, you need to add 'mathjax: true' in Front Matter of post # in order to render math equations in post - per_page: false + per_page: true engine: mathjax #engine: katex @@ -175,13 +175,13 @@ math: ### per_page -`true` 或者 `false`,默认为 `false`。 +`true` 或者 `false`,默认为 `true`。 这个选项是控制是否在每篇文章都渲染数学公式; -默认(`false`)的行为是**对每篇文章都进行数学公式渲染**; +默认(`true`)的行为是**对每篇文章都进行数学公式渲染**; -`true` 的行为是**只对 Front Matter 中含有 `mathjax: true` 的文章进行数学公式渲染**。 +`false` 的行为是**只对 Front Matter 中含有 `mathjax: true` 的文章进行数学公式渲染**。 如果 Front Matter 中不含有 `mathjax: true`,或者 `mathjax: false`,那么 NexT 将不会对这些文章进行数学公式渲染。 diff --git a/layout/_third-party/math/index.swig b/layout/_third-party/math/index.swig index 65d1a2e2ad..285b923b05 100644 --- a/layout/_third-party/math/index.swig +++ b/layout/_third-party/math/index.swig @@ -1,5 +1,5 @@ {% if theme.math.enable %} - {% if not theme.math.per_page or (page.total or page.mathjax) %} + {% if theme.math.per_page or (page.total or page.mathjax) %} {% if theme.math.engine == 'mathjax' %} {% include 'mathjax.swig' %} {% elif theme.math.engine == 'katex' %} @@ -7,4 +7,3 @@ {% endif %} {% endif %} {% endif %} - From 930182be0380c733d462705dab6862d59fd17d4a Mon Sep 17 00:00:00 2001 From: Wafer Li Date: Mon, 22 Jan 2018 11:33:13 +0900 Subject: [PATCH 2/3] Revert "Flip per_page behavior and update docs" This reverts commit e3e0bf0e78b8000d92b125df768c567906c108a7. --- _config.yml | 6 +++--- docs/MATH.md | 12 ++++++------ docs/zh-Hans/MATH.md | 12 ++++++------ layout/_third-party/math/index.swig | 3 ++- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/_config.yml b/_config.yml index 2d285c54f1..40daac61b2 100644 --- a/_config.yml +++ b/_config.yml @@ -375,10 +375,10 @@ font: math: enable: false - # Default(true) will load mathjax/katex srcipt EVERY PAGE - # If you set to false, you need to add 'mathjax: true' in Front Matter of post + # Default(false) will load mathjax/katex srcipt EVERY PAGE + # If you set to true, you need to add 'mathjax: true' in Front Matter of post # in order to render math equations in post - per_page: true + per_page: false engine: mathjax #engine: katex diff --git a/docs/MATH.md b/docs/MATH.md index a42acee7f3..5a0eb74da3 100644 --- a/docs/MATH.md +++ b/docs/MATH.md @@ -138,10 +138,10 @@ If your content of config just directly after the config name, then a space is n math: enable: false - # Default(true) will load mathjax/katex srcipt EVERY PAGE - # If you set to false, you need to add 'mathjax: true' in Front Matter of post + # Default(false) will load mathjax/katex srcipt EVERY PAGE + # If you set to true, you need to add 'mathjax: true' in Front Matter of post # in order to render math equations in post - per_page: true + per_page: false engine: mathjax #engine: katex @@ -173,13 +173,13 @@ math: ### per_page -`true` or `false`, default is `true`. +`true` or `false`, default is `false`. This option is to control whether to render Math Equations every page. -The behavior of default (`true`) is to render Math Equations on **every page**. +The behavior of default (`false`) is to render Math Equations on **every page**. -When you set it to `false`, it will only render the post with `mathjax: true` Front Matter. +When you set it to `true`, it will only render the post with `mathjax: true` Front Matter. If your post's Front Matter doesn't have `mathjax: true` or you set `mathjax: false`, then NexT will not render Math Equations for those posts. diff --git a/docs/zh-Hans/MATH.md b/docs/zh-Hans/MATH.md index 0550c64c23..536821da5f 100644 --- a/docs/zh-Hans/MATH.md +++ b/docs/zh-Hans/MATH.md @@ -140,10 +140,10 @@ markdown: math: enable: false - # Default(true) will load mathjax/katex srcipt EVERY PAGE - # If you set to false, you need to add 'mathjax: true' in Front Matter of post + # Default(false) will load mathjax/katex srcipt EVERY PAGE + # If you set to true, you need to add 'mathjax: true' in Front Matter of post # in order to render math equations in post - per_page: true + per_page: false engine: mathjax #engine: katex @@ -175,13 +175,13 @@ math: ### per_page -`true` 或者 `false`,默认为 `true`。 +`true` 或者 `false`,默认为 `false`。 这个选项是控制是否在每篇文章都渲染数学公式; -默认(`true`)的行为是**对每篇文章都进行数学公式渲染**; +默认(`false`)的行为是**对每篇文章都进行数学公式渲染**; -`false` 的行为是**只对 Front Matter 中含有 `mathjax: true` 的文章进行数学公式渲染**。 +`true` 的行为是**只对 Front Matter 中含有 `mathjax: true` 的文章进行数学公式渲染**。 如果 Front Matter 中不含有 `mathjax: true`,或者 `mathjax: false`,那么 NexT 将不会对这些文章进行数学公式渲染。 diff --git a/layout/_third-party/math/index.swig b/layout/_third-party/math/index.swig index 285b923b05..65d1a2e2ad 100644 --- a/layout/_third-party/math/index.swig +++ b/layout/_third-party/math/index.swig @@ -1,5 +1,5 @@ {% if theme.math.enable %} - {% if theme.math.per_page or (page.total or page.mathjax) %} + {% if not theme.math.per_page or (page.total or page.mathjax) %} {% if theme.math.engine == 'mathjax' %} {% include 'mathjax.swig' %} {% elif theme.math.engine == 'katex' %} @@ -7,3 +7,4 @@ {% endif %} {% endif %} {% endif %} + From cf5cc5ac8baa905a0ab05e13d6c0ecf808c648d6 Mon Sep 17 00:00:00 2001 From: Wafer Li Date: Mon, 22 Jan 2018 11:51:35 +0900 Subject: [PATCH 3/3] Set per_page default to true and update docs --- _config.yml | 8 ++++---- docs/MATH.md | 18 +++++++++--------- docs/zh-Hans/MATH.md | 17 ++++++++--------- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/_config.yml b/_config.yml index 40daac61b2..9e7c551097 100644 --- a/_config.yml +++ b/_config.yml @@ -375,10 +375,10 @@ font: math: enable: false - # Default(false) will load mathjax/katex srcipt EVERY PAGE - # If you set to true, you need to add 'mathjax: true' in Front Matter of post - # in order to render math equations in post - per_page: false + # Default(true) will load mathjax/katex script on demand + # That is it only render those page who has 'mathjax: true' in Front Matter. + # If you set it to false, it will load mathjax/katex srcipt EVERY PAGE. + per_page: true engine: mathjax #engine: katex diff --git a/docs/MATH.md b/docs/MATH.md index 5a0eb74da3..c34ec08523 100644 --- a/docs/MATH.md +++ b/docs/MATH.md @@ -138,10 +138,10 @@ If your content of config just directly after the config name, then a space is n math: enable: false - # Default(false) will load mathjax/katex srcipt EVERY PAGE - # If you set to true, you need to add 'mathjax: true' in Front Matter of post - # in order to render math equations in post - per_page: false + # Default(true) will load mathjax/katex script on demand + # That is it only render those page who has 'mathjax: true' in Front Matter. + # If you set it to false, it will load mathjax/katex srcipt EVERY PAGE. + per_page: true engine: mathjax #engine: katex @@ -173,15 +173,13 @@ math: ### per_page -`true` or `false`, default is `false`. +`true` or `false`, default is `true`. This option is to control whether to render Math Equations every page. -The behavior of default (`false`) is to render Math Equations on **every page**. - -When you set it to `true`, it will only render the post with `mathjax: true` Front Matter. +The behavior of default (`true`) is to render Math Equations **on demand**. -If your post's Front Matter doesn't have `mathjax: true` or you set `mathjax: false`, then NexT will not render Math Equations for those posts. +It will only render those posts which have `mathjax: true` in their Front Matter. For example: @@ -211,6 +209,8 @@ title: 'Not Render Math Either' .... ``` +When you set it to `false`, the math will be render on **EVERY PAGE**. + ### cdn Both MathJax and Katex provide a config `cdn`, if you don't know what is `cdn`, **do not touch it**. diff --git a/docs/zh-Hans/MATH.md b/docs/zh-Hans/MATH.md index 536821da5f..c688fb0092 100644 --- a/docs/zh-Hans/MATH.md +++ b/docs/zh-Hans/MATH.md @@ -140,10 +140,10 @@ markdown: math: enable: false - # Default(false) will load mathjax/katex srcipt EVERY PAGE - # If you set to true, you need to add 'mathjax: true' in Front Matter of post - # in order to render math equations in post - per_page: false + # Default(true) will load mathjax/katex script on demand + # That is it only render those page who has 'mathjax: true' in Front Matter. + # If you set it to false, it will load mathjax/katex srcipt EVERY PAGE. + per_page: true engine: mathjax #engine: katex @@ -164,7 +164,6 @@ math: cdn: //cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.css # If you want to try the latest version of Katex, use one below instead #cdn: //cdn.jsdelivr.net/katex/latest/katex.min.css - ``` ### enable @@ -175,13 +174,11 @@ math: ### per_page -`true` 或者 `false`,默认为 `false`。 +`true` 或者 `false`,默认为 `true`。 这个选项是控制是否在每篇文章都渲染数学公式; -默认(`false`)的行为是**对每篇文章都进行数学公式渲染**; - -`true` 的行为是**只对 Front Matter 中含有 `mathjax: true` 的文章进行数学公式渲染**。 +默认(`true`) 的行为是**只对 Front Matter 中含有 `mathjax: true` 的文章进行数学公式渲染**。 如果 Front Matter 中不含有 `mathjax: true`,或者 `mathjax: false`,那么 NexT 将不会对这些文章进行数学公式渲染。 @@ -213,6 +210,8 @@ title: 'Not Render Math Either' .... ``` +当你将它设置为 `false` 时,它就会在每个页面都加载 MathJax 或者 Katex 来进行数学公式渲染。 + ### cdn MathJax 和 Katex 都提供了 `cdn` 的配置,如果你不知道什么是 `cdn` ,**请不要修改这个配置**。