Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

4. Content convention parsing

Date: 2026-05-30

Status

Accepted. Parts of this record were a specification written ahead of the parser, and no one has built some of those parts. Read the decision as the target, then read Corrections for the parser that exists in 0.1.7. Issue #73 tracks the distance between the two.

Context

Listsome extracts structured data such as steps, bills of materials, tool lists, and asset references from CommonMark project files without requiring users to learn a custom markup language. The parser needs to recognize patterns in standard Markdown and map them to the internal data model of Step, MaterialItem, and Tool.

Decision

Listsome uses a convention-over-configuration approach: the parser recognizes specific level-two headings and table structures in CommonMark content and extracts structured data from them. The approach takes its model from Cooklang, where you write plain text and get structured features through convention.

Step extraction

The parser extracts headings matching one of these patterns as numbered steps:

  • ## Step N: Title
  • ## Part N: Title
  • ## Phase N: Title

Content between consecutive step headings becomes that step’s body.

Bill-of-materials table parsing

The parser reads any table under a recognized materials heading as a bill of materials and compares column names with known aliases, ignoring case:

RoleRecognized column names
ItemItem, Part, Component, Name, Material
QtyQty, Quantity, Count, Amount
CostCost, Price, Unit Cost, Each
SourceSource, Link, Buy, Vendor, Supplier
NotesNotes, Description, Comment, Note

Each role takes its first match. Summing the Cost column gives the total.

Tool list extraction

Both bulleted and numbered lists under ## Tools, ## Equipment, or ## Required Tools become tool entries, and the parser keeps the links those items carry.

Download enrichment

Links under ## Downloads, ## Files, or ## Assets gain file metadata such as size and an icon for the extension, and the build checks internal links to ./assets/ against the filesystem.

Section heading recognition

The full set of recognized headings and their mapping:

HeadingsParsed as
What You'll Need, Materials, BOMBill of materials
Tools, Equipment, Required ToolsTool list
Step N:, Part N:, Phase N:Steps
Downloads, Files, AssetsDownloads list
Troubleshooting, FAQ, Common IssuesCollapsible sections
Variations, Alternatives, OptionsVariation cards

Asset conventions

Assets live in projects/<slug>/assets/, and a project refers to them by relative path, for example ./assets/hero.jpg. Three name conventions apply:

  • hero.jpg for the main project image in listings
  • thumbnail.jpg as an optional override for the listing thumbnail
  • step-*.jpg for step images, matched to the step number

Callout detection

A marker at the start of a paragraph becomes a styled callout box. The vocabulary is warning, caution, hot, tip, pro tip, note.

When [affiliates] appears in listsome.toml, the build adds affiliate tag parameters to links to known vendors such as Amazon, Adafruit, and AliExpress. A URL pattern decides the vendor, matched against a built-in list of affiliate-enabled domains.

Build-time pipeline

The parsing and rendering pipeline processes each project as follows:

  1. Load index.md, extract frontmatter, and render the body.
  2. Walk the event stream and detect headings for section recognition.
  3. Parse bill-of-materials tables: match column headings and extract rows as MaterialItem values.
  4. Extract steps: collect content between step headings into Step values.
  5. Identify tools, downloads, variations, and callouts.
  6. Resolve asset references: validate file existence and compute sizes.
  7. Apply affiliate enrichment: rewrite vendor links with configured tags.

Consequences

Positive:

  • Users write standard CommonMark with no custom syntax
  • The conventions are discoverable, because they mirror how people already write project guides
  • The parser produces structured data without separate forms or config files

Neutral:

  • Conventions depend on specific heading wording, so the parser ignores non-English headings
  • Custom templates must match the same section patterns to benefit from structured data

Negative:

  • Column matching is a guess, so an unusual column name finds no role
  • Heading recognition is English-only
  • Nothing validates that extracted data means what it says, so a table that isn’t a bill of materials but sits under a materials heading becomes one

Corrections

Written 2026-11-13, against 0.1.7.

Built as specified:

  • Step extraction recognizes Step, Part, and Phase headings and takes the body from the content between headings. Two details differ from this record. The build numbers steps in document order and ignores the number you type, so a guide that jumps from Step 2 to Step 4 shows two steps numbered 1 and 2. And the parser rebuilds that body from text nodes, so Markdown structure doesn’t survive it. Issue #86 holds both defects.
  • Bill-of-materials parsing matches the alias table, first match per role, and sums the Cost column into a total that keeps the column’s own notation. Rows that name a part carry h-product markup. The build shows a cost cell that isn’t a number and leaves it out of the total, and it refuses a figure with a decimal comma rather than guessing it.
  • Three headings qualify: What You'll Need, Materials, and BOM, each compared on the whole heading. The parser matches none of Required Tools and its peers in the recognition table.
  • Callout detection exists, and decision record 0006 supersedes the description here. A marker is a bold label or a leading emoji that opens a paragraph, not an “emoji plus colon” pattern.

Not built:

  • Tool list extraction. A ## Tools heading renders as a heading. Issue #79 holds it.
  • Download enrichment. Links under a ## Downloads heading get no size, no type, and no filesystem validation. Issue #80 holds it.
  • Collapsible troubleshooting sections and variation cards.
  • Affiliate link enrichment. No [affiliates] section exists in the configuration model, so nothing reads vendor domains.
  • Asset name conventions beyond one case: the build resizes a file whose name contains thumbnail to the thumbnail width. Nothing matches step-*.jpg to a step, and the hero image comes from the hero frontmatter field rather than a file named hero.jpg.
  • Pipeline steps 5, 6, and 7. The build validates no asset path and computes no file size.

Two consequences also landed differently than written. A table under a materials heading whose columns match no role stays the plain table the author wrote, rather than becoming an empty bill. And a cost in the frontmatter wins over a bill total, with a build warning naming both figures when they disagree, because the index, the header, and the feed all show the frontmatter number.