Skip to content

Commit

Permalink
Add --math-output setting to use MathJax for rst
Browse files Browse the repository at this point in the history
  • Loading branch information
sumnerevans committed Nov 12, 2020
1 parent 7565cda commit e9a6516
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/content/en/content-management/formats.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ tool on your machine to be able to use these formats.
Hugo passes reasonable default arguments to these external helpers by default:

- `asciidoctor`: `--no-header-footer -`
- `rst2html`: `--leave-comments --initial-header-level=2`
- `rst2html`: `--leave-comments --initial-header-level=2 --syntax-highlight=short --math-output=MathJax`
- `pandoc`: `--mathjax`

{{% warning "Performance of External Helpers" %}}
Expand Down
8 changes: 6 additions & 2 deletions markup/rst/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,14 @@ func (c *rstConverter) getRstContent(src []byte, ctx converter.DocumentContext)
// handle Windows manually because it doesn't do shebangs
if runtime.GOOS == "windows" {
python := internal.GetPythonExecPath()
args := []string{path, "--leave-comments", "--initial-header-level=2"}
args := []string{path,
"--leave-comments", "--initial-header-level=2", "--syntax-highlight=short",
"--math-output", "MathJax https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js"}
result = internal.ExternallyRenderContent(c.cfg, ctx, src, python, args)
} else {
args := []string{"--leave-comments", "--initial-header-level=2"}
args := []string{
"--leave-comments", "--initial-header-level=2", "--syntax-highlight=short",
"--math-output", "MathJax https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js"}
result = internal.ExternallyRenderContent(c.cfg, ctx, src, path, args)
}
// TODO(bep) check if rst2html has a body only option.
Expand Down

0 comments on commit e9a6516

Please sign in to comment.