What are templates?
What templates can include
Style extraction
Get template styles (internal API)
curl https://api.mddoc.app/api/templates/TEMPLATE_ID/styles \
-H "Authorization: Bearer mddoc_YOUR_KEY"Response
{
"template_id": "550e8400-...",
"styles": [
"Normal", "Heading 1", "Heading 2", "Heading 3",
"List Bullet", "List Bullet 2", "List Number",
"Code", "Quote", "Title", "Subtitle",
"Header", "Footer", "TOC Heading"
],
"used_styles": [
"Normal", "Heading 1", "Title", "Subtitle"
]
}What are mappings?
Mapping rules schema
| Field | Type | Default | Description |
|---|---|---|---|
| heading | object | — | Map of heading level to style name, e.g. {"1": "Heading 1", "2": "Heading 2"} |
| document_title | string | "" | Style for the cover page title (from first H1) |
| document_subtitle | string | "" | Cover page subtitle style |
| paragraph | string | "Normal" | Body text style |
| list_bullet | string | "List Bullet" | Level 1 bullet list |
| list_bullet_2 | string | "List Bullet 2" | Level 2 bullet list |
| list_bullet_3 | string | "List Bullet 3" | Level 3 bullet list |
| list_ordered | string | "List Number" | Level 1 numbered list |
| list_ordered_2 | string | "List Number 2" | Level 2 numbered list |
| list_ordered_3 | string | "List Number 3" | Level 3 numbered list |
| code_block | string | "Code" | Fenced code block style |
| blockquote | string | "Quote" | Block quote style |
| table | object | — | {style, header_row} — table style name and whether first row is a header |
| page_break_before | string[] | [] | Elements that trigger a page break, e.g. ["heading.1"] |
| metadata_mapping | object | {} | Cover page field-to-style mapping for metadata clearing |
Example mapping
Full mapping rules
{
"heading": {
"1": "Heading 1",
"2": "Heading 2",
"3": "Heading 3",
"4": "Heading 4"
},
"document_title": "Cover heading",
"document_subtitle": "Cover subtitle",
"paragraph": "Normal",
"list_bullet": "List Bullet",
"list_bullet_2": "List Bullet 2",
"list_bullet_3": "List Bullet 3",
"list_ordered": "List Number",
"list_ordered_2": "List Number 2",
"list_ordered_3": "List Number 3",
"code_block": "Code Block",
"blockquote": "Block Quote",
"table": {
"style": "Grid Table 1 Light",
"header_row": true
},
"page_break_before": ["heading.1"],
"metadata_mapping": {
"Author": "Cover Author",
"Date": "Cover Date"
}
}How conversion uses mappings
Validation warnings
| Warning type | Meaning |
|---|---|
| missing_style | A mapping rule references a style that doesn't exist in the template |
| unmapped_element | The markdown contains an element with no corresponding mapping rule |