Skip to content

Repetition and Lists

Use {min,max} syntax after a matcher to specify repetition constraints:

Use {,} to allow unlimited repetitions:

schema.mds
`item:/\w+/`{,}
input.md
one
Output:
{"item":"one"}
schema.mds
`item:/\w+/`{,}
input.md
one two three four five
Output:
{"item":"one two three four five"}
schema.mds
`digit:/\d/`{3,3}
input.md
123
Output:
{"digit":"123"}
schema.mds
`digit:/\d/`{3,3}
input.md
12
schema.mds
`num:/\d+/`{2,4}
input.md
12 34
Output:
{"num":"12 34"}
schema.mds
`num:/\d+/`{2,4}
input.md
12

Lists validate structured list content with support for literal items, matchers, and repetition.

schema.mds
- Item 1
- Item 2
input.md
- Item 1
- Item 2
schema.mds
- Item 1
- Item 2
input.md
- Item 1
- Item 3
schema.mds
- `name:/\w+/`
- `age:/\d+/`
input.md
- Alice
- 25
Output:
{"name":"Alice","age":"25"}

Use {min,max} on list item matchers to match multiple items:

schema.mds
- `item:/\w+/`{2,4}
input.md
- apple
- banana
Output:
{"item":["apple","banana"]}
schema.mds
- `item:/\w+/`{2,4}
input.md
- apple
schema.mds
- `task:/\w+/`{,}
input.md
- work
- study
- exercise
Output:
{"task":["work","study","exercise"]}
schema.mds
- Parent
- `child:/\w+/`{1,2}
input.md
- Parent
- child1
- child2
Output:
{"child":["child1","child2"]}
schema.mds
- Parent
- Child
input.md
- Parent
- Child
schema.mds
- `first:/test\d/`{2,2}
- `second:/foo\d/`{1,2}
input.md
- test1
- test2
- foo1
Output:
{"first":["test1","test2"],"second":["foo1"]}
  • List matchers return arrays when repeated
  • Variable-length matchers must be at the end of a list schema
  • Indentation levels must match for nested lists