lzanini / mdbook-katex

A preprocessor for mdBook, rendering LaTex equations to HTML at build time.
MIT License
195 stars 34 forks source link

Deprecate `static-css` in favor of `no-css` & Deprecate renderer #68

Closed SichangHe closed 1 year ago

SichangHe commented 1 year ago

Deprecate static-css in favor of no-css

These options are provided so that users can opt out from using the CDN and self-host the CSS and fonts.

An example of using no-css is provided in mdbook-katex Static CSS Example using Python3. (I also intend to move the code we currently have that is used to download the CSS and fonts into another repository to provide a Rust binary).

User impact deprecating static-css

Users using static-css = true will not have static CSS, rather, mdbook-katex will inject CDN header.

TODOs

Deprecate mdbook-katex renderer

We have been asking users to add [output.katex] to their book.toml despite mdbook-katex is not a renderer.

(We only provide a fake renderer to force mdBook to output the artifact at book/html/ instead of book/. This is done so that we know where to inject the static CSS (always at book/html/) without having to worry about whether the user have other renderers.)

This is unnecessary and brought us many issues (#33, #48). Most users don't need static-css anyway and are instead confused why their artifacts are in book/html/.

User impact deprecating the renderer

Users will see an error complaining that katex does not support renderer when their book builds if they set [output.katex].

They will need to remove [output.katex] in their book.toml so it look like the book.toml in the README. Then, their artifact will be output at book/ instead of book/html/ if they don't have other renderer plugins.

TODOs

Original issue opened on Feb 9

Currently, the renderer downloads the CSS files and fonts into the build target directory (book) if static-css option is turned on. There are two major drawbacks:

What we should have done instead, is to download the CSS in the theme folder and the fonts in the theme/fonts folder and ask the users to add something like this to their book.toml:

[output.html]
additional-css = ["theme/katex.min.css"]
SichangHe commented 1 year ago

Refereces:

SichangHe commented 1 year ago

As v0.5.0 is released, I consider this issue done.