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

use marked / highlight.js instead of pagedown and prettify #3101

Merged
merged 7 commits into from May 2, 2013

Conversation

minrk
Copy link
Member

@minrk minrk commented Mar 28, 2013

This is an alternative markdown implementation,
which gives us (optionally) a few things:

  • GitHub-flavored markdown (triple-backtick, tables, etc.)
  • html sanitization

We 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.

@Carreau
Copy link
Member

Carreau commented Mar 28, 2013

That would be really neet, I'm just a little afraid of compatibility with pandoc in nbconvert.
Sure for html we could use node and subprocess, not sure for md -> Tex.

Nice think with highlight callback is we could define other things than highlight like rst environment...or math :-)
Is marked installable with Bower or equivalent ?

@minrk
Copy link
Member Author

minrk commented Mar 28, 2013

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.

@minrk
Copy link
Member Author

minrk commented Mar 31, 2013

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.

@ellisonbg
Copy link
Member

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.

@minrk
Copy link
Member Author

minrk commented Apr 13, 2013

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.

@ellisonbg
Copy link
Member

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

@minrk
Copy link
Member Author

minrk commented Apr 26, 2013

indeed it might, and perhaps we should switch to highlight.js as well.

@ellisonbg
Copy link
Member

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") }}"/>
Copy link
Member

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.

@ellisonbg
Copy link
Member

This syntax doesn't seem to work:

https://help.github.com/articles/github-flavored-markdown#newlines

Is this a config setting in marked?

@minrk
Copy link
Member Author

minrk commented May 2, 2013

yes, GitHub's annoying newlines is a config setting in marked, and off by default

@ellisonbg
Copy link
Member

Great work, merging!

ellisonbg added a commit that referenced this pull request May 2, 2013
use marked / highlight.js instead of pagedown and prettify
@ellisonbg ellisonbg merged commit 2d6f354 into ipython:master May 2, 2013
@minrk minrk deleted the marked branch March 31, 2014 23:36
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
use marked / highlight.js instead of pagedown and prettify
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.

None yet

3 participants