Implement a transformer that promotes the title: front matter field to an H1 heading.
Scope
- If the document has front matter with a
title: field, and the document body does not already begin with an H1 heading, prepend # <title> as the first node in the document body
- If an H1 already exists, do nothing
- If there is no
title: in front matter, do nothing
Use case
Source Markdown files often omit the H1 because a CMS or site generator renders it from front matter. Downstream tools (e.g. Pandoc for PDF generation) need an explicit heading in the document body.
Acceptance criteria
- Document with
title: Foo and no H1 → H1 "Foo" prepended
- Document with
title: Foo and existing H1 → unchanged
- Document with no front matter → unchanged
- Document with front matter but no
title: → unchanged
Implement a transformer that promotes the
title:front matter field to an H1 heading.Scope
title:field, and the document body does not already begin with an H1 heading, prepend# <title>as the first node in the document bodytitle:in front matter, do nothingUse case
Source Markdown files often omit the H1 because a CMS or site generator renders it from front matter. Downstream tools (e.g. Pandoc for PDF generation) need an explicit heading in the document body.
Acceptance criteria
title: Fooand no H1 → H1 "Foo" prependedtitle: Fooand existing H1 → unchangedtitle:→ unchanged