# Tools to let me re-generate `index.html` from an authoritative `index.md`

## Purpose and Target

The ability to *programmatically* and *deterministically* generate `index.html`
from:

   - a `wrapper.html` file, with placeholders to be filled in with Markdown-
   generated content. **I have provided it -- and you must preserve it!**

      - the `wrapper.html` file provides both comments for (a) main `index.md`
      generated content, and (b) a small "last updated" date to be filled in;

   - an `index.md` file, which provides the authoriative Markdown description
   of the interior of the `<main><article>...` tag;
k
   - a `quirks.md` file, which describes quirks in how Markdown should be
   translated to HTML that differentiate this from a mechanical translation
   (e.g. tag attributes, use of `<detail>`, etc.);

To do so, create a

   - `index-from-md` executable (probably Python with shebang at top), which
   implments everything above, with comments referencing the documentation.

   - a `strategy.md` file, which should provide more detailed documentation
   on the "how" this `PURPOSE.md` is being implemented, including outlines
   of key steps;

   - a `users-guide.md`, that I can read and gives me the bottom line of
   how I can write Markdown that will be faithfully translated to HTML!

Ultimately, at the root folder of this repository, I should be able to run
something like `index-from-md wrapper.html index.md [-o index.html] [-date YYYY-MM-DD]`
to generate an `index.html`.

## Context

Prior to this tooling, I manually edited `index.html` to add new content
to the web page. I hated this -- having to close tags, etc. But, I did love
the use of semantic HTML, and the manual control over certain HTML features.

## Goals and non-goals

- Replace the wrapper comment `<!-- LAST MODIFIED DATE, YYYY-MM-DD FORMAT -->`
with a date in `YYYY-MM-DD` format. By default, use the date of generation.
When the caller supplies `-date YYYY-MM-DD`, use that exact date in the footer.
With identical source files and the same explicit date, the driver must produce
identical HTML even when run on different days.

- Goal: use of semantic HTML, and distinctive features in the reference
`old-index.html`, carefully documented in `strategy.md` and `quirks.md`;

- Goal: `strategy.md` and `quirks.md` kept in sync with the implementation;

- Goal: juidicious use of features that make translation as explicit and
data-driven as possible, without burdening the actual `index.md` with
implementation details beyond that necessary to apply quirks. These may
include:

   - Use of Markdown metadata features -- per-element, and whole-document if
needed -- to make applied quirks in translation explicit and evident;

   - Precise specifications of how quirky translations are done (with possible
validation/acceptable criteria) in `quirks.md`;

- Keep the converter compact and add libraries conservatively. Use
`markdown-it-py` for Markdown parsing and rendering, and use Python's
standard library for the command line, dates, and files.

- Non-goal: for now, extensibility past `index.html`, or general-purpose
extensibility past the quirks of my desired "HTML style".

## FAQ, TBD
