Configuration#

A JSON config is read from the path given by --config (defaults to .gomarklint.json) if the file exists.

Example#

{
  "default": true,
  "rules": {
    "final-blank-line": true,
    "unclosed-code-block": true,
    "empty-alt-text": true,
    "heading-level": { "severity": "error", "minLevel": 2 },
    "duplicate-heading": true,
    "no-multiple-blank-lines": true,
    "no-setext-headings": "warning",
    "external-link": { "severity": "error", "timeoutSeconds": 5, "skipPatterns": ["^https://localhost"] }
  },
  "include": ["docs", "README.md"],
  "ignore": ["node_modules", "vendor"],
  "output": "text"
}

Top-level fields#

FieldTypeDefaultDescription
defaultbooltrueWhether unlisted rules are enabled by default (opt-out mode). Set to false for opt-in mode.
rulesobjectall rules enabled as errorPer-rule configuration. See Rule values below.
includestring[]["README.md", "testdata"]Paths to lint when no CLI paths are provided.
ignorestring[][]Path patterns to exclude.
outputstringtexttext or json.

default field#

Controls how rules not listed in rules are treated.

ValueBehavior
true (default)All unlisted rules are enabled — opt-out mode. List only the rules you want to disable or customize.
falseAll unlisted rules are disabled — opt-in mode. Only rules explicitly listed in rules will run.

Opt-out example — disable one rule, keep everything else:

{ "default": true, "rules": { "no-setext-headings": false } }

Opt-in example — run only final-blank-line:

{ "default": false, "rules": { "final-blank-line": true } }

Rule values#

Each entry in rules accepts three forms:

ValueMeaning
trueenabled, severity = "error"
falsedisabled
"error"enabled, severity = "error"
"warning"enabled, severity = "warning"
"off"disabled
{ "severity": "warning", ...options }full object form

In the object form, enabled can be omitted — it defaults to true. These are equivalent:

"heading-level": { "enabled": true, "severity": "warning", "minLevel": 2 }
"heading-level": { "severity": "warning", "minLevel": 2 }

Available rules#

RuleDefaultOptions
final-blank-lineerror
unclosed-code-blockerror
empty-alt-texterror
fenced-code-languageerror
heading-levelerrorminLevel (int, default 2)
duplicate-headingerror
no-multiple-blank-lineserror
no-setext-headingserror
single-h1error
blanks-around-headingserror
no-bare-urlserror
no-empty-linkserror
no-emphasis-as-headingerror
blanks-around-listserror
blanks-around-fenceserror
no-hard-tabserror
no-trailing-punctuationerrorpunctuation (string, default ".,;:!")
consistent-code-fenceerrorstyle (consistent | backtick | tilde, default consistent)
consistent-emphasis-styleerrorstyle (consistent | asterisk | underscore, default consistent)
consistent-list-markererrorstyle (consistent | dash | asterisk | plus, default consistent)
max-line-lengthdisabledlineLength (int, default 80)
external-linkdisabledtimeoutSeconds (int, default 5), skipPatterns (string[]), allowedStatuses (int[])
link-fragmentsdisabledslug-algorithm (string, default github), slug-params (object, for custom algorithm)

Option validation#

Rule options are validated at startup. An invalid option value — such as an unrecognised style — causes gomarklint to exit with a descriptive error before any linting runs:

gomarklint: invalid value "backticks" for consistent-code-fence.style (valid values: consistent, backtick, tilde)

This applies even when the rule is disabled, so misconfigured options are caught early.

Notes#

  • If no CLI paths are provided, include becomes the target set.
  • external-link is disabled by default due to network cost. Enable it explicitly in config.