Skip to content

Add Math support (MathJaX) to blackfriday.v2 - #412

Open
Vonng wants to merge 2 commits into
russross:v2from
Vonng:v2
Open

Vonng wants to merge 2 commits into
russross:v2from
Vonng:v2

Conversation

@Vonng

@Vonng Vonng commented Nov 29, 2017

Copy link
Copy Markdown

Add Math support (MathJaX) to blackfriday.v2

  • LaTeX math equation quoted by $, $$ now can be rendered properly. Compatible with many markdown editor.
  • Markdown subscript hyphen _ won't break subscript in LaTeX anymore.
  • Enable MathJaX extension with additional Extension Flag blackfriday.MathJaxSupport

@kaushalmodi

kaushalmodi commented Nov 29, 2017 •

Copy link
Copy Markdown

Thanks!

Would this also take care of this issue: #411?

smartParens should be auto disabled inside equations so that (r), (c), etc. do not get inferred to registered trademark, copyright, etc. symbols.

@Vonng

Vonng commented Nov 30, 2017

Copy link
Copy Markdown
Author

@kaushalmodi

of course. Since smartypants render only enabled when processing Text nodes. It will have no effect on inlineMath or blockMath nodes.

The following example rendered properly with this PR under default configuration (+MathJaX)

$$
(r)(x)
$$

@kaushalmodi

Copy link
Copy Markdown

@rtfb Can you please look at this PR?

@martignoni

Copy link
Copy Markdown

This would be a big improvement as you have to disable completely Blackfriday to prevent wrong interpretations in math environments.

@rtfb

rtfb commented Aug 30, 2018

Copy link
Copy Markdown
Collaborator

I would like to not merge any changes that significantly change the way a source document is interpreted until we have CommonMark support (meaning that we can exercise their very exhaustive set of test cases, in addition to ours).

There is another very similar PR: #288. There's some extensive discussion on it about ideas how a math extension could be implemented without altering the semantics of a source Markdown document. The gist is that MathJaX support could be added completely outside of Blackfriday core, as a drop-in renderer that does two custom things:

  1. Add support for mathjax fenced code block language specifier, and pipe the code block through whatever processing is needed (akin to bfchroma extension for code syntax-coloring).
  2. In a similar fashion, override the behavior of the inline code span, and if it happens to be wrapped with $ signs, do the same as above.

Since the above seems to be a viable idea, I'm doubly reluctant to merge this functionality into Blackfriday core without seeing it tried out (or at least discussed in more detail if others don't see it as viable as I do).

@Eisfunke

Eisfunke commented Sep 3, 2018 •

Copy link
Copy Markdown

FYI: the simple $formula$/$$formula$$ syntax is used by Pandoc, as described in the manual: http://pandoc.org/MANUAL.html#math

It might be a good idea to stick to that somewhat established syntax.

@Eisfunke Eisfunke mentioned this pull request Sep 3, 2018
2 of 7 tasks
@entron

entron commented Oct 26, 2018

Copy link
Copy Markdown

Really hope this change can be merged soon!

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.

6 participants