• (nodebb)

    you, our dear readers, who instead get a sometimes confounding Markdown comment box with bad editing support

    I wonder whose fault that confoundingness and bad editing support might be. Any suggestions?

  • Vera (unregistered)

    If using a monospaced font for pre tags is a bad default, what would be a better default? Just whatever font the parent tag was using?

  • (author) in reply to Steve_The_Cynic

    Bad editing, I will say, is a conscious choice. There are other design options that could have been taken, but once you post, you've posted. You can add to it, but it's part of your "permanent record".

    I'm not 100% certain why we went with Markdown in the comments (I may or may not have had something to do with it- hard to remember), but I will say I'm the one who has fought against any WYSIWYG editors- back in the ancient days, the article editor had that and I loathed it.

  • (author) in reply to Vera

    I would say so, yeah. pre is an instruction about how white space should be handled, it says "white space is significant in this section". There's no reason to have it do anything else, by default.

  • Smithers (unregistered)

    a quirk I've seen on a depressing number of other sites: make pre content be in monospace.

    As is already the default in the 3 browsers I've just tried and so probably every major browser. What's "depressing" about a site wanting to make sure on the other 1%?

    pre tells us the text is preformatted and things like extra whitespace and line breaks should be respected.

    Part of the preformatting is knowing how wide that extra whitespace is so it can be used to align things. Without a monospaced font, preserving the exact number of spaces is meaningless. The HTML standard itself even includes a poetry example that requires monospace to align a word in one line with a blank in the previous.

  • Canthros (unregistered)

    Obvious solution is to resurrect the old TT tag.

  • (nodebb) in reply to Remy Porter

    Any particular reason the markdown support is so bad? If you inspect my comment here you can see that it picked up that I used a list in markdown. As a commenter I have no clue what my comment will look like. https://thedailywtf.com/articles/comments/all-docked-up#comment-692971

  • (author) in reply to miniragnarok

    So, one of the stylesheets that got erased was the list elements. But they never got rebuilt. So no lists. If I use one in an article, I have to add an inline stylesheet. That's one I should really actually fix.

  • RLB (unregistered)

    The reason why pre tags are usually rendeered monospace is quite obvious from the examples on the MDN page for that tag.

  • 516052 (unregistered) in reply to Remy Porter

    Why? I am genuinely curious. Text editors with WYSIWYG are infinitely more usable than markdown. Especially markdown without so much as a set of buttons to automatically insert what you want. As evidenced by the fact that almost nobody in the comments here uses it.

    So I do have to ask why you would be against such a system.

  • (nodebb)

    "Everybody's talkin' bout the new cascading style sheets but it's still SGML to me."

    Apologies to Mr. Joel.

  • Vilx- (unregistered)

    The "semanticity" is one thing I still hate about HTML after all these years. In my (not very humble) opinion, HTML should define functionality, CSS should deal with presentation, and semantics should be added with a third, not yet existing standard, as more attributes on tags. So, in other words, we shouldn't have all the div/span/p/b/i/u/menu/head/nav/table/tr/etc tags - they should all be a single "block" tag that gets styled and semanticised as necessary. In addition to that we should have the a/input/select/button/script/style/link tags because they each add additional functionality that cannot be emulated via other tags. And I probably missed a few others.

    But the current semantic-functional tag soup is just plain wrong.

    There, I said it.

  • Vilx- (unregistered) in reply to 516052

    It would be nice if it said "Markdown supported" somewhere around here. Then more people realize that they can use it. I too prefer Markdown over WYSIWYG, because I find WYSIWYG to be as finicky as a Word document. Breathe on it the wrong way and everything collapses and you need to figure out just which pixel you need to click to put the cursor on exactly the right place to delete some invisible marker and get things back on track...

    However I also understand that some people don't care for learning the Markdown syntax, so a WYSIWYG has its place in the world too.

  • Rob (unregistered)

    This is what https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/pre says:

    The

     HTML element represents preformatted text which is to be presented exactly as written in the HTML file. The text is typically rendered using a non-proportional, or monospaced font.

    This matches what https://www.w3.org/MarkUp/html-spec/Elements/PRE.html says:

    Preformatted elements in HTML are displayed with text in a fixed width font, and so are suitable for text which has been formatted for a teletype by some existing formatting system.

    https://html.spec.whatwg.org/#the-pre-element is less clear, and suggests to use the combination:

    To represent a block of computer code, the pre element can be used with a code element; to represent a block of computer output the pre element can be used with a samp element. Similarly, the kbd element can be used within a pre element to indicate text that the user is to enter.

    So I'd do what I've always done: combine the two.

  • (nodebb)

    This is one place where I think Gitlab excels. I still usually choose a markdown editor with a preview over WYSIWIG, but the "Rich Text Editing" mode Gitlab added a few versions back - complete with the ability to toggle back and forth - is actually pretty good.

    I'm not sure it handles Gitlab-specific references as well as I'd like (I've usually switched back to markdown mode before I would find out), and I have a tendency to forget I'm using it and try to write Markdown syntax to paste a link into and then have to go back and fix it because it tried to escape the Markdown and make the URL a link for me, but other than that it's pretty good.

    Discourse has an editor with buttons and keyboard shortcuts and a live preview that arguably works even better, but unfortunately it comes with the rest of Discourse attached to it.

    Addendum 2026-03-26 10:30: On a note concerning the actual article: I kinda see the other side of things here, but I'm mostly with Smithers. Even if it's not code, I default so heavily to the assumption that my formatting will be preserved including the width of the whitespace that...I'm that annoying guy who composes emails in Lucida Console by default.

  • 516052 (unregistered) in reply to Vilx-

    Every decent WYSIWYG editor I ever used always had the option to switch from WYSIWIG to showing all the tags and back again with a single button. I used to post on old BBCode forums over 20 years ago that had that feature. So while I understand your concern in principal this is kind of a solved problem and has been for decades now.

    Speaking of, I genuinely find BBCodes syntax to be superior to markdown. It works like HTML tags with an open and close tag which makes working with it much more pleasant AND all the common commands like bold [b], italic [i] etc. are all the same as in HTML so you don't need to learn a whole new language like you do with markdown assuming you have even a passing knowledge of HTML.

    Still, I'd settle for at least a toolbar with the basic options like bold, quote etc. that I can click to auto insert them into the text.

  • Foo AKA Fooo (unregistered) in reply to Vilx-

    It would be nice if it said "Markdown supported" somewhere around here.

    Been saying this for years. And please link to a syntax overview (for the actual markdown variant used here, whichever this may be). Unnecessary because everyone knows it? Well, I certainly don't, and I'm not gonna Google every time I want to format something, so I just don't, so I won't learn it. Vicious circle, but so easy to fix.

  • Alex Vincent (unregistered)

    Parsing HTML with regular expressions... when will we ever learn?

    https://blog.codinghorror.com/parsing-html-the-cthulhu-way/

  • (nodebb)

    at this point I'm tempted to put a huge raft of markdown formatted text in here just to see what happens.

    If you support markdown in comments, please put some indication in the web page - like in the pane we get when we're about to post a comment.

    Otherwise it's just something that's reserved for those who know and completely inexplicable to those who don't. And it's probably just a couple of lines to add 'Markdown supported' (and possibly a reference to the type of markdown because there are at least 3)

  • t (unregistered)

    I think people think of preformatted text as stuff like, notepad tables. Where stuff is arranged into columns with tabs and white space

    Kinda needs monospace to work

  • Your Name (unregistered)

    A big thanks for leaving enter to return a normal single line break. Newer forums tend to modify their editor to be more word processor like. Enter inserts a double line break, and Shift-Enter the normal one. This is highly irritating, so I'm glad it's not this way here.

    A commenting section is not a word processor.

  • 516052 (unregistered)

    Speaking of markdown I could honestly go on a rant about how much I dislike it. The whole syntax is basically a bunch of random looking symbols that you need to memorize all of which have no actual relation to the thing they do (why does * italicize things, except when it does not????) And it often interferes with actually writing text. It's as bad as the special characters in a C string.

  • (nodebb) in reply to Your Name

    Enter inserts a double line break, and Shift-Enter the normal one.

    Usually, Enter inserts a paragraph break, and Shift-Enter inserts a line break.

    Paragraph formatting won't cross a paragraph break, duh, but it will cross a line break.

  • (nodebb) in reply to Remy Porter

    Bad editing, I will say, is a conscious choice

    The intention of my double modifier was "bad support of editing", not "support of bad editing".

  • Twither (unregistered)

    HTML is a DATA format not a PRESENTATION format

    This is a wonderfully beautiful theory that fails the moment it touches the real world. You want a link on your page? Fine, a link is just data. What about a button? Or, dare I say, a textbox? That's not data, that's interaction. We have no choice but to place it in the html. But where? As soon as we make a choice, we have committed to certain layout restrictions, which makes html a layout format as well as a data format, and the whole theory has fallen apart.

  • A Human (unregistered) in reply to 516052

    No. BBCode is absolutely horrible.

    It looks like a random pile of tags and attributes (because it's basically a very aggressive html sanitizer), It doesn't separate content from presentation (the standard contains horrible tags like color, style, and size), basic things like headings are not standardized, and the list syntax is horrid. It even has stupid inconsistencies like putting the address of a link in either an attribute or the body of the url tag depending on whether you want to change the display text.

    Markdown beats it in almost every way, with syntax that is concise, human readable (it gets the point across even when looking at the syntax itself) and mostly consistent, all the basic formatting options are standardized, and the only real thing that sucks about it is that some extensions, like latex math, em and en dashes, and image size control are not as common as they should be.

  • mirabilos (unregistered)

    <pre> has always been in monospace; præformatted implies precisely that. Monospace has nothing to do with code. <code> is purely semantical and does NOT imply monospaced font.

  • 516052 (unregistered) in reply to A Human

    I would heavily disagree with you on markdown being anything resembling human readable. From my perspective it's about as easy to read, parse or learn as C digraphs. And if you don't know what I am talking about count your self blessed and move on.

    As for separating content from style that's the entire point. When you are typing in a text box online you don't want your style to be separated from your content. You want it to all be presentable in a single easy to read and parse format. And cut down HTML does that quite well.

  • (nodebb) in reply to 516052

    To me, Markdown is "human-readable" because it's meant to mimic how a human would add "style" (emphasis, a list, etc.) in a text-only format (like old-school notepad).

    Markdown italicises a word surrounded by single asterisks (and bolds a word surrounded by double asterisks), because people surrounded words with asterisks to add emphasis. The more asterisks, the heavier the emphasis. And so on.

  • 516052 (unregistered) in reply to Medinoc

    You and me must have met very different humans than because to me what you describe is both utterly unfamiliar and makes zero sense. I mean, why would anyone ever assume that * is a symbol for italics. You add emphasis by using CAPITALS and quotation marks.

Leave a comment on “Preformatted”

Log In or post as a guest

Replying to comment #693770:

« Return to Article