Monday 17 October 2011

Line breaks in Drupal

If you're tearing your hair out trying to make Drupal keep line breaks and new paragraphs in the body of your Posts, Stories, etc. make sure Drupal itself isn't filtering out your <p> and <br /> tags.

* Go to Administer > Site configuration > Input formats
* For each one that you're using, in the Operations column click Configure
* Click Configure in the title line menu
* Go down to the Allowed HTML tags box and add the tags <p> and <br />

If you don't do this, even though your chosen WYSIWYG editor will happily add tags to your text, and even save them in the database, but Dupal will then filter them out again when displaying the page.