-
-
Notifications
You must be signed in to change notification settings - Fork 92
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
Create an Asciidoctor Postprocessor for MathJax #230
Comments
That's a good idea but you should probably join effort with @djencks on https://gitlab.com/djencks/asciidoctor-mathjax.js I didn't had the chance to give it a try yet but I would be great if we could use this extension with Asciidoctor Web PDF (it might already be the case). |
@djencks/asciidoctor-mathjax works fine with @djencks/antora-pdf, I'd expect it to work with asciidoctor web pdf but I haven't tried that recently. |
That is perfect! I will give it a try! |
It did not work immediatelly. I have submitted an issue for @djencks. https://gitlab.com/djencks/asciidoctor-mathjax.js/-/issues/7 But it - to me - actually looks like it is not an error in @djencks code. |
Pretty neat! I wonder if it would be possible to disable client-side MathJax when an extension already did all the work "server-side". Currently we are using the What do you think? |
That is a very good idea. When I run asciidoctor with the extension, the MathJax library is still included as a script in the resulting HTML, even though it is not used anymore. That increases the load-time of the page and possibly also has other unwanted results. For example, what happens, when I try to embed the HTML in an ebook (even though I am not sure that ebook readers can render SVG). |
Overall I think, going with the plugin will be preferable to dynamic rendering with a script. Maybe it would be better to include the plugin in asciidoctor.js directly as a default and get rid of the MathJax scripts. |
Not sure, we should definitely make sure that we provide a good integration with extensions but I don't think we should get rid of the MathJax client side. For instance, I'm creating a browser-compatible version of this converter: #228, and if we remove the MathJax scripts then |
I got into all this because Antora doesn't actually include references to the MathJax client side libraries and wondered why my stem wasn't rendering. So, isn't the client side asciidoctor.js support a template issue, now presumably made more tractable by the enhanced template support? |
It would probably be easy to add a new Asciidoctor option nostem that would could tell the default template not to render the client side libraries. Then the user could decide whether to include the script in the resulting HTML if she uses the preprocessor. |
In my mind, the We do have the same situation for syntax highlighting where you can do it server-side or client-side. To some extend, the same goes for icons where you can resolve the icons server-side (ie. output inline SVG) or client-side using JavaScript and/or a font. For syntax highlighting we have a nice API where you can indicate if your implementation is running client-side or server-side.
What do you think? |
In my opinion too, Asciidoctor should provide an API which can be used to replace the client-side stuff with server side rendering. However, nobody knows how long that may take. For the time being, the stem-server-side attribute could help with Asciidoctor Web PDF. I try to render Asciidoctor files with other rendering engines (Antennahouse, PrinceXML) and not all of them support Javascript processing. On the other hand, their feature-set is much closer or even exceeds the standard. I hope - and am quite sure - that PagedJS will catch up quickly. https://print-css.rocks is starting to reference PagedJS in their lessons, but there are only very few results yet (e.g. https://print-css.rocks/lesson/lesson-hyphenation) |
I very much like the idea of a server side api for stem. In e.g. asciidoctor-mathjax having to use a tree processor and search for the stem blocks is pretty much ridiculous. |
At the moment, formulas are converted with MathJax by embedding and configuring the MathJax scripts in the HTML page.
Another option would be to create an Asciidoctor post processor that does the MathJax processing during the generation phase. That could possibly enhance the performance and testability.
If you are interested, I can try to write such an extension for this project.
The text was updated successfully, but these errors were encountered: