Heading [[heading: SyntaxConcept]]SyntaxConcept
- dependsObject
Description [[description: text]]textSyntax Syntax 76%Parsing Algorithm Algorithm 76%Common Errors NarrativeDoc 72%
All headings in QMD.md follow a unified syntax with optional components. Headings create objects and define document structure.
QMDC parses these Markdown constructs:
- Headings (
#through######and beyond) create objects [[id]]in a heading defines the object identifier[[id: Kind]]adds a type[[:Kind]]auto-generates ID from Title and adds a type- Title text (without
[[...]]) is stored in__label
Position of [[id]] in the heading does not matter: ## Title [[id]], ## [[id]] Title, and ## Title [[id]] More all produce the same ID.
Syntax [[syntax: text]]textCommon Errors NarrativeDoc 73%Syntax Syntax 70%Formatting LSPFeature 70%
Basic heading forms:
# Title
# Title [[id]]
# Title [[id: Kind]]
# Title [[:Kind]]
# [[id]] Title
# [[id: Kind]] Title
Components (all optional):
- Title β human-readable text, stored in
__label [[id]]β object/field identifier[[id: Kind]]β identifier with type[[:Kind]]β auto-generated ID with type
Auto ID Generation [[auto_id: text]]textCommon Errors NarrativeDoc 71%Syntax Syntax 65%
When [[id]] is not specified, the ID is auto-generated from Title.
Algorithm:
- Take the Title text (excluding
[[...]]parts) - Convert to lowercase
- Replace non-alphanumeric characters with a single space
- Collapse consecutive spaces into one
- Replace spaces with
_ - Strip leading and trailing
_ - If it starts with a digit, prepend
_
Examples:
| Title | Auto-generated ID |
|---|---|
Configuration |
configuration |
John Doe |
john_doe |
My Team #1 |
my_team_1 |
API Service |
api_service |
2024 Report |
_2024_report |
Kinds [[kinds: text]]textSyntax Syntax 74%Parser Microtests TestSuite 70%Kind in Heading CompletionContext 70%
Built-in kinds (lowercase) β parser hints:
textβ multiline text fieldobjectβ nested objectarrayβ object arrayyamlβ embedded YAML blockjsonβ embedded JSON blockmapβ flat string dictionary (strβstr)
System kinds (prefixed with __) β created automatically by the parser:
__Documentβ document container__TextBlockβ unstructured text block__Objectβ object without explicit Kind__Workspaceβ workspace root__Namespaceβ namespace grouping
User kinds (PascalCase) β from schemas:
User,Stage,Configβ object types for validation[User],[Stage]β array of typed objects
Filtering system types: objects.filter(obj => !obj.__kind?.startsWith("__"))
Nesting Levels [[nesting_levels: text]]text
Heading levels H1βH6 and beyond (unlimited # count). Nesting is relative β a child element is one level below its parent.
Note: Standard Markdown supports only H1βH6. QMD.md extends this by allowing arbitrary # counts for deep nesting (H7, H8, etc.).
Rules [[rules: text]]textMultiple Definitions In Heading ValidationError 84%Common Errors NarrativeDoc 76%Structured In TextBlock ValidationError 74%
- Each heading may contain at most one
[[...]]definition. Multiple definitions (## Title [[a: array]] [[b: Kind]]) produce amultiple_definitionserror. - If
[[id]]is not specified and the heading has no fields, it becomes a__TextBlock(not an object). - If
[[id]]is not specified but the heading has fields or heading-syntax children, the ID is auto-generated from Title. __has_explicit_id: falseis set when the ID was auto-generated (absent when explicit).__levelrecords the heading level (1β6+) for lossless rebuild.