Closed ZodmanPerth closed 3 years ago
Where did you put your MathJax config? Also, you can try to wrap your gist with tex2jax_ignore
without modifying the MathJax config.
Where did you put your MathJax config?
MathJax config was placed in mathjax.js
so it would generate with the page:
_createClass(Mathjax, [{
key: "render",
value: function render() {
var jsUrl = this.props.jsUrl;
var js = "MathJax.Hub.Config({\n 'HTML-CSS': {\n matchFontHeight: false\n },\n SVG: {\n matchFontHeight: false\n },\n CommonHTML: {\n matchFontHeight: false\n },\n tex2jax: {\n ignoreClass: \"zodIgnoreMathJax\",\n inlineMath: [\n ['$','$'],\n ['\\\\(','\\\\)']\n ]\n }\n });";
(The excerpt from my previous post was extracted from the generated page using Chrome Developer Tools.)
Also, you can try to wrap your gist with tex2jax_ignore without modifying the MathJax config.
Is this what you mean? Because this doesn't work:
<div class="tex2jax_ignore">
<script src="https://gist.github.com/ZodmanPerth/ce90e1ac74276f5e30f0905c71a91c5d.js?file=Sample.js"></script>
</div>
I have also tried:
<tex2jax_ignore>
<script src="https://gist.github.com/ZodmanPerth/ce90e1ac74276f5e30f0905c71a91c5d.js?file=Sample.js"></script>
</tex2jax_ignore>
...which doesn't work either. MathJax insists on affecting the Gist.
What's interesting is that as the page loads you can see the Gist load correctly, then MathJax alters it. I'm wondering if there's a way to force the MathJax script to run against the page before the Gist script loads, hoping that MathJax does not listen for changes to the DOM?
@ZodmanPerth Try changing ignoreClass: "zodIgnoreMathJax"
to ignoreClass: "gist"
.
Changing ignoreClass: "zodIgnoreMathJax"
to ignoreClass: "gist"
had no effect; MathJax still affects the contents of the Gist.
@ZodmanPerth It turns out that your code is parsed as ASCIIMath notations instead of TeX. Using asciimath2jax_ignore
as class name will prevent your code from being processed by MathJax.
<div class="asciimath2jax_ignore">
<script src="https://gist.github.com/ZodmanPerth/ce90e1ac74276f5e30f0905c71a91c5d.js?file=Sample.js"></script>
</div>
If you are not sure which preprocessor MathJax will use, just add all ignored class names to your wrapper:
<div class="tex2jax_ignore asciimath2jax_ignore">
<script src="https://gist.github.com/ZodmanPerth/ce90e1ac74276f5e30f0905c71a91c5d.js?file=Sample.js"></script>
</div>
That works!
Thank you very much. I don't know how MathJax processing works and I didn't find any information about the asciimath2jax_ignore
class when I tried to solve this issue on my own. I really appreciate the guidance you've provided.
✅
Describe the bug I have MathJax turned on in my config file. When I embed a GitHub Gist in a post, MathJax is applied to the embedded Gist. MathJax should not be applied to the content of the Gist.
System and Environment Hexo version 5.4.0 (commit 2ae643a6) Icarus version 4.2.0 (commit efc756a5)
hexo version
command to view these information)_config.yml
Site
title: Red Peregrine subtitle: Carl Scarlett's Blog description: Red Peregrine is the blog site of Carl Scarlett author: Carl Scarlett language: en timezone: ''
URL
If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: https://www.redperegrine.net root: / permalink: :title/ permalink_defaults: null
pretty_urls: trailing_index: true trailing_html: true
Directory
source_dir: source public_dir: public tag_dir: tags archive_dir: archives category_dir: categories code_dir: downloads/code i18n_dir: :lang skip_render: null
Writing
new_post_name: :title.md # File name of new posts default_layout: post titlecase: false # Transform title into titlecase external_link: enable: true # Open external links in new tab field: site exclude: '' filename_case: 1 render_drafts: false post_asset_folder: true relative_link: false future: true highlight: enable: true line_number: true auto_detect: false tab_replace: ' ' wrap: false hljs: false prismjs: enable: false preprocess: true line_number: true tab_replace: ''
Home page setting
path: Root path for your blogs index page. (default = '')
per_page: Posts displayed per page. (0 = disable pagination)
order_by: Posts order. (Order by date descending by default)
index_generator: path: '' per_page: 5 order_by: '-date'
Category & Tag
default_category: uncategorized category_map: null tag_map: null meta_generator: true
Date / Time format
Hexo uses Moment.js to parse and display date
You can customize the date format as defined in
http://momentjs.com/docs/#/displaying/format/
date_format: YYYY-MM-DD time_format: HH:mm:ss updated_option: mtime
Pagination
Set per_page to 0 to disable pagination
per_page: 10 pagination_dir: page
Include/Exclude Files or Folders
Use glob expressions to include/exclude additional files
include: null
exclude: null
ignore: null
Extensions
Plugins: https://hexo.io/plugins/
Themes: https://hexo.io/themes/
theme: icarus
RSS
npm install hexo-generator-feed --save
feed: type: atom path: atom.xml limit: 50
hub:
content: content_limit: 280 content_limit_delim: ' ' order_by: -date icon: /img/personal-blog/favicon.svg autodiscovery: false
template:
Deployment
Docs: https://hexo.io/docs/deployment.html
deploy: type: git repo: withheld branch: master
Emojis
https://github.com/crimx/hexo-filter-github-emojis
githubEmojis: enable: true className: github-emoji inject: true unicode: false styles: localEmojis:
Sitemap
https://github.com/ludoviclefevre/hexo-generator-seo-friendly-sitemap
sitemap: path: sitemap.xml
Version of the configuration file
version: 4.0.0
Icarus theme variant, can be "default" or "cyberpunk"
variant: default
Path or URL to the website's logo
logo: /img/personal-blog/logo.svg
Page metadata configurations
head:
URL or path to the website's icon
Page top navigation bar configurations
navbar:
Navigation menu items
Page footer configurations
footer:
Links to be shown on the right of the footer section
Article related configurations
article:
Code highlight settings
Search plugin configurations
https://ppoffice.github.io/hexo-theme-icarus/categories/Plugins/Search/
search: type: insight
Comment plugin configurations
https://ppoffice.github.io/hexo-theme-icarus/categories/Plugins/Comment/
comment: type: disqus
Disqus shortname
Donate plugin configurations
https://ppoffice.github.io/hexo-theme-icarus/categories/Plugins/Donation/
donates:
"Afdian.net" donate button configurations
-
type: afdian
URL to the "Afdian.net" personal page
url: ''
Alipay donate button configurations
-
type: alipay
Alipay qrcode image URL
qrcode: ''
"Buy me a coffee" donate button configurations
-
type: buymeacoffee
URL to the "Buy me a coffee" page
url: ''
Patreon donate button configurations
-
type: patreon
URL to the Patreon page
url: ''
Paypal donate button configurations
-
type: paypal
Paypal business ID or email address
business: ''
Currency code
currency_code: USD
Wechat donate button configurations
-
type: wechat
Wechat qrcode image URL
qrcode: ''
Share plugin configurations
https://ppoffice.github.io/hexo-theme-icarus/categories/Plugins/Share/
share:
type: sharethis
URL to the ShareThis share plugin script
install_url: ''
Sidebar configurations.
Please be noted that a sidebar is only visible when it has at least one widget
sidebar:
Left sidebar configurations
Sidebar widget configurations
http://ppoffice.github.io/hexo-theme-icarus/categories/Widgets/
widgets:
Profile widget configurations
Plugin configurations
https://ppoffice.github.io/hexo-theme-icarus/categories/Plugins/
plugins:
Enable page startup animations
CDN provider settings
https://ppoffice.github.io/hexo-theme-icarus/Configuration/Theme/speed-up-your-site-with-custom-cdn/
providers:
Name or URL template of the JavaScript and/or stylesheet CDN provider