Search code examples
formattingredminewikicoderay

How to add line breaks to Redmine markdown in code highlighting?


The Redmine textile formatting guide directs us to use code highlighting like so:

<pre><code class="ruby">
  Place your code here.
</code></pre>

And while line breaks are preserved within <pre> tags, once I add the <code class="python">, it removes all line breaks and places all the text on a single line. And of course, hacks like &nbsp; (which answered this question) or html tags don't work because it's still wrapped inside <pre>.

I've tried wrapping each individual line with <code></code> all within one <pre></pre>, but that didn't work. I've tried adding double spaces to the end of each line, and additional new lines in between but to no avail.

And while the Redmine guide above says code highlighting relies on Rouge, my version of Redmine uses CodeRay, whose website examples handle line breaks perfectly.

Thanks in advance!


Solution

  • Things are working ok for me. See my screenshots. Perhaps your theme is affecting that.

    enter image description hereenter image description here

    I'm using Abacus office 1.3.4 theme on Redmine v3.2.

    Could any plugins that you have installed be causing that?