MacDownApp / MacDownApp/macdown

Switch to KaTeX and server-side math rendering

Open
#162 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted todo
Dominant language
Rich Text Format
Stars
9.8k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

[KaTeX](http://khan.github.io/KaTeX/) By Khan Academy is a new math-typesetting library implemented completely with JavaScript and CSS. It is much faster than MathJax (which we currently use for math rendering), has much cleaner dependency, and can be bundled pretty cleanly inside a page, thus not requiring Internet connection.

Even better, it can do server-side rendering. Hoedown 3.0 will get [first-class math syntax support](https://github.com/hoedown/hoedown/commit/7e5ba30c23f2a455cc041a8d1307d3b75e8eec1a), and combining a math callback with JavaScriptCore it should be possible to completely eliminate post-rendering callbacks needed by MathJax. Also, by bundling the rendering library we can also bundle the fonts, boosting performance even further (with less than 1 MB increase in bundle size).

The most obvious disadvantage at the current moment is TeX compatibility. KaTeX supports [quite a lot](https://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX) already, but still much less than MathJax. But with any luck it should catch up pretty quickly.

Please comment if there’s anything you would like to add, or if you think this is a splendid/great/meh/bad/terrible idea. My current plan is to evaluate this again after Hoedown 3.0 is publicly available, and start the migration soon after we upgrade to it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the current MathJax integration and the planned Hoedown 3.0 math callback with JavaScriptCore. Evaluate KaTeX’s TeX compatibility and bundled fonts, then determine whether server-side rendering can replace the existing post-rendering callbacks; done means a migration plan or implementation that preserves required math support without an Internet connection.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
desktop, frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.