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:
| Role | Recognized column names |
|---|---|
| Item | Item, Part, Component, Name, Material |
| Qty | Qty, Quantity, Count, Amount |
| Cost | Cost, Price, Unit Cost, Each |
| Source | Source, Link, Buy, Vendor, Supplier |
| Notes | Notes, 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:
| Headings | Parsed as |
|---|---|
What You'll Need, Materials, BOM | Bill of materials |
| Tools, Equipment, Required Tools | Tool list |
| Step N:, Part N:, Phase N: | Steps |
| Downloads, Files, Assets | Downloads list |
| Troubleshooting, FAQ, Common Issues | Collapsible sections |
| Variations, Alternatives, Options | Variation 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.jpgfor the main project image in listingsthumbnail.jpgas an optional override for the listing thumbnailstep-*.jpgfor 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.
Affiliate link enrichment
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:
- Load
index.md, extract frontmatter, and render the body. - Walk the event stream and detect headings for section recognition.
- Parse bill-of-materials tables: match column headings and extract rows as
MaterialItemvalues. - Extract steps: collect content between step headings into
Stepvalues. - Identify tools, downloads, variations, and callouts.
- Resolve asset references: validate file existence and compute sizes.
- 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, andPhaseheadings 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 fromStep 2toStep 4shows 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-productmarkup. 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, andBOM, each compared on the whole heading. The parser matches none ofRequired Toolsand 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
## Toolsheading renders as a heading. Issue #79 holds it. - Download enrichment. Links under a
## Downloadsheading 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
thumbnailto the thumbnail width. Nothing matchesstep-*.jpgto a step, and the hero image comes from theherofrontmatter field rather than a file namedhero.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.