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

Add support for mathjax #42

Closed
VicaYang opened this issue Jul 17, 2018 · 3 comments
Closed

Add support for mathjax #42

VicaYang opened this issue Jul 17, 2018 · 3 comments

Comments

@VicaYang
Copy link
Contributor

Hi, I am using your hexo-generator-amp plugin and that works quite well. However, I notice that because the amp disallow the third party javascript, the formula I write in .md could not be render correctly in amp page.

I notice that amp has support MathML in the beginning of 2018. So I would like to do a little change: when generate the amp page, use the regex to replace $(.*)$ and $$(.*)$$ to <amp-mathml layout="container" data-formula="\[ (.*) \]"> </amp-mathml>

Do you know any idea how to render the formula elegantly except this method? Also, could you provide some hints or information about how and where should I modify the code? I guess I should add a formula.js in the filter to do the replacement and call it in generator.js. Am I correct? I am willing to make a contribution!

@tea3
Copy link
Owner

tea3 commented Jul 17, 2018

@VicaYang
Thank you for using this plugin. As you think, I'd be happy to create formula.js and add it to generator.js. I don't know the original code, so I'm happy to make it.

About fomula.js , Is the following code helpful ?
https://github.com/tea3/hexo-generator-amp/blob/master/lib/filter/vimeo.js#L21
https://github.com/tea3/hexo-generator-amp/blob/master/lib/filter/vimeo.js#L25

About how to add fomula.js to generator.js , Is the following code helpful ?
https://github.com/tea3/hexo-generator-amp/blob/master/lib/generator.js#L29
https://github.com/tea3/hexo-generator-amp/blob/master/lib/generator.js#L111

@VicaYang
Copy link
Contributor Author

@tea3 Thankyou! I have complete the naive version and test on my blog (e.g. Analysis-of-Covariance). But I am afraid of that will fail because of some other "dirty" case. What should I do next?

VicaYang added a commit to VicaYang/hexo-generator-amp that referenced this issue Jul 17, 2018
VicaYang added a commit to VicaYang/hexo-generator-amp that referenced this issue Jul 17, 2018
tea3 added a commit that referenced this issue Jul 18, 2018
Add basic support for mathjax #42
@tea3
Copy link
Owner

tea3 commented Jul 18, 2018

@VicaYang Thank you for your pull-request. Please update this plugin.

$ npm install [email protected]

@tea3 tea3 closed this as completed Jul 18, 2018
@tea3 tea3 mentioned this issue Oct 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants