When adding a comment, or writing a new node, I want Drupal to respect whitespace.
Like... if I press return a couple of times I want the output to have the corresponding space between the lines.

Is it possible to do this? I've tried to change the input-filter without any luck...

Comments

roxy317’s picture

In SITE CONFIGURATION=>INPUT FILTER you need to "configure" the input type you are using. Make sure you have "Line break converter" selected under filters. That should solve the problem.

Roxy

NeoID’s picture

It is turned on... Do I have to update the list of allowed html tags maybe?

groenm’s picture

The only easy way to have this done, is enclose the comment in <pre>-tags. Your problem is that the HTML standard requires HTML-renderers to contract spureous whitespace. The only exception is the <pre>-tag for preformatted text. Usually browsers display text in <pre>-tags with a monospaced font, although this can be addressed through CSS.

If you don't want your users to enter the <pre>-tags, you should modify your template files.

Mark

NeoID’s picture

Wow.. I didn't know that... thanks for the info!
What's the easiest way of wrapping the comment-form with pre-tags?

NeoID’s picture

I just noticed that this method breaks the smiley module, they are not longer rendered as they should... :<

groenm’s picture

I can imagine smileys don't work anymore. Nor any other kind of formatting. The idea of the <pre>-tag is that you use "ascii-formatting".

If you want to get around using the <pre>-tag, your users can use the <br> to force a line break in normal HTML. However, the have to enter the <br>-tag themselves.

Alternatively, you might want to write your own input filter that replaces every line break the user enters with a <br>-tag. That will probably be the most user friendly solution.

EDIT: Or maybe this module can help you do what you want: http://drupal.org/project/customfilter It allows you to define your own filter rules with regular expressions. I guess you will be able to replace line ends with <br>-tags (or at least insert <br>-tags.

Mark

groenm’s picture

The markup of comments is done in the template file comment.tpl.php in your theme.

Mark