23 october 2022

Debating whether to use an existing HTML pre-processor or just forge on ahead with Python. So far, using beautifulSoup, I've managed to generate a table of contents automatically, and of course clean up my indenting. It does generate #ids for headings if they don't have their own, but it doesn't work as well for the little blog section on my index. This is all about my Neocities, by the way.

What I want out of a template:

<htime datetime="2022-10-23" />
<p>Here's a bunch of text</p>

to render as

<section id="2022-10-23">
  <h3><time datetime="2022-10-23">October 23, 2022</time></h3>
  <!-- or h4, h5, depends on the page -->
  <a href="table-of-contents">Back to top</a>
  <!-- hidden with CSS, only for keyboard navigation -->
  <p>Here's a bunch of text</p>


  <summary>Graphing code</summary>
  code goes here

to render as

  <summary>Graphing code</summary>
code goes here

Is there a semantic reason to use pre? I'm pretty sure I can just slap a class on the code element and be done with it, but if there's a semantic reason I probably shouldn't.