Skip to content

Pass through math code as plain text rather than wrapping in <mathjax> elements#10

Merged
mayoff merged 2 commits into
mayoff:masterfrom
Reedbeta:master
Oct 5, 2016
Merged

Pass through math code as plain text rather than wrapping in <mathjax> elements#10
mayoff merged 2 commits into
mayoff:masterfrom
Reedbeta:master

Conversation

@Reedbeta

@Reedbeta Reedbeta commented Oct 5, 2016

Copy link
Copy Markdown
Contributor

Allows MathJax code to pass straight through to the output without wrapping an HTML element around it. Just a bit cleaner.

This uses the markdown module's "HTML stash" system to store the string so it doesn't get any additional Markdown processing applied. The <, >, and & characters are still translated to entities.

Here it is in action:

>>> import markdown, mdx_mathjax
>>> md = markdown.Markdown(extensions=[mdx_mathjax.MathJaxExtension()])
>>> print(md.convert('Hello, world! Here is some math: ${a}_b < c_{d}$'))
<p>Hello, world! Here is some math: ${a}_b &lt; c_{d}$</p>

@mayoff mayoff merged commit 6d62371 into mayoff:master Oct 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants