YAML Block [[yaml_block: SyntaxConcept]]SyntaxConcept
Description [[description: text]]textSyntax Syntax 87%Parse Command 75%What Good QMD.md Looks Like NarrativeDoc 74%
QMD.md supports embedded YAML and JSON blocks for migrating existing configurations. A block is defined via a heading-syntax field with type yaml or json containing a fenced code block.
YAML Syntax [[yaml_syntax: text]]textSyntax Syntax 81%Array SyntaxConcept 65%
````markdown example
Configuration [[config: yaml]]
database:
host: localhost
port: 5432
credentials:
user: admin
password: secret
replicas: 3
Result: field `config` contains parsed YAML as a nested object. Data is accessible directly: `object.config.database.host`. The `__syntax` field records `yaml_object`.
## JSON Syntax <span class="qmdc-id" data-pagefind-ignore id="json_syntax">[[json_syntax: text]]</span><span class="qmdc-kind" data-pagefind-filter="kind">text</span>
````markdown example
### Configuration [[config: json]]
```json
{
"database": {
"host": "localhost",
"port": 5432
},
"replicas": 3
}
```
Result: field config contains parsed JSON as a nested object. The __syntax field records json_object.
Error Handling [[error_handling: text]]textSyntax Syntax 65%
If the YAML or JSON is invalid, the field is saved as a raw string. The graph continues loading (does not crash).
Rules [[rules: text]]textReference Reference 68%Syntax Syntax 68%Data Type SyntaxConcept 66%
- YAML blocks always have
__syntax: "yaml_object" - JSON blocks always have
__syntax: "json_object" - Invalid YAML/JSON is saved as a raw string (warning, not fatal)
- References
[[#id]]inside YAML/JSON blocks are not currently parsed (deferred) - YAML key order is preserved on rebuild (
sort_keys: false)