Skip to content

Rules ​

A rule is either a style rule or a problem rule. A style rule checks how something is written and proposes an edit, which format applies and lint reports. A problem rule reports a defect that has no single correct repair, and never edits. format applies an edit only when the document still means the same afterwards, and never in text that the parser reads where renderers read a list; see how it works.

Enable and configure rules under rules in the configuration. npx mdrefine rules lists the built-in rules and those of the configuration's plugins, with the descriptions below.

The tables give the severity at which a preset enables each rule, warn or error: recommended in its own column, and the dialect presets by name in the next; — means that none does. A configuration can set any rule to another severity; see rules and severity. The codeberg preset is the forgejo preset under another name. In a dialect that a rule's page does not name, the rule finds nothing.

Each rule's page opens with what the rule does, then gives its kind, the presets that enable it with their severity, its dialects, and its options, an example, and the options in detail. Edge cases, notes for particular dialects, and how the rule works with other rules follow under their own headings.

Content ​

RuleWhat it doesKindrecommendedDialect presetsOptions
content/code-languageReports fenced code blocks that name no language, or one that the options disallow.Problem——Yes
content/emphasis-spacingReports spaces just inside emphasis markers, which make renderers show the markers as text.Problem———
content/html-elementReports HTML elements, apart from the allowed ones.Problem——Yes
content/image-altReports images, Markdown or HTML, without alternative text.Problemwarn——
content/inline-code-spacingReports spaces at the ends of code spans that renderers show as part of the code.Problem———
content/line-lengthReports heading, code block, and table lines longer than a limit, without editing them.Problem——Yes
content/proper-namesReports other capitalizations of configured names, such as javascript for JavaScript.Problem——Yes
content/shell-promptReports shell code blocks in which every command has a prompt and no output is shown.Problem———
content/table-columnsReports table rows with more or fewer cells than the header row.Problemwarn——

Forgejo and Gitea ​

RuleWhat it doesKindrecommendedDialect presetsOptions
forgejo/heading-idReports heading attributes whose id is not text, which can stop Forgejo and Gitea from rendering the document.Problem—error in forgejo, gitea—

GitHub ​

RuleWhat it doesKindrecommendedDialect presetsOptions
github/alert-markerWrites GitHub alert types in capitals, as in [!NOTE].Style—warn in github, forgejo, gitea, vitepress—
github/task-markerWrites the mark of a completed task as a lowercase x.Style—warn in github, forgejo, gitea, obsidian, vitepress—
RuleWhat it doesKindrecommendedDialect presetsOptions
links/allowed-notationReports the link and image forms that the options disallow.Style——Yes
links/bare-urlWrites bare URLs and email addresses as autolinks, in angle brackets.Style———
links/descriptive-textReports links whose whole text, such as "here", does not say where they lead.Problem——Yes
links/emptyReports links and images whose destination is empty or only #.Problemwarn—Yes
links/notationConverts Obsidian links between Markdown and wikilink notation.Style——Yes
links/pathRewrites local link destinations to the configured path style, keeping their targets.Style——Yes
links/reversedReports likely reversed links, such as (text)[https://example.com].Problem———
links/text-spacingReports spaces at the ends of link text, which become part of the link.Problem———
links/undefined-referenceReports references whose label has no definition, which renderers show as plain text.Problemwarn—Yes
links/unused-definitionReports link and footnote definitions that no reference uses.Problemwarn—Yes
links/validReports local links and fragments whose target does not exist.Problemerror—Yes

Obsidian ​

RuleWhat it doesKindrecommendedDialect presetsOptions
obsidian/block-referenceReports block identifiers that a note uses more than once.Problem—error in obsidian—
obsidian/callout-markerWrites Obsidian callout types in lowercase.Style—warn in obsidian—
obsidian/strict-line-breaksReports notes that are not wrapped because Obsidian's "Strict line breaks" setting is not known to be on.Problem—warn in obsidian—

Structure ​

RuleWhat it doesKindrecommendedDialect presetsOptions
structure/duplicate-headingReports headings with the same text as an earlier heading under the same parent.Problem——Yes
structure/emphasis-headingReports paragraphs of only emphasized or strong text, which read as headings.Problem——Yes
structure/heading-incrementReports headings more than one level deeper than the heading before them.Problemwarn—Yes
structure/heading-punctuationReports headings that end with sentence punctuation.Problem——Yes
structure/heading-templateReports headings that do not follow a configured sequence.Problem——Yes
structure/initial-headingReports a document that does not start with a heading of the configured level.Problem——Yes
structure/single-titleReports more than one title heading in a document, counting a front matter title.Problem——Yes
structure/split-quoteReports block quotes separated only by a blank line, which may be meant as one.Problem———
structure/unspaced-headingReports text such as #Installation that would be a # heading with a space after the hashes.Problem———

Style ​

RuleWhat it doesKindrecommendedDialect presetsOptions
style/blank-linesLimits blank lines in a row, and removes those at the start and end of a document.Stylewarn—Yes
style/block-spacingSeparates headings, lists, fenced code blocks, and tables from the blocks around them with a blank line.Stylewarn—Yes
style/code-blockWrites code blocks in one form, fenced or indented.Style——Yes
style/code-fenceWrites code fences with one marker, only as long as their content needs.Stylewarn—Yes
style/definition-spacingWrites one space after a link reference definition's colon and before its title.Style———
style/emphasisWrites emphasis with one marker, _ by default.Stylewarn—Yes
style/final-newlineEnds a document that is not empty with a line break.Stylewarn——
style/headingWrites headings in one style, # headings by default, with one space after the hashes.Stylewarn—Yes
style/inline-codeWrites code spans on one line, with the fewest backticks they need.Style———
style/lazy-continuationWrites the quote markers and indentation on lines that continue a paragraph without them.Stylewarn——
style/line-endingWrites one configured line ending outside literal content.Style——Yes
style/link-titleWrites link and image titles with one kind of delimiter, double quotes by default.Style——Yes
style/list-indentIndents list items consistently, with the configured spaces after the marker.Stylewarn—Yes
style/list-markerWrites bullet lists with one marker, - by default.Stylewarn—Yes
style/no-tabsReports tabs, and replaces those in prose with spaces.Style——Yes
style/ordered-listWrites ordered list numbers with one delimiter, and numbers the items consistently.Stylewarn—Yes
style/prose-spaceCollapses repeated spaces between words without moving line breaks.Style———
style/quote-markerWrites one space after each block quote marker, >.Stylewarn—Yes
style/strongWrites strong emphasis with one marker, * by default.Stylewarn—Yes
style/tablePads table cells to their column's width and writes the delimiter row to match.Stylewarnwarn in github, forgejo, gitea, obsidian, vitepressYes
style/thematic-breakWrites thematic breaks as one exact text, --- by default.Stylewarn—Yes
style/trailing-spaceRemoves spaces and tabs at the end of lines, keeping hard line breaks.Stylewarn—Yes
style/wrapReflows paragraphs to fill the line width, 80 columns by default.Stylewarn—Yes