Check type ID#
kind: text_forbids
Purpose#
Forbid a regular expression from appearing in the body text.
Configuration keys#
| Field | Required | Default | Meaning |
|---|---|---|---|
pattern | yes | - | Go regular expression, matched unanchored. |
target | no | body | Span selector: body, line, first-line, or matched-lines. |
select | no | - | Line-filter regex; required for and only valid with target matched-lines. |
fix | no | - | Optional replacement template (regexp capture syntax) applied to the matched text by the fix command. |
Example#
collections:
notes:
path: notes
checks:
- kind: text_forbids
target: line
pattern: '\bTODO\b'Worked example#
The text_forbids check forbids a trailing period on the first line; its fix template strips it. Only the matched text changes; the later keep this. line is untouched.
Input#
notes/doc.md
---
t: 1
---
# Title.
keep this..katalyst/storage/my_directory.yaml
type: filesystem
root: .
collections:
notes:
path: notes
checks:
- kind: text_forbids
target: first-line
pattern: '\.(\s*)$'
fix: '$1'Command#
$ katalyst fix notes/doc
<project>/notes/doc.md
Result#
notes/doc.md after katalyst fix notes/doc:
---
t: 1
---
# Title
keep this.