Marked: GFM code with syntax highlighting

Created on 2 Jul 2012  ·  10Comments  ·  Source: markedjs/marked

GitHub flavored markdown supports syntax highlighted code like this:

/* comment */
var s = "string", i = 123;
function foo () {
   for (var x in xs) {
      console.log(x, xs[x]);
   }
}

This is not supported by marked. It should either state this or (better) implement it.

Most helpful comment

I clearly started this trend, so I'll contribute to stopping it:

GitHub now supports emoji-reactions to Issue comments, which has become the de-facto standard for “voting” on Issues. If you want to +1 this, I suggest you click the :+1:-react on the OP; as this avoids sending an e-mail to everybody who's ever commented on this Issue (as this reply itself inevitably will! 😰)

All 10 comments

Synax highlighting _is_ already supported. Take a look at the highlight option. It works great in conjunction with highlight.js.

What TooTallNate said. Marked will never include its own syntax highlighter, but there are interfaces for using a highlighter with marked. See the readme.

Ok, but it does not support the syntax that triggers syntax highlighting:

``````

var x = "...";

``````

javascript lands in the output. It would be ok for me if the language parameter would just be stripped. And the shell app marked has no --highlight option.

:+1:

+1

+1

+1

+1

+1

I clearly started this trend, so I'll contribute to stopping it:

GitHub now supports emoji-reactions to Issue comments, which has become the de-facto standard for “voting” on Issues. If you want to +1 this, I suggest you click the :+1:-react on the OP; as this avoids sending an e-mail to everybody who's ever commented on this Issue (as this reply itself inevitably will! 😰)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thyxsl picture thyxsl  ·  4Comments

FireflyAndStars picture FireflyAndStars  ·  3Comments

james4388 picture james4388  ·  3Comments

elennaro picture elennaro  ·  4Comments

camwiegert picture camwiegert  ·  4Comments