Line breaks, paragraphs and drupal input filters

One area in Drupal that has always tripped me up is the matter of line breaks, paragraph breaks and formatting.

The culprits here are the Line Break Converter, the HTML Filter and the HTML Corrector.

It is an issue I have always had to work my head around, but I think I am now getting the hang of it.

Wherever the Line Break Converter comes across a line of text ending without a <br /> it adds a <br /> to ensure that when the web browser displays the page, the following text starts on a new line.

When the text if followed by an empty line, it adds a <p> to create a paragraph break, so that web browser displays the following text after adding an empty line.

An observation I made is that if a a <br /> is followed by an empty line, the filtering removes it and converts it to a <p>.

It can get confusing.

Input Formats
==========

Input formats are an issue here as each input format can choose which html tags are stripped out by the html filter. So when you create a new input format it is important to select which html tags are allowed as well as which roles can use them. One really issue is when a user cannot edit an article, and there is no obvious reason why they can't. I once suffered terribly from this issue with Drupal 4.7, forget all about it until it caught me again in Drupal 6, mostly because I often edited my articles as admin until I needed to add more security.

A tool that helps figure it out is devel node access. It comes as a block with the http://drupal.org/project/devel module and has to be enabled and configured to display.

Related Pages
============
http://drupal.fckeditor.net/filters
http://www.lullabot.com/articles/drupal_input_formats_and_filters

0
Your rating: None

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <div> <h3> <h4> <h5> <h6> <br> <span>
  • Lines and paragraphs break automatically.
  • Flash node macros can be added to this post.
  • You may link to images on this site using a special syntax
  • Images can be added to this post.
  • You may use <swf file="song.mp3"> to display Flash files inline

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
By submitting this form, you accept the Mollom privacy policy.