# Inline code broken with Rouge and line numbers #286

Closed
opened this Issue Sep 24, 2015 · 5 comments

Projects
None yet
3 participants

### reitzig commented Sep 24, 2015

 I use kramdown with Rouge in my Jekyll site. I notice that kramdown compiles inline code to inline code instead of simply .... While it would be nice to be able to turn off highlighting in inline code, no biggy. When I set line_numbers: true, however, things get ugly: Rouge can or does not distinguish between inline and block code, and translates the inline code into a block with line numbers -- clearly not as intended! (The created code looks broken beyond that, too.)

Owner

### gettalong commented Sep 26, 2015

 Thanks for reporting this! To mitigate the problem I have implemented the following changes: Globally enabling rouge as syntax highlighter and disabling span and/or block highlighting is now possible by using the new "disable" option. Options can now be set for both spans and blocks as well as only for spans or only for blocks. This enables you to turn on the line numbers for blocks but not for spans.

### reitzig added a commit to reitzig/reitzig.github.io that referenced this issue Sep 28, 2015

 A multitude of tweaks and fixes. 
 * Turns off line numbers in code for now;
cf. gettalong/kramdown#286
* Changes feed.xml to show only an excerpt;
MathJax and tricky don't work there.
* Introduces a plugin that nicely typsets (La)TeX.
* Fixes some abstracts in the .bib file to compile properly.
* Changes bibliography details template so that Markdown in
abstracts is compiled.
* Adds a page option for enabling MathJax.
* Adds tags next to date for posts; printing of this moved to
a plugin for reusability.
* marginnote plugin was missing a space.
* Changes syntax highlighting CSS so it works with
and without line numbers.
* Adds styling of <hr> in articles.
* Fixes weird font in sidenotes, and line height in
side- and marginnote both.
* Footnotes now indent a bit, and break similarly to the rest
of the page.
 154c86c 

### gettalong added a commit that referenced this issue Oct 2, 2015

 Enhanced rouge syntax highlighter to allow separate span/block options 
Fixes #286
 6ecd168 

### tdbe commented Nov 18, 2016 • edited

 using the new "disable" option Options can now be set for both spans and blocks as well as only for spans or only for blocks Could you please provide a usage example of what that syntax looks like in the _config.yml file? All I understood is that you now have that capability and flexibility. But how exactly do I fix the inline code while having line_numbers: true on the code blocks?
Owner

### gettalong commented Nov 18, 2016

 kramdown doesn't have a _config.yml file. You need to use the 'syntax_highligher_opts' configuration option as described on the documentation page for the rouge syntax highlighter. Where you set this option depends on how use kramdown, e.g. if you are using the binary, you would do something like the following: kramdown --syntax-highlighter rouge --syntax-highlighter-opts "{span: {disable: true}}" 

### tdbe commented Nov 18, 2016 • edited

 Oh I see where you're coming from but I was referring to the OP's context, ie using Jekyll with github's builtin markdown compilers. But thanks for the docs links. [UPDATE] For future reference, I found the solution for what you need to write in your _config.yml file for Github + Jekyll + Rouge: kramdown: input: GFM # https://github.com/jekyll/jekyll/pull/4090 syntax_highlighter: rouge # Rouge Highlighter in Kramdown › http://kramdown.gettalong.org/syntax_highlighter/rouge.html # span, block element options fall back to global syntax_highlighter_opts: # Rouge Options › https://github.com/jneen/rouge#full-options css_class: 'highlight' #line_numbers: true # bad idea, spans don't need linenos and would inherit this option span: line_numbers: false block: line_numbers: true start_line: 1 
Owner