Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #553 New Feature: mhchem support #554

Merged
merged 2 commits into from
Dec 31, 2018
Merged

Fix #553 New Feature: mhchem support #554

merged 2 commits into from
Dec 31, 2018

Conversation

stevenjoezhang
Copy link
Contributor

@stevenjoezhang stevenjoezhang commented Dec 31, 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?

Issue Number(s): #553

What is the new behavior?

Description about this pull, in several words...

  • Screens with this changes: N/A
  • Link to demo site with this changes: N/A

Removed invalid CDN due to https://www.mathjax.org/cdn-shutting-down/

How to use?

In NexT _config.yml:

...

Does this PR introduce a breaking change?

  • Yes.
  • No.

@@ -459,11 +459,13 @@ math:
mathjax:
# Use 2.7.1 as default, jsdelivr as default CDN, works everywhere even in China
cdn: //cdn.jsdelivr.net/npm/mathjax@2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML
# For newMathJax CDN (cdnjs.cloudflare.com) with fallback to oldMathJax (cdn.mathjax.org).
#cdn: //cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML
Copy link
Member

Choose a reason for hiding this comment

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

Check this link – it's worked for now, i think no need to remove it.

Copy link
Contributor Author

@stevenjoezhang stevenjoezhang Dec 31, 2018

Choose a reason for hiding this comment

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

http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML just make a redirect to https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js, and you can see console.warn('WARNING: cdn.mathjax.org has been retired. Check https://www.mathjax.org/cdn-shutting-down/ for migration tips.') in the script.
I suggest removing it.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, remove it. Under your responsibility. =)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

=)

@ivan-nginx ivan-nginx added this to the v6.7.0 milestone Dec 31, 2018
@ivan-nginx
Copy link
Member

ivan-nginx commented Dec 31, 2018

Also, need to add docs on site: https://theme-next.org/docs/third-party-services/math-equations/
image

@stevenjoezhang stevenjoezhang merged commit c947f26 into theme-next:master Dec 31, 2018
@stevenjoezhang
Copy link
Contributor Author

OK, I'll add the docs for mathjax.mhchem and katex.copy_tex

#cdn: //cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML

# See: https://mhchem.github.io/MathJax-mhchem/
#mhchem: //cdn.jsdelivr.net/npm/mathjax-mhchem@3
#mhchem: //cdnjs.cloudflare.com/ajax/libs/mathjax-mhchem/3.3.0
Copy link
Member

Choose a reason for hiding this comment

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

Also, this link not working. (403)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mathjax will request cdnjs.cloudflare.com/ajax/libs/mathjax-mhchem/3.3.0/mhchem.js automatically, instead of cdnjs.cloudflare.com/ajax/libs/mathjax-mhchem/3.3.0, it works fine

#cdn: //cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML

# See: https://mhchem.github.io/MathJax-mhchem/
#mhchem: //cdn.jsdelivr.net/npm/mathjax-mhchem@3
Copy link
Member

Choose a reason for hiding this comment

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

And maybe this link wrong too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have tested it, mathjax will load //cdn.jsdelivr.net/npm/mathjax-mhchem@3.3.0/mhchem.js, no problem here

TeX: {equationNumbers: { autoNumber: "AMS" }}
TeX: {
{% if theme.math.mathjax.mhchem %}
extensions: ['[mhchem]/mhchem.js'],
Copy link
Member

Choose a reason for hiding this comment

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

Oh, i see. Maybe try to add in CDN's settings something like //cdn.jsdelivr.net/npm/mathjax-mhchem@3/mhchem.min.js and stay here only extensions: ['[mhchem]']?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, //cdn.jsdelivr.net/npm/mathjax-mhchem@3 is confusing... I'll fix it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems that mathjax can't parse extensions: ['[mhchem]'] ... The syntax follows https://mhchem.github.io/MathJax-mhchem/ is the correctly way
Maybe no need to change

Copy link
Member

Choose a reason for hiding this comment

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

Mb because MathJax.Ajax.config.path exists above.
Ok, don't stay it as is. Mb later we can optimize it. 🥇

tongluyang pushed a commit to tongluyang/hexo-theme-next that referenced this pull request Nov 19, 2019
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.

2 participants