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

resolves #207 create a browser-compatible version of the Document converter #228

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ggrossetie
Copy link
Owner

  • Reduce the scope of the classes
  • Use browserify to produce a browser-compatible file
  • Inline files content (ie. replace readFileSync) to bundle everything into a single JavaScript file
  • Add tests

resolves #207

@ggrossetie ggrossetie force-pushed the issue-207-browser-compat branch 3 times, most recently from f9e8e75 to 9c0050c Compare May 9, 2020 11:05
…verter

- Reduce the scope of the classes
- Use browserify to produce a browser-compatible file
- Inline files content (ie. replace readFileSync) to bundle everything into a single JavaScript file
- Add tests
@ggrossetie
Copy link
Owner Author

ggrossetie commented Aug 28, 2020

Currently, MathJax is not self-contained and tries to load JavaScript files and fonts from a path/URL.
Apparently, it might be possible to create a MathJax bundle using Webpack http://docs.mathjax.org/en/latest/web/webpack.html but it requires a custom build.

Alternatively, we could create a browser-compatible version of the Asciidoctor MathJax extension: https://gitlab.com/djencks/asciidoctor-mathjax.js/-/tree/master

I did try to use an SVG output (instead of the CommonHTML output) but it does not look so great on the PDF. One advantage of the SVG output is that it is relatively self-contained (i.e. it does not rely heavily on fonts). One disadvantage is that there's no character so the expression cannot be copy and pasted.

I'm seriously considering dropping MathJax in favor of KaTeX. MathJax is great but, in my opinion, does too much. In comparison, here's how to integrate KaTeX in the browser: https://katex.org/docs/browser.html

Since KaTeX does not load additional modules or components, it's straightforward to bundle the library.

@ggrossetie
Copy link
Owner Author

Blocked by #316

@ahus1
Copy link
Contributor

ahus1 commented Oct 19, 2020

@Mogztter - for what it is worth: I managed to package a self-contained version of MathJax 2.x for the AsciiDoc plugin for IntelliJ. You find the result here: https://github.com/asciidoctor/asciidoctor-intellij-plugin/tree/master/src/main/resources/org/asciidoc/intellij/editor/javafx/MathJax

As asciidoctor-web-pdf is already using 3.x, am I correct that this doesn't help here?

@ggrossetie ggrossetie marked this pull request as draft October 19, 2020 09:44
@ahus1
Copy link
Contributor

ahus1 commented Oct 19, 2020

@Mogztter - sorry, just saw the other issue; please disregard my comment.

@ggrossetie
Copy link
Owner Author

ggrossetie commented Oct 19, 2020

No worries, I guess a self-contained version of MathJax 3.x will be useful in the Asciidoctor ecosystem but I didn't figure out (yet) how the build/require/module system in MathJax 3.x is working.

I've created mathjax/MathJax#2539 which potentially could solve the main issue (i.e. disable dynamic font loading).
If you want to give it a try or have ideas on how to do it, please share 🤗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a browser compatible version of the converter
2 participants