Skip to content

Commit

Permalink
Render math with MathJax (pypi#12028)
Browse files Browse the repository at this point in the history
* chore(deps): upgrade readme-renderer

The latest release includes the necessary changes to render the HTML
correctly for RST with Math directives.

Refs: https://github.com/pypa/readme_renderer/releases/tag/36.0

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

* feat: include mathjax

Follows installation instructions from docs.
See https://docs.mathjax.org/en/latest/web/start.html#using-mathjax-from-a-content-delivery-network-cdn
Using the TeX+SVG variant to keep it lightweight.

Loads from a CDN with SRI hashes, and restricts the Content Security
Policy narrowly to prevent any other calls being made to anything
unrelated to the MathJax package.

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

* Revert "feat: include mathjax"

This reverts commit 642ce88.

* feat: include mathjax as vendored

MathJax 3.2.2

Files required for `tex-svg.js` to load and execute

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

* feat: include mathjax

Follows installation instructions from docs.
See https://docs.mathjax.org/en/latest/web/start.html#using-mathjax-from-a-content-delivery-network-cdn
Using the TeX+SVG variant to keep it lightweight.

Loads from a CDN with SRI hashes, and restricts the Content Security
Policy narrowly to prevent any other calls being made to anything
unrelated to the MathJax package.

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

* Revert "feat: include mathjax"

This reverts commit 642ce88.

* feat: include mathjax as vendored

MathJax 3.2.2

Files required for `tex-svg.js` to load and execute

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

Co-authored-by: Dustin Ingram <di@users.noreply.github.com>
  • Loading branch information
miketheman and di committed Aug 8, 2022
1 parent 563d911 commit 6dec6a6
Show file tree
Hide file tree
Showing 24 changed files with 1,777 additions and 1 deletion.
2 changes: 1 addition & 1 deletion requirements/main.in
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pyramid_services>=2.1
pyramid_tm>=0.12
python-slugify
PyJWT[crypto]>=2.3.0
readme-renderer[md]>=0.7.0
readme-renderer[md]>=36.0
requests
requests-aws4auth
redis>=2.8.0,<5.0.0
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/test_csp.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ def test_includeme():
"*.ethicalads.io",
"'sha256-2YHqZokjiizkHi1Zt+6ar0XJ0OeEy/egBnlm+MDMtrM='",
"'sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU='",
"'sha256-JLEjeN9e5dGsz5475WyRaoA4eQOdNPxDIeUhclnJDCE='",
"'sha256-mQyxHEuwZJqpxCw3SLmc4YOySNKXunyu2Oiz1r3/wAE='",
"'sha256-OCf+kv5Asiwp++8PIevKBYSgnNLNUZvxAp4a7wMLuKA='",
"'sha256-h5LOiLhk6wiJrGsG5ItM0KimwzWQH/yAcmoJDJL//bY='",
],
"worker-src": ["*.fastly-insights.com"],
}
Expand Down
5 changes: 5 additions & 0 deletions warehouse/csp.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ def includeme(config):
# Hashes for inline styles generated by v1.4.0 of ethicalads.min.js
"'sha256-2YHqZokjiizkHi1Zt+6ar0XJ0OeEy/egBnlm+MDMtrM='",
"'sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU='",
# Hashes for inline styles generated by v3.2.2 of MathJax tex-svg.js
"'sha256-JLEjeN9e5dGsz5475WyRaoA4eQOdNPxDIeUhclnJDCE='",
"'sha256-mQyxHEuwZJqpxCw3SLmc4YOySNKXunyu2Oiz1r3/wAE='",
"'sha256-OCf+kv5Asiwp++8PIevKBYSgnNLNUZvxAp4a7wMLuKA='",
"'sha256-h5LOiLhk6wiJrGsG5ItM0KimwzWQH/yAcmoJDJL//bY='",
],
"worker-src": ["*.fastly-insights.com"],
}
Expand Down
1 change: 1 addition & 0 deletions warehouse/static/js/vendor/mathjax/a11y/complexity.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions warehouse/static/js/vendor/mathjax/a11y/semantic-enrich.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions warehouse/static/js/vendor/mathjax/a11y/sre.js

Large diffs are not rendered by default.

0 comments on commit 6dec6a6

Please sign in to comment.