Lint and format Markdown for GitHub, Forgejo, Gitea, Obsidian, VitePress, or any CommonMark renderer, with one configuration for both.
Weather Station collects *temperature*, *humidity*, and *pressure* readings from a sensor board.
> [!note]
> Use matching firmware and page versions, or the page shows __no data__.
| Sensor | Unit |
|---|---|
| Temperature | °C |npx mdrefine format --write with the recommended and github presets turns
it into:
Weather Station collects _temperature_, _humidity_, and _pressure_ readings from
a sensor board.
> [!NOTE]
> Use matching firmware and page versions, or the page shows **no data**.
| Sensor | Unit |
| ----------- | ---- |
| Temperature | °C |mdrefine needs Node.js 22.12 or newer. Install it in the project that holds your documents, then check them and apply the fixes:
npm install --save-dev --save-exact [email protected]
npx mdrefine lint
npx mdrefine format --writelint reports what the rules find and never writes; format --write applies
the fixes. Getting
started
compares the other forms of format, for previews and CI.
Create mdrefine.config.jsonc at the root of the documents:
recommended wraps prose at 80 columns, writes consistent markers, aligns
tables, and checks links; see what it
does.
Use forgejo, codeberg, gitea, obsidian, or vitepress in place of
github for documents rendered there.
To adopt an existing markdownlint or Prettier setup, run
npx mdrefine config convert --write. Without an mdrefine configuration, their
settings apply; --no-competitor-config turns that off. See configuration
conversion.
- One configuration for lint and format. Style rules report in
lintand fix informat; problem rules report what has no single correct repair. - Never changes what a document means. Formatting edits only what its rules and configured code formatters target, keeps everything else byte for byte, and refuses an edit that would change what the document says.
- Dialect-aware. CommonMark, GitHub, Forgejo and Codeberg, Gitea, Obsidian, and VitePress: tables, math, wikilinks, and callouts are read as each renderer reads them.
- Checks local links and their heading and block fragments, with each renderer's anchors.
- Audits source navigation. An opt-in reachability audit finds Markdown documents unreachable from explicit entry pages, and reports when incomplete reads or unknown navigation prevent a conclusion.
- Extensible. Plugins add rules, presets, and syntax, and a library runs the same engine without the command line.
mdrefine is meant to replace a general-purpose linter and formatter, such as markdownlint and Prettier, for Markdown. The comparison lists each of their checks with the rule that covers it and where it behaves differently.
The documentation site describes the newest release:
- Getting started: install, configure, and run.
- Examples: documents before and after formatting; the package ships the same files.
- Rules: what each rule does, with examples.
- Configuration and the command line: every setting, option, and exit code.
- Obsidian vaults and integrations: CI, Git hooks, editors, and moving from Prettier or markdownlint.
- Library API and plugins.
- How it works and its limits, including what is not covered yet.
- Changelog.
mdrefine follows a pre-1.0 versioning policy: a minor release may change behavior and says how, and a patch release only fixes defects. It is written and maintained by AI agents, and no person reviews the code. Changes are accepted on their tests, CI on Linux and Windows, comparisons of what GitHub and Obsidian show before and after formatting, and a semantic check that refuses any formatting edit that would change a document's parsed meaning.
CONTRIBUTING.md explains how to report a defect and how to make a change, and CODE_OF_CONDUCT.md what is expected of everyone who takes part. Report vulnerabilities as SECURITY.md describes. mdrefine is released under the MIT license.
{ "extends": ["recommended", "github"], }