5 ms·
I do not understand peoples problem with writing HTML. You could use an editor that auto-completes elements if you find that they're too long to type. Also reme
by mikae1 3y ago
I do not understand peoples problem with writing HTML. You could use an editor that auto-completes elements if you find that they're too long to type. Also remember that there are a few common elements, like <p> and <li>, that you usually don't need to close.
I use Hugo and I actually prefer writing HTML over MD.
- bentley 3y ago> Also remember that there are a few common elements, like <p> and <li>, that you usually don't need to close. <p> and <li> don’t ever need to be closed, do they? Closing would only be necessary if leaving them open would introduce ambiguity, but it never does.
- mikae1 3y agoNope. But if you don't use a closing tag and put, say, an <img> tag below a <p>, the image will be child of the paragraph. Perhaps that's not always what you want.
- toyg 3y agoCries in XHTML Close your tags, people. Make your intent non-ambiguous. It's basic hygiene.
- AlienRobot 3y agoIt's a paragraph, not a div, the intent is clear by definition.
- toyg 3y agoThe intent at the beginning of the paragraph, but not at the end. Is an IMG meant to be in the paragraph? Is a SPAN? They are inline elements that can indeed be inside a P. I honestly don't understand this level of laziness in 2023. Editors close tags automatically, ffs. For the sake of saving a keystroke or two we end up with unintuitive and ambiguous crap.
- bentley 3y agoIf I didn’t intend the img or span to be in the paragraph, I would have closed the <p>. The act of leaving the <p> open is what demonstrates that my intent is for the img to remain inside.
- toyg 3y agoAnd now you have a tag that is sometimes closed and sometimes open, forcing me to scan the entire document to figure if you've ever closed this bloody thing - as opposed to knowing that you will eventually close it, and that anything I see until then is inside the P.
- AlienRobot 3y agoYou won't need to scan the entire document because pretty much anything can make the P tag close, including closing the element containing it.
- bentley 3y agoDo you always specify <tbody> in your tables?
- naasking 3y agoI do.
- toyg 3y agoI always have the right amount of well-formed (and well-spanned) TD and TR, making my markup actually logical and simple to understand. Which is not the result we get from open P.
- bentley 3y agoI stopped closing <td> and <tr> because I found the (completely valid, completely unambiguous) practice of dropping the closing tags dramatically reduced the visual noise and clutter, making it easier for me to read my own tables.
- toyg 3y agoIf you say so, de gustibus. You might be making life marginally easier for you, to the detriment of any tool (or person) that has to parse your output.
- mock-possum 3y agoDo you not??
- lmm 3y ago> You could use an editor that auto-completes elements if you find that they're too long to type. Maybe, but why do things the hard way? Even if your editor autocompletes, typing the angle brackets is more cumbersome than Markdown. > Also remember that there are a few common elements, like <p> and <li>, that you usually don't need to close. Having to remember random trivia like this is exactly why writing HTML is awful.
- mikae1 3y ago> Maybe, but why do things the hard way? Me and some others don't find it harder. Also, what we write doesn't need a parser to output what the browser needs. > Having to remember random trivia like this is exactly why writing HTML is awful. Would not call it “random trivia”, these are quite basic HTML facts[1]. HTML is not XML. My theory is that some people find HTML hard to write because they make make it harder than it has to be. [1] https://html.spec.whatwg.org/multipage/syntax.html#optional-tags:the-li-element https://html.spec.whatwg.org/multipage/syntax.html#optional-...
- lmm 3y ago> Me and some others don't find it harder. Also, what we write doesn't need a parser to output what the browser needs. If you need an editor with autocomplete to write it comfortably, that's a bigger hassle than a separate postprocessing step that can happen automatically. > Would not call it “random trivia”, these are quite basic HTML facts[1]. It's absolutely random trivia. These particular four elements don't need closing, except this one might if it's not followed by one of this other long list of possible elements. Why would you ever know (or care about) that unless you enjoy memorizing random lists (I'll bet the reason it's those four is edge cases in a parser that someone wrote in a couple of hours 30 years ago, not any sensible logical classification), or already know the HTML spec because you work as a designer or something?
- bentley 3y ago> These particular four elements don't need closing, except this one might if it's not followed by one of this other long list of possible elements. That’s how it’s worded in the spec, because that’s targeted to browser implementors, not HTML authors. To someone authoring HTML, it’s much simpler: the tag is closed by any encountered opening or closing tag that the tag is not allowed to contain. That’s nothing new to memorize, because you already have to know what elements are allowed in that context. E.g., even in XHTML served with an XML MIME type and parsed with an XML parser, <p><p></p></p> is invalid XHTML, because <p> can’t contain <p>. I already have to know that rule when writing a webpage! Knowing that <p><p> is equivalent to <p></p><p> doesn’t require higher mental overhead. > I'll bet the reason it's those four is edge cases in a parser that someone wrote in a couple of hours 30 years ago, not any sensible logical classification Nope, the self‐closing behavior has been present in HTML since the very beginning (inherited from SGML). As for why these elements specifically, it’s because they are among the easiest and simplest to remember due to their definition. <li> can’t contain <li>—the concept doesn’t make sense—so it makes sense for <li><li> to implicitly close the first one. <td> can’t contain <td>—the concept doesn’t make sense—so it makes sense for <td><td> to implicitly close the first one. And so on.
- jdthedisciple 3y agoOP here and you know I'm with you, I actually love handwriting HTML. Auto-closing tags in VSCode comes in very handy too. Just thought I'd post this "novel" idea since most people do love their MD.