Linebreak within fences not working on page but in preview mode


i am unable to add linebreaks within fences with grav v1.7.18.

It shows in the preview mode from editor but not on page. Tried with different Themes like Typhoon (licensed), Antimatter and Quark. I tried also with adding two spaces after every line…

If its important, i run grav with builtin symfony webserver.


Edit Mode



Editor Preview Mode

Sample on Page

@sraue, I’m afraid I cannot reproduce the issue using the following:

  • Windows 10/WSL + Apache

  • Fresh install of Grav 1.7.18 + Admin

  • Content of page ‘Home’ in Admin

  • Result in browser (Chrome)

@pamtbaau thanks for the test.

I installed Nginx and switched the webserver. but the problem is the same…

@sraue, I’ve never heard that a webserver changes the HTML generated by a CMS… Except maybe zipping the HTML.

  • What’s the resulting HTML generated by the fenced code blocks?

the resulting HTML looks like

</header> <section id="body" class=""> <pre><code>apt-get update apt-get upgrade apt autoremove </code></pre> <h2>Test</h2> <pre><code>grunt.initConfig({ assemble: { options: { assets: 'docs/assets', data: 'src/data/*.{json,yml}', helpers: 'src/custom-helpers.js', partials: ['src/partials/**/*.{hbs,md}'] }, pages: { options: { layout: 'default.hbs' }, files: { './': ['src/templates/pages/index.hbs'] } } } };</code></pre> <h1>Say Hello to Grav!</h1>

whats odd too if i look at the HTML code, the whole page is only one line HTML code, is this normal?


According to the docs on MDN:

In the case of HTML, whitespace is largely ignored — whitespace in between words is treated as a single character, and whitespace at the start and end of elements and outside elements is ignored.

Except… inside <pre><code> blocks.

The <pre> HTML element represents preformatted text which is to be presented exactly as written in the HTML file. The text is typically rendered using a non-proportional, or "monospaced, font. Whitespace inside this element is displayed as written.

A single line of HTML code should therefor not present any issues, except for preformatted code blocks.

  • What is the css for code showing in the developer console of the browser? Some values like ‘initial’, ‘normal’, no-wrap’ will ignore newlines.
  • Are you using a HTML minifier of some sort?


Thanks for the help, i looked in the css files but not found anything you mentioned…

but i installed a new grav setup, this time from a tar.gz tarball and there it works. The old install was a setup from zip… not sure if it has anything todo with this… but for now it seems to work with the new setup…

oh… and btw, the HTML output if looking at the sources is now formated too and not a big single line without linebreaks like in the old setup… :thinking:

@sraue, Would you mind sharing the download urls for the zip and the tar.gz?


i used in my first (not working) install:
*1. from getgrav . org / downloads

in my second (working) testinstall:

on a third install i reinstalled grav from *1. again via the zip file and fresh, and there it is working now too…

so i think it has todo with plugins or themes i have tried in the meantime? i can try to install the plugins and themes like in my first install to reproduce the issue… if i can i will report back.