"pre" tag not working as expected

This topic was created by User McUser .

  1. User McUser

    "pre" tag not working as expected

    Should not the "pre" tag preserve the spacing and carriage returns of the text inside it as-entered? As implemented right now it seems it only changes the font face to a monospaced one.

    Here's a test:

    Line one.

    Line two.

    1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9

    1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9

    The first two lines should be single spaced with one blank line between "Line two." and the first line of numerals.

    The first line of numerals has a single space character between each one and the second has two space characters between each one.

    EDIT: I see that when I edit my post after submitting it that the extra "linefeeds" are included in the comment editing box and the extra space characters have been discarded. So the issue would seem to be due to the parsing of the posts by the system when it no doubt sanitizes them against Johnny Droptable style chicanery.

  2. Marco Fontani

    Forums has always had automatic paragraphs for HTML comments, and when we started allowing HTML in comments we wanted to preserve that behaviour despite it maybe not doing the "right thing" in some contexts; this is one of them; a blockquote with multiple paragraphs is another.

    In fact, a simple pre tag with two lines inside it looks "weird enough". Thanks for the test case. I'll look into whether and how to disable auto-paragraphs inside the pre block, as that should likely do the trick.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon

Biting the hand that feeds IT © 1998–2020