Writing HTML by hand #

I write some of my pages using a markup language (emacs org-mode) and other pages using xhtml, with a few extra x:* tags that get expanded out into html later. I was curious, when I write html by hand, which tags do I use? I used Python's elementtree to get the answer:

 3085 p
 2466 a
 2303 li
 1042 em
 1008 code
  876 span
  719 x:section
  517 br
  454 div
  446 strong
  424 h3
  410 figure
  359 ul
  358 script
  331 img
  323 pre
  262 td
  249 x:document
  228 x:footer
  219 g

A lot of what I write is explanations in <p> paragraphs and <ul> <li> lists. And I try to include lots of <a> links to other supporting documents. I do try to use the semantic <em> and <strong> instead of the visual <i> and <b>. These results didn't surprise me much.

Here's the code (roughly):

    tag_counts = collections.Counter()
    for doc in documents:
        tree = etree.fromstring(doc.contents)
        for el in tree.iter():
            tag_counts[el.tag] += 1
    for (tag, count) in tag_counts.most_common(20):
        print(f"{count:5} {tag}")

Do you write HTML by hand? If so, what tags do you use most?

Update: [2023-09-20] Some people commented on HackerNews about how they write their HTML, including some debate over closing tags, HTML vs XHTML, and markup languages.