-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
use marked / highlight.js instead of pagedown and prettify #3101
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
Conversation
That would be really neet, I'm just a little afraid of compatibility with pandoc in nbconvert. Nice think with highlight callback is we could define other things than highlight like rst environment...or math :-) |
Yes, marked is installable with bower / npm / etc. pandoc (≥ 1.10, I believe, I have 1.11, and I know it doesn't work with 1.9) actually supports both the triple-backtick and GFM table syntax, so I'm not sure there's an issue, other than a minimum version requirement. |
One thing we might want to consider is explicitly handling the triple-backtick language spec - as it is now, prettify is still handling the highlighting, and I do not believe that it takes into account the markup supplied by marked (css class of pre tag includes language name), so prettify is still doing autodetection based on content. |
What type of sanitization does this do. The previous markdown library had a pretty decent sanitizer that would allow us to white/black list certain html tags for cleaning. It also make sure that there weren't unclosed tags that would bork the entire page. We were using that sanitizer, but I was planning on enabling it to deal with the security issues we are having in the md cells. But I am strongly +1 on moving to GFM. |
Having looked at it, the marked sanitization isn't particularly useful. basically what it does is prohibit literal HTML, which isn't going to fly. We need to define our sanitization, since it seems like we want to do different things to most sanitizers. |
The code here is really simple and I like it. I would like to play around with it a bit more. But I do think we should try to get prettify properly integrated with the marked syntax highlighting callbacks before merging. Might be trivial: http://stackoverflow.com/questions/11449837/how-to-let-marked-and-google-code-prettify-work-together |
indeed it might, and perhaps we should switch to highlight.js as well. |
Let's have a look at it to see if highlight.js is better supported or has more features. This stuff is pretty simple for us to use, so we should just use the best thing we can. |
@@ -12,9 +12,6 @@ | |||
</script> | |||
|
|||
<link rel="stylesheet" href="{{ static_url("components/codemirror/lib/codemirror.css") }}"> | |||
<link rel="stylesheet" href="{{ static_url("css/codemirror-ipython.css") }}"> | |||
|
|||
<link rel="stylesheet" href="{{ static_url("prettify/prettify.css") }}"/> |
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.
Get got the prettify css, but missed the js below.
This syntax doesn't seem to work: https://help.github.com/articles/github-flavored-markdown#newlines Is this a config setting in marked? |
yes, GitHub's annoying newlines is a config setting in marked, and off by default |
Great work, merging! |
use marked / highlight.js instead of pagedown and prettify
use marked / highlight.js instead of pagedown and prettify
This is an alternative markdown implementation,
which gives us (optionally) a few things:
html sanitizationWe need to think very carefully about whether we want to define the notebook markdown as GHM,
as opposed to vanilla markdown, but even if we turn of GHM support (I hope we don't),
marked's sanitization may still be valuable.