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
prefer marked to pandoc for markdown2html #4655
Conversation
|
||
def markdown2html(source): | ||
def markdown2html_marked(source, encoding='utf-8'): | ||
"""Convert a markdown string to HTML via pandoc""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
via marked...
1 comment, still, we used to use python-markdown and removed it for uniformly using pandoc. Not that I am opposed to using marked. But it feel like a step forward for a step back. |
@Carreau - The difference here is that Python Markdown was independent of the parser that was used to present web pages. I think this might be a step sideways. |
It certainly is. We have a few choices:
Honestly, none of these are awesome. In some respects, bringing pandoc up to snuff via either plugins or patches is the most appealing. I think python-markdown is a no-go, with too many unsupported behaviors, unless we want to turn off the extensions in marked. |
I think it supports these via extensions. See this post for an explanation of how to get GFM. I think I've seen something similar for getting MathJax working as well. My biggest concern is that two different code paths will ultimately be untenable, and that we'll either need Python in the browser via a tool like Native Client, or we'll have to live with more Javascript at the command line. Pandoc is an awesome tool, but I don't see it in the browser any time soon. |
There's a list of extensions for python-markdown here. It includes tables and github style code blocks. Does that get us close to what's supported in the browser? There are also third party extensions, which include some math/latex tools. |
So I am not thrilled about the idea of have at least three markdown implementations to contend with, but it's worth considering if the right extensions can be brought to bear. Right now, I would consider python-markdown the least desirable of the three options. |
😳
and with extensions... 😒 Maybe to much cost? |
Just based on principle, I would rather use the same Markdown parser in both the live notebook and nbconvert, even if there are things it doesn't do correctly. Installing node is not too much more painful than pandoc - but we should definitely fall back on pandoc. All that to say, I am probably +1 on using marked in nbconvert. Extra bonus points if we could figure out how to call our own math add/remove code from node for nbconvert. |
better consistency with live notebook
required for reusing mathjaxutils in node
where navigator is undefined
now uses the exact same code as the live notebook
This now should use the full code, including mathjaxutils, that we use in the live notebook. Also, it uses our marked, not node's, so the only dependency should be node itself. |
Awesome. Let me know if I can help verify/test this. |
Travis is 😢, jeje... |
tests passing |
Merging soon, unless objections. |
OK, I read it again... it seems ready for me 👍 |
prefer marked to pandoc for markdown2html
prefer marked to pandoc for markdown2html
If node is installed, the exact same code will be used to render markdown2html as the live notebook.
Installing marked with npm is not required.