-
Notifications
You must be signed in to change notification settings - Fork 598
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
Code highlighting #10
Comments
I think there should be a branch for the next version of blackfriday that 1) supports weekly, and 2) follow the steps of Sundown (evolved from original Upskirt) -> https://github.com/tanoku/sundown Sundown actually broke the way most markdown processors work exactly to achieve what this issue is all about. It is now what powers Github's syntax highlighting is pretty efficient and allows for multiple outputs by pipelining the rendering. Blackfriday is amazing, but it would be more awesome if it stays current with Sundown/Redcarpet (Ruby interface to the Sundown library by Github). |
I hacked up Blackfriday to do syntax highlighting by introducing a callback for processing Github-style code blocks. You can see my changes over on my fork. My method is pretty hacky and I'm not happy with it as a general solution, so I'm not going to open a pull request for it. Ideally, I think you'd be able to take the existing HTML renderer and selectively override certain functions. This is the way that Redcarpet does it and it works really well. (By the way, you can see how I hooked up |
👍 for a future server side highlight :) |
The It uses these Go packages for performing server-side highlighting:
I think it's out of scope for |
I see the complete html page example here https://godoc.org/github.com/shurcooL/github_flavored_markdown#example-Markdown--CompleteHtmlPage but doesn't that rely on non existing |
Yes, a .css with a highlighting scheme is needed. GitHub API provides a Markdown rendering endpoint, but it also seems to expect you to bring .css yourself. Edit in 2017: The CSS for GitHub-Flavored Markdown highlighting is now available at https://github.com/primer/primer-css/tree/master/modules/primer-markdown. |
@alecthomas created a nice library https://github.com/alecthomas/chroma It remains only to make the integration. |
As shown in #396 I finally came up with this : https://github.com/Depado/bfchroma |
Chroma is a general purpose code highlighting library, and bfchroma provides an easy to use glue layer for Blackfriday to interface with Chroma. Fixes #10.
Chroma is a general purpose code highlighting library, and bfchroma provides an easy to use glue layer for Blackfriday to interface with Chroma. Fixes #10.
Chroma is a general purpose code highlighting library, and bfchroma provides an easy to use glue layer for Blackfriday to interface with Chroma. Fixes russross#10.
It would be nice to be able to highlight code on server-side instead of doing that on client-side (right now I'm thinking about HTML and not Latex output). I see two possibilities here:
I believe that latter is better option both API- and performance-wise. Do you have any thoughts/opinion about this?
The text was updated successfully, but these errors were encountered: