Publish.jl icon indicating copy to clipboard operation
Publish.jl copied to clipboard

KaTeX JS not included by default

Open darsnack opened this issue 4 years ago • 6 comments

None of the math blocks are rendered using KaTeX in my deployed page (see below). Is the JS loaded by default, or is there something required on my part? I see the resulting HTML is wrapped in <div class="math">.

Screen Shot 2020-12-24 at 6 46 51 PM

darsnack avatar Dec 25 '20 00:12 darsnack

There's no included math rendering lib in the HTML output at the moment. I'm happy to have one included by default, KaTeX is probably the best default to use.

MichaelHatherly avatar Dec 25 '20 09:12 MichaelHatherly

It seems like KaTeX expects the class "katex", but the markdown generates the classes "math" and "display-math".

darsnack avatar Dec 25 '20 15:12 darsnack

Never mind, it seems as though that is irrelevant for rendering.

darsnack avatar Dec 25 '20 22:12 darsnack

It seems like KaTeX expects the class "katex", but the markdown generates the classes "math" and "display-math".

Yup, the markdown->html rendering is meant to be reasonably agnostic with respect to the libraries you end up using in the final document, so you have to point katex to the specific nodes with classes math and display-math.

Currently there's some implementation code in https://github.com/MichaelHatherly/PublishThemes/blob/master/themes/default/html_doc.mustache which is used for the (currently) undocumented self-contained html_doc output format. I just need to port over that katex stuff to the main html theme as well.

MichaelHatherly avatar Dec 26 '20 21:12 MichaelHatherly

Yeah using the event listener is the approach I ended up using too.

darsnack avatar Dec 26 '20 23:12 darsnack

Hi all, can someone ELI5 how to activate the KaTeX rendering for HTML output using [email protected]? Passing html_doc to serve throws an error.

kapple19 avatar Oct 11 '23 03:10 kapple19