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

Highlight fenced code-block contents with Rouge #29

Merged
merged 1 commit into from Jun 17, 2019

Conversation

ashmaroli
Copy link
Member

Resolves #23

An adaptation of feature implemented downstream, this version however mirrors markup generated by Kramdown

I chose to go with a bundled class instead of adding a dependency on sandfoxme/commonmarker-rouge as suggested in #23

@DirtyF DirtyF requested a review from a team December 25, 2018 19:34
@ashmaroli ashmaroli requested a review from parkr February 13, 2019 16:40
@DirtyF DirtyF requested review from a team and removed request for parkr March 25, 2019 09:40
@DirtyF
Copy link
Member

DirtyF commented Jun 17, 2019

@jekyllbot: merge +minor

@jekyllbot jekyllbot merged commit 8325b4f into jekyll:master Jun 17, 2019
jekyllbot added a commit that referenced this pull request Jun 17, 2019
@ashmaroli ashmaroli deleted the highlighter-rouge branch June 19, 2019 13:55
@emmahsax
Copy link

emmahsax commented Jul 19, 2020

@ashmaroli Is there something specific we need to change in our _config.yml or code in order to use the rouge syntax highlighting automatically? I previously used rouge syntax highlighting with kramdown, but after switching to CommonMark, none of the syntax highlighting shows up. I verified that the rendered HTML code adds something like <code class="language-css"> to each fenced in code block. But, my rendered HTML doesn't add this:

<div class="highlighter-rouge"><div class="highlight">

and it doesn't add any of the fancy classes and divs in order for the highlighting to render.

Here's an example commit showing the difference, where red is with kramdown, properly syntax highlighting, and green is with jekyll-commonmark: https://github.com/emmasax4/emmasax4.info/commit/b2184d9239fcb0e575b7b3d89788db41a5a22080#diff-802a7b5f22c9df93171efa7ed928c2f5L224-R224.

image

@ashmaroli
Copy link
Member Author

@emmasax4 This patch has not been released yet. You need to point your Gemfile to the repository:

gem 'jekyll-commonmark', github: 'jekyll/jekyll-commanmark'

@emmahsax
Copy link

@ashmaroli Ah that was it! Thank you!

Sort of surprises of me, since it was merged over a year ago, but that worked! Thanks again for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rouge-specitic syntax highlighting does not work as expected
5 participants