Write HTML Right
This is a good read which suggests taking an ultra-minimal approach to writing valid HTML – sans most
head bits and pieces, the
html and by omiting closing tags. You’ll also learn about a wayback, Markdown-like language called troff (my word of the week).
You can see how much easier it is to write HTML when we don’t close tags:
<h1> An exciting article <p> This is a good read. I can even start new sentences on new lines.
Jens made the same argument, but posited different reasons. You’ll see some disagreement in the comments. Perhaps Jens was writing for the wrong audience – if you’re a developer you’re probably creating templates rather than longform documents. Agreement and clarity is all important, and an XHTML mindset suits programmers. And if you are a developer who blogs, you’re using Markdown rather than handcrafting HTML.
Which raises the question who actually writes HTML these days? If you blog you probably use some form of rich text editor or Markdown. If you’re taking a purist approach and want to remove all technical dependencies this could be for you, but you’re in a tiny minority.
But then it occurred to me that people are still writing HTML. In fact, I’m one of them. Web editors will often have to deal with text copied from Word, content submitted by non-editors or even a CMS that struggles to output paragraphs rather than a stream of
s. Often we enter the HTML to fix the content and make it accessible. Minimal, valid HTML could make our lives easier.
Original article by Aaron D. Parks. Published 10/06/22.
Add a comment
I’m going through your articles and links and enjoying the reading. Thank you.
You ask: Who Uses HTML?
I use HTML the way people use markdown: as an open, easy to read, easy to write, plain text format for taking notes, writing articles, etc.
I find this quite intuitive and easy – partly because I’m an old-school web-developer from days of yore and I have HTML deeply internalised; partly because I use the abbreviated version of HTML noted above; and partly because I use a VIM plugin called Emmet which allows you to construct complex HTML fragments with a basic shorthand.
The reason why I use HTML instead of markdown is threefold.
- The first is that simple HTML, written with a little care, is readable as-is, and requires no transformation to see it looking pretty (just open in a browser). Markdown requires pandoc to turn it into something else.
- The second is that it is a semantically rich language, full of useful tags for expressing document structure and context for words and sentences. I find Markdown really confining.
- The third reason is that, if I take the care to fill in the basic author/keyword/desc meta-tags I can run scripts over my directories looking for and indexing things. Who cares Search Engines don’t use those tags anymore. I do.
Possibly they’re not entirely compelling reasons for anyone else to adopt HTML over markdown, but they work for me.
I agree with your points and I write HTML directly as well. I hopped on the GitHub Pages and Jekyll bandwagon several years ago but aside from issues with keeping the theme up to date, I realized that I wouldn’t be able to maintain the tooling system if the project were to end up abandoned. It dawned on me that it would be easier and more future-proof to just write the HTML myself.
That introduced some new challenges, namely that it would be too much work to overhaul the site’s layout at this point, but I agree that HTML files are quite readable and modern text editors/plugins make it extremely easy to write. I sometimes find it annoying to insert hyperlinks or images and also to reorganize my writing when it is already enclosed in paragraph tags, but Markdown wouldn’t really solve those issues since those are just a product of writing for the web.
Thanks for the comment.
Interesting point about internalising HTML. I think I’m the same, especially when it comes to writing it the “verbose” way – I still find it difficult not to close
ps, for example.
I agree with your points. For anything beyond simple paragraphs, lists and headings, I’ll normally just use HTML, and with stuff like
blockquote I’ll end up adding a
cite as there’s no Markdown equivalent.
But I think Markdown took off because it is so easy to train yourself to use
> reflexively, and hitting
return twice beats typing a
p tag for me. It’s like typing a formatted text file.
I’m using templates, so adding meta data’s easy, and I do like the idea of using
meta and storing usable data in your HTML instead of using, say,
description is useful for search engines.)
As for @Poorchop’s point, I would probably handcode HTML if it had includes, especially if you could pass variables through them. Variables and HTML meta data would be awesome. Because he’s right: keeping tooling up-to-date can be a PITA. But the thought of not being able to update repeated HTML in one place fills me with horror 😁, although I guess it’s possible through some command line wizardry.