@generative-dom/plugin-markdown-heading
v0.1.0
Published
Generative DOM plugin — ATX headings h1–h6
Maintainers
Readme
@generative-dom/plugin-markdown-heading
ATX headings h1–h6 for Generative DOM.
Installation
pnpm add @generative-dom/plugin-markdown-headingUsage
import { GenerativeDom } from '@generative-dom/core';
import { markdownHeading } from '@generative-dom/plugin-markdown-heading';
const md = new GenerativeDom(container, { plugins: [markdownHeading()] });
md.push('# Hello\n');Matching
Matches lines that begin with one to six # characters followed by a space.
An optional closing sequence of # characters (preceded by whitespace) is stripped.
During streaming, a trailing newline is required; on final flush, end-of-string is accepted.
# H1
## H2
### H3 with optional closing ###Configuration
- priority: 100
- level: block (default)
- matchDescriptor:
{ startChars: '#', requiresSOL: true } - allowedChildren:
['markdown-inline', 'markdown-link']
Rendered Output
Produces <h1> through <h6> elements. Heading text is parsed for inline formatting
(bold, italic, links) via allowedChildren.
<h1>Hello</h1>
<h2><strong>Bold</strong> heading</h2>