I feel like this should be reaaaaaally simple, but it's driving me crazy.

I have 'plain text' selected for all my Body elements. I don't want anyone to be able to put in any html at all when filling out forms.

However, I do want the line breaks preserved. On the configuration page for plain there there is indeed a 'check this box to to turn line breaks into br and p, but no matter what I check or how I rearrange the weight of the filters, I cannot get it to preserve the breaks.

What is the correct configuration to get this to work so that I can preserve returns in the texts?

  • 1
    That is odd. I have the same setup and it works for me. Is this a clean install or an upgrade? Are you using a custom module, maybe doing some overwrites or something else?
    – Emil Orol
    Commented Aug 1, 2012 at 0:08
  • It did feel like a bug or like something was a bit out of place. What I figured was happening is that I could return br and p tags for line breaks, but then they were being filtered out to preserve true 'plain text' What do you have checked and what is the order of your filters?
    – blue928
    Commented Aug 1, 2012 at 5:22
  • I still have that issue with Plain text.I also have added <p> and <br> tags but no luck.Am I missing something??
    – Dion
    Commented Mar 8, 2014 at 11:18

9 Answers 9


Looks like a bug in Drupal core http://drupal.org/node/1019042


This seems like a Drupal 7.x bug. Changing the order of filters doesn't work in my case.

My short term solution was to throw this inside my theme's template.php (ref):

 * Implements template_preprocess_field().
function THEMENAME_preprocess_field(&$vars, $hook) {
  // Add line breaks to plain text textareas.
  if (
    // Make sure this is a text_long field type.
    $vars['element']['#field_type'] == 'text_long'
    // Check that the field's format is set to null, which equates to plain_text.
    && $vars['element']['#items'][0]['format'] == null
  ) {
    $vars['items'][0]['#markup'] = nl2br($vars['items'][0]['#markup']);

For fields in views, it's needed to set this option separately in the "Rewrite Results" section of the field settings.


Actually, it should work with this filters order setting at "admin/config/content/formats/plain_text"

  1. Display any HTML as plain text
  2. Convert URLs into links
  3. Convert line breaks into HTML (i.e. <br> and <p>)

Try the filters below by removing "Display any HTML as plain text":

  1. Limit allowed HTML tags ( set only <a> and <br> for allowed HTML tags list )
  2. Convert URLs into links
  3. Convert line breaks into HTML (i.e. <br> and <p>)
  • 2
    this will not work if the input format is not Filtered Text. Commented Aug 21, 2012 at 10:13

The solution is simple. Just display the plain-text content with following css.

white-space: pre-line;
  • 2
    Actually, white-space: pre-line; as mentioned on drupal.org/node/1095838#comment-6679314 is better.
    – Jeroen
    Commented Mar 31, 2016 at 14:37
  • Such an elegant solution.
    – sephiith
    Commented Jun 23, 2016 at 5:58
  • This does work, but only if you want to target each of your fields manually, or if all of your long-text fields need this done. If you have mixed "plain text" fields with other types of fields, and if you are using this with mpdf to make a PDF file, then only Druvision's solution works.
    – Richard
    Commented Feb 27, 2017 at 15:43

I used the Advanced Text Formatter module to quickly solve this problem without code.

  1. Install and enable the module.
  2. Click 'Manage Display' of your content type.
  3. Change the 'Plain Text' of your field's format to 'Advanced Text'
  4. Click the gear on the right (or a link to format settings)

    1. Set trim length to 0
    2. Set filter to 'Limit Allowed HTML tags'
    3. Remove all items from 'Allowed HTML tags'
    4. Check 'Converts line breaks into HTML'
    5. Click 'Update,' and Save your Field Display.

Format Settings of Advanced Text Formatter module to allow only line breaks


I don't think it's the input filtering: it's probably the display setting for the field. If it's set to "Plain text", change it to "Default". Otherwise the tags generated for the input line-breaks get stripped before the field is displayed.

For clarity, this is on the "Manage Display" panel for the content type in question. At Administration » Structure » Content type » MyContentType » Manage Display. Under the Format column for the field.


I don't think this a bug but the result of confusion (not helped by the way Drupal is set up) between a field with a "filtered text" input format set to "plain text" and a "plain text" field. If when you create your field you select "filtered text", the user will get the option to select from "plain text" and any other input formats available, and using the "plain text" option here when creating your content will render the line breaks and links out of the box. If however on field creation you select "plain text", no tags will be available/rendered at all, no matter how you configure the "plain text" input format. So before panicking that "plain text" doesn't work, first check in your content type setup that the field has "filtered text" selected. It's paradoxical and annoying, but, Drupal... ;)


"Plain Text format" as "Text processing"-method does NOT support any HTML-Tags, therefore line breaks don´t work normally.

Create a "text format" for "Filtered text (user selects text format)" and set the "Text format" to "Plain text".

  • 1
    What solved this for me was to change the field in the content type to "filtered text - user select" but then I made sure the user only had access to the plain text editor. Somehow that worked. If the user had access to other text editors this wouldn't be so nice.
    – Christia
    Commented Apr 18, 2019 at 17:29

This great module can help you https://drupal.org/project/wysiwyg_linebreaks

Wysiwyg Linebreaks allows users of wysiwyg editors to save and open markup from their website with linebreaks instead of <p> and <br /> tags.

Not the answer you're looking for? Browse other questions tagged or ask your own question.