Skip to content

Commit

Permalink
Merge pull request #54 from juanolon/mathjax-fix
Browse files Browse the repository at this point in the history
fix mathjax extension
  • Loading branch information
emad-elsaid committed Jun 8, 2024
2 parents 286adfa + 7b0c9c3 commit c4d3ad9
Show file tree
Hide file tree
Showing 26 changed files with 45 additions and 3 deletions.
1 change: 0 additions & 1 deletion extensions/mathjax/js/mathjax.js

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
34 changes: 34 additions & 0 deletions extensions/mathjax/js/tex-chtml-full.js

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions extensions/mathjax/renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,20 @@ import (
//go:embed js
var js embed.FS

const script = `<script async src="/js/mathjax.js"></script>`
const script = `
<script>
MathJax = {
tex: {
displayMath: [['$$', '$$'], ['\\[', '\\]']],
inlineMath: [['$', '$'], ['\\(', '\\)']]
},
svg: {fontCache: 'global'}
};
</script>
<script type="text/javascript" src="/js/tex-chtml-full.js" async></script>`

func init() {
RegisterStaticDir(js)
RegisterBuildPage("/js/mathjax.js", false)
MarkDownRenderer.Renderer().AddOptions(renderer.WithNodeRenderers(
util.Prioritized(&InlineMathRenderer{startDelim: `\(`, endDelim: `\)`}, 0),
util.Prioritized(&MathBlockRenderer{startDelim: `\[`, endDelim: `\]`}, 0),
Expand Down

0 comments on commit c4d3ad9

Please sign in to comment.