Skip to content

Make per_page default to true to make math lazyloaded#66

Merged
wafer-li merged 3 commits intotheme-next:masterfrom
wafer-li:math-flip-perpage
Jan 22, 2018
Merged

Make per_page default to true to make math lazyloaded#66
wafer-li merged 3 commits intotheme-next:masterfrom
wafer-li:math-flip-perpage

Conversation

@wafer-li
Copy link
Member

@wafer-li wafer-li commented Jan 22, 2018

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines.
  • Tests for the changes have been added (for bug fixes / features).
    • Muse | Mist have been tested.
    • Pisces | Gemini have been tested.
  • Docs have been added / updated (for bug fixes / features).

PR Type

What kind of change does this PR introduce?

  • Bugfix.
  • Feature.
  • Code style update (formatting, local variables).
  • Refactoring (no functional changes, no api changes).
  • Build related changes.
  • CI related changes.
  • Documentation content changes.
  • Other... Please describe:

What is the current behavior?

per_page default is false and will render math EVERY PAGE.

What is the new behavior?

per_page default is true and will render math on demand.

That is it will only render those posts with mathjax: true by default

Related: #32 (comment)

How to use?

In NexT _config.yml:

# This is default opiton now
math:
  enable: false
  per_page: true

Does this PR introduce a breaking change?

  • Yes.
  • No.

Copy link
Member

@ivan-nginx ivan-nginx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@wafer-li wafer-li changed the title Flip per_page behavior and update docs Make per_page default to true to make math lazyloaded Jan 22, 2018
Copy link
Contributor

@tsanie tsanie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GJ. 👍

And I think it is not a breaking change, because the users' current config will not make the different result, until they change their config.

@ivan-nginx
Copy link
Member

ivan-nginx commented Jan 22, 2018

It's just optimization.

@wafer-li wafer-li merged commit 7e71b4b into theme-next:master Jan 22, 2018
@wafer-li wafer-li deleted the math-flip-perpage branch January 22, 2018 03:06
@ivan-nginx
Copy link
Member

And milestone please.

@wafer-li wafer-li added this to the v6.0.3 milestone Jan 22, 2018
@tsanie
Copy link
Contributor

tsanie commented Jan 22, 2018

@sli1989 The code is not changed, and just change the default parameter and docs, the logic works like it before as. And yes, if it is set to true, only the post contains mathjax: true will be rendered with mathjax.


original words:
代码没有变动,这次 PR 只是修改了默认选项和文档,逻辑上就和以前一样。如果设置为 true,那就只有含有 mathjax: true 的文章会进行数学公式渲染。

@sli1989
Copy link
Collaborator

sli1989 commented Jan 22, 2018

好吧,还以为改了代码。为啥不考虑删除not呀,为了保持一致性?

@baoang
Copy link

baoang commented May 9, 2018

正在用这个功能。我觉得单页比较好,因为不是每一篇博客都含有数学化学等公式的,如果每页均要引入mathjax的话,对页面的加载来说是个负担。

目前我的做法就是在含有数学公式的md文件的头部加个mathjax: true

@sli1989
Copy link
Collaborator

sli1989 commented May 9, 2018

The question is the logic: per_page: true=not load per page. 😄

tongluyang pushed a commit to tongluyang/hexo-theme-next that referenced this pull request Nov 19, 2019
Make per_page default to true to make math lazyloaded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants