Examples
Practical format definitions for common document patterns. Each example uses the Parse SDK (findAll, textContent, inlineText, isCodeBlock, extractTodoItems) for parsing and datamark/stringify (heading, list, codeBlock, frontmatter) for serialization.
Basic Format
Simple heading + body extraction with inlineText and textContent
Blog Post
Typed frontmatter + body content with textContent and frontmatter()
Todo List
Checkbox items with extractTodoItems and list()
API Documentation
Endpoints, parameters, and JSON code blocks with findAll and codeBlock()
Changelog
Versioned release notes with regex heading parsing and list()
Recipe
Frontmatter metadata + ingredients + step sections with section walking
Meeting Notes
Attendees, agenda, and tracked action items with extractTodoItems
Pattern: Three imports
Every format definition imports from three places:
import { datamark } from "datamark";
import { inlineText, textContent, findAll, isCodeBlock } from "datamark/parse";
import { heading, list, codeBlock, frontmatter } from "datamark/stringify";datamarkgives you the format factorydatamark/parsegives you AST traversal and extraction utilitiesdatamark/stringifygives you builder functions for clean Markdown output
This separation keeps your imports explicit: the format system on one side, parsing on another, serialization on the third.