code block not formatting properly

Permalink
I am working on a blog post in Concrete5, and I need to place a bunch of C# code in a code block. When I use the HTML editor and place the block <pre> MY CODE HERE </pre>, the preview shows everything is fine. However, once I visit the page, all of the block spacing and new lines disappears, showing the code in one long line.
(see attached screenshots for examples)

Anyone know how to insert code blocks using the HTML editor for blog posts?

3 Attachments

 
JohntheFish replied on at Permalink Reply
JohntheFish
I expect your theme is doing something with the way pre tags wrap lines. Maybe an over-zealous reset. Some ideas:

- Look at the code segment in the browser developer console to find out what the theme is doing, then undo it within the <pre> tag. Most likely white-space: pre-wrap;

- Add a <code> tag inside the <pre> tag. Your theme may have correct formatting for <pre><code>

- If you write about code a lot, have a look at my Syntax Anywhere addon.http://www.concrete5.org/marketplace/addons/syntax-anywhere1/...