Skip to content

Commit

Permalink
New Feature: mhchem support (#554)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenjoezhang authored Dec 31, 2018
1 parent e303420 commit c947f26
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 19 deletions.
34 changes: 18 additions & 16 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ cache:
# And if you want to place your icons in `hexo-site/source/` root directory, you must remove `/images` prefix from pathes.

# For example, you put your favicons into `hexo-site/source/images` directory.
# Then need to rename & redefine they on any other names, otherwise icons from Next will rewrite your custom icons in Hexo.
# Then need to rename & redefine them on any other names, otherwise icons from Next will rewrite your custom icons in Hexo.
favicon:
small: /images/favicon-16x16-next.png
medium: /images/favicon-32x32-next.png
Expand All @@ -64,15 +64,15 @@ footer:

# Icon between year and copyright info.
icon:
# Icon name in fontawesome, see: https://fontawesome.com/v4.7.0/icons
# Icon name in fontawesome, see: https://fontawesome.com/v4.7.0/icons/
# `heart` is recommended with animation in red (#ff0000).
name: user
# If you want to animate the icon, set it to true.
animated: false
# Change the color of icon, using Hex Code.
color: "#808080"

# If not defined, will be used `author` from Hexo main config.
# If not defined, `author` from Hexo main config will be used.
copyright:
# -------------------------------------------------------------
powered:
Expand All @@ -99,7 +99,7 @@ footer:

# Creative Commons 4.0 International License.
# https://creativecommons.org/share-your-work/licensing-types-examples
# Available: by | by-nc | by-nc-nd | by-nc-sa | by-nd | by-sa | zero
# Available values: by | by-nc | by-nc-nd | by-nc-sa | by-nd | by-sa | zero
creative_commons:
license: by-nc-sa
sidebar: false
Expand Down Expand Up @@ -135,7 +135,7 @@ exturl: false
# Key is the name of menu item. If translate for this menu will find in languages - this translate will be loaded; if not - Key name will be used. Key is case-senstive.
# Value before `||` delimeter is the target link.
# Value after `||` delimeter is the name of FontAwesome icon. If icon (with or without delimeter) is not specified, question icon will be loaded.
# External url should start with http:// or https:// .
# External url should start with http:// or https://
menu:
home: / || home
#about: /about/ || user
Expand Down Expand Up @@ -170,7 +170,7 @@ scheme: Muse
# Posts / Categories / Tags in sidebar.
site_state: true

# Social Links.
# Social Links
# Usage: `Key: permalink || icon`
# Key is the link label showing to end users.
# Value before `||` delimeter is the target permalink.
Expand Down Expand Up @@ -231,7 +231,7 @@ toc:
max_depth: 6

sidebar:
# Sidebar Position, available value: left | right (only for Pisces | Gemini).
# Sidebar Position, available values: left | right (only for Pisces | Gemini).
position: left
#position: right

Expand All @@ -241,7 +241,7 @@ sidebar:
# Pisces | Gemini: 240
#width: 300

# Sidebar Display, available value (only for Muse | Mist):
# Sidebar Display, available values (only for Muse | Mist):
# - post expand on posts automatically. Default.
# - always expand for all pages automatically
# - hide expand only when click on the sidebar toggle icon.
Expand Down Expand Up @@ -365,7 +365,7 @@ mobile_layout_economy: false
# Android Chrome header panel color ($brand-bg / $headband-bg => $black-deep).
android_chrome_color: "#222"

# Custom Logo.
# Custom Logo
# Do not support Scheme Mist currently.
# Options:
# enabled: If true, will enable custom logo
Expand Down Expand Up @@ -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
# For direct link to MathJax.js with CloudFlare CDN (cdnjs.cloudflare.com).
# For direct link to MathJax.js with CloudFlare CDN (cdnjs.cloudflare.com)
#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

# hexo-renderer-markdown-it-plus (or hexo-renderer-markdown-it with markdown-it-katex plugin) needed to full Katex support.
katex:
# Use 0.7.1 as default, jsdelivr as default CDN, works everywhere even in China
Expand Down Expand Up @@ -547,7 +549,7 @@ valine:
#livere_uid: your uid

# Gitment
# Introduction: https://imsun.net/posts/gitment-introduction
# Introduction: https://github.com/imsun/gitment
gitment:
enable: false
mint: true # RECOMMEND, A mint on Gitment, to support count, language and proxy_gateway
Expand Down Expand Up @@ -575,7 +577,7 @@ gitalk:
distraction_free_mode: true # Facebook-like distraction free mode

# Baidu Share
# Available value:
# Available values:
# button | slide
# Warning: Baidu Share does not support https.
#baidushare:
Expand All @@ -586,8 +588,7 @@ gitalk:

# NeedMoreShare2
# Dependencies: https://github.com/theme-next/theme-next-needmoreshare2
# See: https://github.com/revir/need-more-share2
# Also see: https://github.com/DzmVasileusky/needShareButton
# See: https://github.com/revir/need-more-share2, https://github.com/DzmVasileusky/needShareButton
# iconStyle: default | box
# boxForm: horizontal | vertical
# position: top / middle / bottom + Left / Center / Right
Expand Down Expand Up @@ -772,6 +773,7 @@ bookmark:
# Tags Settings
# ---------------------------------------------------------------

# See: https://theme-next.org/docs/tag-plugins/
# Note tag (bs-callout)
note:
# Note tag style values:
Expand Down
17 changes: 14 additions & 3 deletions layout/_third-party/math/mathjax.swig
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
<script type="text/x-mathjax-config">
{% if theme.math.mathjax.mhchem %}
MathJax.Ajax.config.path['mhchem'] = '{{ theme.math.mathjax.mhchem }}';
{% endif %}

MathJax.Hub.Config({
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
processEscapes: true,
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
},
TeX: {equationNumbers: { autoNumber: "AMS" }}
TeX: {
{% if theme.math.mathjax.mhchem %}
extensions: ['[mhchem]/mhchem.js'],
{% endif %}
equationNumbers: {
autoNumber: "AMS"
}
}
});
</script>

<script type="text/x-mathjax-config">
MathJax.Hub.Queue(function() {
var all = MathJax.Hub.getAllJax(), i;
for (i=0; i < all.length; i += 1) {
for (i = 0; i < all.length; i += 1) {
all[i].SourceElement().parentNode.className += ' has-jax';
}
});
Expand Down

0 comments on commit c947f26

Please sign in to comment.