rust-lang / mdBook

Create book from markdown files. Like Gitbook but implemented in Rust

Home Page:https://rust-lang.github.io/mdBook/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Syntax highlight and LaTeX at build time

toastal opened this issue · comments

It's absolutely wasteful to use highlight.js in it's current incantation.

  1. users with JavaScript disabled for security/privacy don't get syntax highlighting or rendered LaTeX
  2. user data plans and network lag are introduced to get the required tools
  3. CPU time and battery are expended to do all this parsing
  4. All of these phases slow down the render performance

Why should all users be executing the exact same parsers that produce the same markup at runtime when this should be done statically at build time so nobody has to worry about security, their data plans, or their battery life.

Yea, ideally the highlighting would be processed at build time. That is being investigated at #1652 (somewhat tracked in #1622, and other issues).

As for LaTeX rendering, I suggest looking at mdbook-katex which I believe does build-time rendering.

I'm going to close as there are other issues tracking build-time support.

Awesome. None of these are worded in a way that's discussing the upside of build-time support, so I'm happy you quickly identified it as such.