| id | MDS019 |
|---|---|
| name | catalog |
| status | ready |
| description | Catalog content must reflect selected front matter fields from files matching its glob. |
Catalog content must reflect selected front matter fields from files matching its glob.
- ID: MDS019
- Name:
catalog - Status: ready
- Default: enabled
- Fixable: yes
- Implementation: source
- Category: meta
- Archetype: generated-section
- Guide: directive guide
Lists files matching a glob pattern. Uses template mode
when the YAML body has a row key, and minimal mode
otherwise.
| Parameter | Required | Default | Description |
|---|---|---|---|
glob |
yes | -- | Relative file glob |
sort |
no | path |
Sort key |
| Parameter | Required | Default | Description |
|---|---|---|---|
columns |
no | -- | Column width/wrapping |
The glob accepts a single string or a YAML list of
strings. It supports *, ?, [...], **, and {a,b}
brace expansion. It does not allow absolute paths or ..
traversal.
Single pattern:
glob: "docs/**/*.md"Multiple patterns (YAML list):
glob:
- "docs/**/*.md"
- "plan/*.md"Brace expansion:
glob: "internal/rules/{MDS001,MDS002}*/README.md"When multiple patterns are provided, files are collected from all patterns (deduplicated), then sorted together.
Do not use YAML folded scalars (>, >-) in the YAML
body. See the
archetype docs
for details.
The row section uses {fieldname} placeholder syntax.
{filename}-- relative path from the marker file's directory (no leading./).- Other names (e.g.,
{title}) -- looked up in the matched file's YAML front matter. - Missing field -> empty string.
- Case-mismatched field (e.g.,
{Title}when front matter hastitle) -> "did you mean?" hint. - Non-string scalar (number, bool) -> formatted to string. Composite values (maps, slices) -> empty string.
- Literal
{is written as{{, literal}as}}.
The columns parameter sets per-column width limits. Each
key is a template field name. Options:
| Option | Type | Default | Description |
|---|---|---|---|
max-width |
int | -- | Max character width. |
wrap |
string | truncate |
truncate or br. |
Links and inline code are not split mid-span.
columns:
description:
max-width: 50
wrap: brFormat: [-]KEY. A - prefix means descending order.
Built-in keys: path (default), filename. Any other
key is looked up in front matter. Missing values sort as
empty string. Sorting ignores case; ties break by path.
Without row, header, or footer, the directive outputs
a bullet list: - [<basename>](<relative-path>). Front
matter is only read when the sort key needs it.
- Files matched:
header+ rows +footer(emptyignored) - No files,
emptydefined:emptytext - No files, no
empty: zero lines between markers
See the archetype docs for newline handling and chomp details.
rules:
catalog: trueDisable:
rules:
catalog: false# Document Index
<?catalog
glob: "data/*.md"
row: "[{filename}](good/{filename})"
?>
[data/alpha.md](good/data/alpha.md)
[data/beta.md](good/data/beta.md)
<?/catalog?># Document Index
<?catalog
glob: "data/*.md"
?>
- [alpha.md](bad/data/alpha.md)
<?/catalog?>| Condition | Message |
|---|---|
Missing glob |
...missing required "glob" |
Empty glob |
...has empty "glob" |
| Absolute glob | ...has absolute glob path |
| Condition | Message |
|---|---|
Glob with .. |
...".." path traversal |
| Invalid glob | ...invalid glob pattern |
| Empty sort | ...empty "sort" value |
| Invalid sort | ...invalid sort value |
All messages above are prefixed with
generated section directive. Column is always 1.
See the archetype documentation for shared diagnostics (content mismatch, unclosed markers, nested markers, YAML errors, template errors).
| Scenario | Behavior |
|---|---|
| No front matter | Others -> empty |
| Invalid front matter | Treated as absent |
| Missing field | Empty string |
| Case-mismatched field | "did you mean?" hint |
| Unreadable file | Skipped |
| Scenario | Behavior |
|---|---|
| Glob matches directory | Skipped |
| Glob matches linted file | Included |
| Binary file | Included; no front matter |
| Symlinks | Followed |
| Scenario | Behavior |
|---|---|
| Dotfiles | Matched by */** |
Absolute/.. glob |
Diagnostic |
| Brace expansion | Supported |
| Multi-glob list | Union of matches, deduplicated |
| Empty glob/sort | Diagnostic |
| Scenario | Behavior |
|---|---|
sort: "-" |
Diagnostic |
| Sort with whitespace | Diagnostic |
| No files matched | empty fallback |
Files + empty |
empty ignored |
See the archetype documentation for shared edge cases (markers in code blocks, multiple marker pairs, line endings, template errors).