doconce
doconce copied to clipboard
Updating MathJax CDN in HTML documents
The easiest way to update HTML documents to use the new MathJax CDN is to rerun doconce. However, in some circumstances, this may not be possible if the doconce source files have been lost.
A script which fixes the MathJax CDN in HTML documents have been written and tested with the DocOnce documentation. This script is available in utils/fix_mathjax_cdn.py in the repo and https://github.com/hplgit/doconce/blob/master/utils/fix_mathjax_cdn.py
Usage
Standalone
./fix_mathjax_cdn.py <html file>
With find
This script should be paired with find to fix all files in a given directory and its subdirectories.
Say we have the following directory structure
[cwd: doc]$ tree
.
├── fix_mathjax_cdn.py
├── pub
│ ├── book.html
│ ├── book.pdf
│ └── chapters
│ ├── chap1.html
│ ├── chap1.pdf
│ ├── chap2.html
│ ├── chap2.pdf
│ ├── chap3.html
│ └── chap3.pdf
We can use the following command
find . -type f -name '*.html' -exec ./fix_mathjax.py {} \;