Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MathJax support, second attempt #114

Merged
merged 6 commits into from Sep 3, 2014

Conversation

Projects
None yet
3 participants
@jmendeth
Copy link
Member

jmendeth commented Aug 18, 2014

Based on #113. The differences are:

  • The interface now gives a displaymode boolean instead of the raw delimiters. The renderer must struggle with the process of escaping math code as appropiate.
  • When HOEDOWN_EXT_MATH_DOLLAR is not active, $$ math $$ inside a paragraph gets rendered inline instead of block.

@jmendeth jmendeth force-pushed the jmendeth:mathjax-2 branch from 999c6be to 1868710 Sep 1, 2014

@jmendeth

This comment has been minimized.

Copy link
Member Author

jmendeth commented Sep 1, 2014

  1. Okay, so now the extension guesses from the context. If the only contents in the parsed snippet are the math span (and optional spacing around it) then it's block. Otherwise, inline.

  2. There's a gotcha: it tests the snippet, not the whole block. So in edge cases like this one (with quotes enabled):

    There's some math here: "$$x$$"
    

    The quote extension will parse the quote span, and call parse_inline with the snippet $$x$$. Thus parse_math will render it as a block. In that case it has to be forced to inline:

    There's some math here: "\\(x\\)"
    
  3. I've renamed the additional flag to HOEDOWN_EXT_MATH_EXPLICIT. Why? Because that flag is incompatible in both ways (it screws existing documents when enabled, and when disabled). So I think the new name reflects that better.

@jmendeth

This comment has been minimized.

Copy link
Member Author

jmendeth commented Sep 1, 2014

Example:

Some $$inline$$ math here.

$$ block math $$

gives

<p>Some \(inline\) math here.</p>

<p>\[ block math \]</p>

But there's one missing thing: HTML renderer needs to escape delimiters. I don't know how to handle this.

@uranusjr how should snippets like: $$\[x\] = x$$ render?

@uranusjr

This comment has been minimized.

Copy link

uranusjr commented Sep 2, 2014

Using \[, \], \(, or \) inside a math block results in a syntax error in TeX, so IMO we can just treat it like an undefined behaviour and Blame The User™. I think it would be perfectly reasonable to simply do nothing and output \[\[x\] = x\].

@jmendeth

This comment has been minimized.

Copy link
Member Author

jmendeth commented Sep 2, 2014

Allright, then.

@jmendeth

This comment has been minimized.

Copy link
Member Author

jmendeth commented Sep 2, 2014

@devinus This is ready to merge for me.

devinus pushed a commit that referenced this pull request Sep 3, 2014

Devin Torres
Merge pull request #114 from jmendeth/mathjax-2
MathJax support, second attempt

@devinus devinus merged commit 7e5ba30 into hoedown:master Sep 3, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details

@jmendeth jmendeth deleted the jmendeth:mathjax-2 branch Sep 4, 2014

@commonsguy commonsguy referenced this pull request Oct 16, 2015

Closed

Math Equation #15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.