Skip to content

About

Lint and format Markdown for GitHub, Forgejo, Gitea, Obsidian, VitePress, or any CommonMark renderer, with one configuration for both. Agent-maintained.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1,632 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mdrefine

Lint and format Markdown for GitHub, Forgejo, Gitea, Obsidian, VitePress, or any CommonMark renderer, with one configuration for both.

npm CI License: MIT

Example

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   |

Install

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 --write

lint 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.

Configure

Create mdrefine.config.jsonc at the root of the documents:

{
  "extends": ["recommended", "github"],
}

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.

Features

  • One configuration for lint and format. Style rules report in lint and fix in format; 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.

Documentation

The documentation site describes the newest release:

Status

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, security, and license

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.

About

Lint and format Markdown for GitHub, Forgejo, Gitea, Obsidian, VitePress, or any CommonMark renderer, with one configuration for both. Agent-maintained.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages