sphinx-doc/sphinx

Extend `sphinx.ext.mathjax` to support static output

Open

#8,453 opened on 2020年11月20日

GitHub で見る
 (1 comment) (4 reactions) (0 assignees)Python (1,985 forks)batch import
extensions:mathematicshelp wantedmarkuptype:enhancement

Repository metrics

Stars
 (5,625 stars)
PR merge metrics
 (平均マージ 10d 11h) (30d で 11 merged PRs)

説明

Mathjax is normally processed client-side (dynamically rendered with javascript), but with CommonHTML it is now also possible to process it server-side. From the official MathJax documentation:

The CommonHTML output processor renders your mathematics using HTML with CSS styling. Its major advantage is its quality, consistency, and the fact that its output is independent of the browser, operating system, and user environment. This means you can pre-process mathematics on a server, without needing to know the browser, what fonts are available, and so on.

Rather than implementing server-side postprocessing of the output generated by Sphinx, however, I would much rather have that sphinx.ext.mathjax was extended to support output that needed no additional processing. That is, I would like Sphinx to be able to generate offline readable static documents containing mathematics, without resorting to images (i.e., sphinx.ext.imgmath). I believe this can be done by letting sphinx.ext.mathjax open a connection to the mathjax server specified in the mathjax_path option already available, and replace the sphinx nodes by CommonHTML output one by one. The documentation of this feature should include a kind warning that this mathjax feature only supports modern browsers (currently backported to IE 8).

コントリビューターガイド