Forum

Thread tagged as: Question, Problem, Field-Types

Line Break in Text Blocks

Hi there,

as I'm setting up Perch as a CMS back end for an existing homepage I want to keep as close to the original formatting as possible. When I create a Text Block and entering a line break perch doesn't do anything even though, in my understanding, it should be translated to a <br>.

When I do a paragraph with an empty line in between two lines of text, then it translates properly to <p>.

How can I reach a simple line break that would be <br> in HTML?

Best, Arne

Arne Spremberg

Arne Spremberg 0 points

  • 3 years ago

I believe it depends on the editor markup you're using for the text block. If its Textile, then a line break becomes a <br /> as you expect, in the HTML. If its Markdown then I think you need a couple of spaces before the line break to make a <br /> appear in the HTML.

Thanks for the quick reply - maybe that's kind of a newbie question now but where can I define the markup I use?

Taking the sample text_block.html supplied with the Perch install, it reads like this ...

<perch:content id="text" type="textarea" label="Text" markdown editor="simplemde" imagewidth="640" imageheight="480">

You just change the word markdown to textile. But be aware that if you've already got a lot of regions using that text_block.html content template, you'll be switching them all to textile and they will probably not look correct. You may have to edit them all again.

For a long time, textile was the default and then it switched to markdown. We found customers preferred textile, so we've stuck with that on all our Perch installs. When we started using Perch we used the supplied templates most of the time and had lots of regions. Now we have less regions (sometimes just one) and write our own templates and extensively use <blocks>. But we still code all textareas with textile.

Thanks a lot, Graham!

I'll try out textile, but might install CKEditor for maximized functionality...

I think that, regardless of the editor you use, you still need to pick the right markup language.