Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Fenced backtick code highlighting using GFM #2709
So I've been fighting with Jekyll for a week now to get it to render my github wiki pages in a proper way on my github pages site.
The only markdown renderer that I have successfully got to render highlighted backtick code is
So what renderer am I supposed to use to get as close to the original github format as possible?
kramdown's GFM support seems broken, and redcarpet is somewhat picky and wants extra linebreaks before fenced backtick code, while github itself does not need that.
Apparently, github uses two different styles of markdown.
However, I'm unable to get any sort of highlighting to work with kramdown.
Live using kramdown: http://akkadotnet.github.io/wiki/The%20Obligatory%20Hello%20World
The example above is rendered as:
That is, no tokenization of the code inside, redcarpet with pygments applies all the css classes one would expect.
Also, whats up with the
referenced this issue
Aug 7, 2014
I found this SO answer:
So the short anser is:
In general our syntax highlighting needs a huge overhaul. We have Pygments and Rouge injected into places within Jekyll that would make Robert Louis Stevenson blush. It's an absolute mess. Most of our markdown converters find all the
I think the path going forward is to ask markdown libraries to give us some means to work with their internal AST's (or whatever it is they build) to manipulate the
We may be able to use HTML Pipeline to port GitHub's Markdown approach, but we'll need a bit of assistance from them to put it all together in a useful way.
Please correct me if I'm wrong (and I often am), if I understand you correctly, you're trying to share wiki pages from GitHub on a GitHub Pages site. Considering two different projects power the implementation behind the two different tools, I feel like you'll continually struggle with this.
Redcarpet is what will give you the closest approximation to GFM due to the fact that, for a time, it was the GFM renderer for GitHub itself. They've since switched to a more stripped down version of the same code base. If you're using some of the newer features of GFM (i.e. task lists), they won't work with any markdown renderer, as far as I know.
Nov 17, 2014
pushed a commit
Jan 3, 2015
I assume this issue is closed because it's not a Jekyll issue. There is no authoritative spec for Markdown. Github has their own extensions, and even renders the same input differently depending on if it's comments, files, gists, etc.
If you want more of these Github-specific extensions in a specific implementation then start a conversation for the relevant project. State what features you want to see, and if you plan to implement them yourself or not, and then ask if the project maintainers would accept such a pull request. If they do, then write the code, ask for feedback, incorporate that feedback, until the PR is merged.
If that's done and the changes are part of a new stable release, then you can consider coming back to Jekyll to suggest they update their dependencies. Until then +1-ing here will not make a difference.
Well, it's no problem to close a ticket and telling Jekyll wont support code fences.
But closing an issue without making really clear why, well, that confuses people and those will give +1's because the issue isn't fixed.
There is a spec for GFM AFAIK. So setting the input on GFM, should support the GFM features IMO.
It is not our job to work around the problems of a markdown processor, I know you would like that to be so but that is on the maintainer of that library. If you enable GFM in Kramdown and it doesn't work the way you expect, that is a bug in Kramdown, not in Jekyll. If you enable fenced code blocks (which you can if you read: https://github.com/jekyll/jekyll/tree/master/lib/jekyll/converters/markdown) and it doesn't work that is a problem with Redcarpet. There are clearly documented ways to work around this and if those ways do not work then that is a bug in Jekyll unless... it's because Redcarpet or Kramdown or the markdown library removed the feature or it's broken there but necromancing a ticket instead of checking the documentation and blaming us isn't going to solve the problem.
Please try to read the documentation and see if that works, if it does not then please file a ticket and we'll gladly debug the issue and let you know if it's an upstream problem.