mdsmith
Esc
    v0.54.0 GitHub
    MDS060 prose ready

    MDS060: occurrence

    A scope must contain each configured token or pattern between min and max times (inclusive). Counts prose only; fenced and indented code blocks are excluded.

    The rule walks every scope unit (file, heading-bounded section, or paragraph) and counts non-overlapping occurrences of each token or regex pattern match. Fenced and indented code blocks are never counted. A diagnostic is emitted at the scope unit’s first line when the count falls below min or exceeds max.

    tokens and pattern are mutually exclusive. Use lists: to pull token sets from wordlist files without repeating them inline.

    # Settings

    SettingTypeDefaultDescription
    scopestringparagraphfile, section, or paragraph
    tokenslist of strings[]Literal substrings to count. Populated by lists:. Mutually
    exclusive with pattern.
    patternstring""Go RE2 regex to match. Mutually exclusive with tokens.
    mininteger0Minimum occurrences per scope unit (must be >= 0)
    maxinteger-1Maximum occurrences per scope unit; -1 is unbounded
    countstringeacheach checks each token independently; combined sums all matches
    case-sensitiveboolfalseWhen false, token matching ignores case

    # Config

    Enable with em-dash density preset (at most two per paragraph):

    rules:
      occurrence:
        enabled: true
        pattern: "—"
        scope: paragraph
        count: combined
        max: 2

    Enable with term-density preset (buzzword list, at most twice per section):

    rules:
      occurrence:
        enabled: true
        scope: section
        count: each
        max: 2
        lists:
          - buzzwords

    Disable:

    rules:
      occurrence: false

    # Examples

    # Token exceeds max

    # Title
    
    jargon jargon jargon here.

    # Pattern under max

    # Title
    
    First — second — end.

    # Fenced code blocks excluded

    # Title
    
    keyword keyword.
    
    ```text
    keyword keyword keyword
    ```

    # Meta-Information

    • ID: MDS060
    • Name: occurrence
    • Status: ready
    • Default: disabled
    • Fixable: no
    • Implementation: source
    • Category: prose