shime / livedown

Live Markdown previews for your favorite editor.
MIT License
763 stars 45 forks source link

How to use MathJax or other rendering engine? #15

Open oplatek opened 9 years ago

oplatek commented 9 years ago

When using MathJax via <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=default"></script> the equations are not rerendered.

Do you have any recommendation for that?

The problem can be seen in this example: https://raw.githubusercontent.com/oplatek/lxmls-toolkit/lecture_notes/lecture_notes/7-16-01morning-session.md

xanderdunn commented 9 years ago

I would also really love to be able to integrate MathJax.

shime commented 9 years ago

What's the problem here? Would you like livedown to support an option for rendering math expressions out of the box?

Something like

livedown start --math example.md
xanderdunn commented 9 years ago

@shime Sure, something like that would be great. It seems MathJax rendering doesn't work at all right now. Adding the usual MathJax JavaScript boilerplate like @oplatek mentioned doesn't do the trick in live down. Thanks!

shime commented 9 years ago

For me it does™.

What browser are you using? Could you inspect the output in the console, maybe there's some errors being reported there...

Any additional info would help. Thanks!

oplatek commented 9 years ago

@shime I created minimal "broken" example where MathJax is not rerendered.

The source code is here: https://gist.github.com/oplatek/94c87c24e039686bf2af

The only time when it is rendered correctly is when you open the webpage with e.g. when you type :LivedownPreview in Vim.

After that the image is correctly rendered only: https://www.dropbox.com/s/21smieh0dcxoxwh/Screenshot%202015-10-11%2007.50.26.png?dl=0 However if I type anything else in the document, the equation is not rerendered. https://www.dropbox.com/s/5as794nmiwtsx9q/Screenshot%202015-10-11%2007.51.43.png?dl=0

paynito commented 8 years ago

Similar question, does this work with mermaid flowchart diagrams?

hcgatewood commented 5 years ago

Until this gets resolved/pulled, feel free to check out my fork which includes automatic handling of KaTeX equations @hcgatewood/livedown. Installation via npm install -g git+https://github.com/hcgatewood/livedown.