-
Notifications
You must be signed in to change notification settings - Fork 527
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
Add math blocks that render with MathJax #313
Comments
+1 |
If Kramdown and Pandoc support Latex math blocks that render with Mathjax, then it makes the most sense to use one of those libraries instead. I don't think we'll ever support this in Redcarpet. |
My motivation for opening the issue: I'd like to write maths on GitHub pages, which renders markdown with Redcarpet. |
And if you use Kramdown as your Markdown processor for your site, then you can do just that. 😃 |
@matt-hickford you can also use Kramdown on GitHub pages: http://cirosantilli.github.io/jekyll-cheat/#math |
@mattr- Im curious. What's the reasoning behind not supporting things like LaTeX (or TikZ rendering to SVG). Directing users to other parses is not, IMO, the best thing to do in cases like this. The situation is complicated by the fact that no one parser supports the full range of extensions. There are things users need from Redcarpet (e.g. GFM, footnotes, TOCs, etc) that others don't handle (or not well). And things Redcarpet doesn't handle. If there was a standard way to define extensions to markdown parsers, that would be easy. But there isn't that I'm aware of. |
@jbenet One problem with LaTeX is that it is large and cumbersome: 2.5Gb on a TeX Live full, compiles often fail, and it is probably hard to evaluate security issues, and Redcarpet seems to focus on safe Server Side compilation of user input content. About the extension, do you mean a built-in to define extensions in Redcarpet, on in other parsers in general? Kramdown has a standard extension syntax of |
@cirosantilli Yeah, i don't mean ship a latex extension by default, or force users to install it as a dependency. But it should be possible. Perhaps can define a custom extensions notion that is understood to be unsafe (i.e. don't throw untrusted markdown into it). On exts, I mean specifically that it should be possible for an extension to be plugged into all available parsers (common formats or bindings, either way). Also, perhaps I'm missing it, but I don't see flexible redcarpet extension support. Sure, ugly, perhaps a better one can be defined, and others convinced. All i'm saying is: users shouldn't have to choose between N parsers where no parser allows them to have the set of features they want. |
I agree with all you said: just playing devil's advocate =) |
But kramdown doesn't render via latex either, only client-side MathJax (which is a bit heavy, but feasible, and is not a dependency of the converter - just output a one-line CDN link in the output). |
👍 |
@mattr- Using client-side MathJax, this would be a valuable addition. Redcarpet cannot pretend to rule out the competition if it cannot pass LaTeX blocks to the JavaScript MathJax parser. |
This is not really a question of ruling out the competition here but what we do want or do not want to provide in Redcarpet. At the moment, other tools provide extra features that we don't support as this would make the maintenance harder plus we want Redcarpet to be easy-to-use and fast. The more we add features, the more we have to track bugs and the more people want to mix features together. Markdown doesn't aim at superseding HTML. Moreover, we can't reinvent the wheel every time and more importantly, we can't provide support for every use-cases. Generally, if you are writing documents for a specific domain, there is a mark-up for that (e.g. LaTeX for science, Ascii doc for books). If you really want to use Markdown, there are alternatives such as MultiMarkdown or Pandoc. Thanks anyway for your comments ! :-) |
To be clear all that's needed to properly support latex using MathJax is for the parser to recognize $$ or \[ \] delimited blocks and \( \) delimited spans and leave them alone (if you wanted to get really fancy you might add spaces after < and before > in those spans/blocks too but that's it). MathJax itself is happy to do all the heavy lifting to locate and parse the latex the problem is just that latex math uses symbols that redcarpet will think are markdown elements and mess it up. If this doesn't already exist it shouldn't be too hard to add. When I get to the point where I start running into this problem in my project I'll see if I can put together a pull request to do it but I felt I should mention right now that it doesn't require mucking about with parsing latex or anything but passing through certain delimited regions unaltered. So it doesn't add a new heavyduty feature and it's a common use case. |
Pandoc and Kramdown support Tex/Latex math blocks that render using Mathjax. It would be nice if Redcarpet did too.
See the Kramdown documentation http://kramdown.rubyforge.org/syntax.html#math-blocks for the syntax and an example. See also the Pandoc documentation http://johnmacfarlane.net/pandoc/README.html#math
The text was updated successfully, but these errors were encountered: