Markdown Autofix

approved

by swift

Detects Markdown syntax errors in the active note in real time and automatically fixes the safely fixable ones. - This plugin has not been manually reviewed by Obsidian staff.

25 downloadsUpdated 5d agoMIT

Markdown Autofix

An Obsidian plugin that detects Markdown syntax errors in the active note in real time and automatically fixes the safely fixable ones.

Features

  • Real-time detection — scans the current Markdown document after you pause typing (800 ms debounce), on file open, and on plugin load.
  • Auto-fix — errors with a unique safe fix are repaired automatically through an editor transaction (fully undoable with Ctrl/Cmd+Z).
  • Error display (toggleable) — wavy underlines with hover tooltips in the editor, plus an error count in the status bar. Can be turned on/off from Settings or the command palette (开关错误实时显示).
  • Error list panel — click the ribbon icon (left sidebar) or run 打开错误列表面板 to open a right-sidebar panel. Issues are grouped by type under collapsible headers: auto-fixable groups come first with a per-group 一键修复 batch button (plus a global 全部一键修复), review-only groups are tagged 需人工审核. Click any item to jump to its location; fixable items also have an individual 修复 button.
  • Heading level shift — select a range of text and run 选区内标题提升一级 / 选区内标题降低一级 from the command palette to promote/demote every heading inside the selection by one level (H1/H6 boundaries are left untouched, code fences are ignored, single undo step).
  • Safety guards — the line your cursor is on is never checked or modified; content inside code fences is ignored.

Detection rules (22, each individually toggleable, markdownlint-inspired)

Auto-fixed:

RuleFix
Heading # missing a following space (MD018)Insert a space
Unclosed inline markers (**, ~~, ==, `)Append the marker at line end
Link/image missing the closing )Append )
Unclosed code fenceAppend ``` at end of file
Table missing the separator rowInsert | --- | row matching column count
Multiple consecutive blank lines (MD012)Collapse to one
Blank lines containing spaces/tabsClear to truly empty
Trailing whitespace (MD009, 2-space hard break allowed)Trim
Hard tabs (MD010)Replace with 4 spaces
Heading indented from the left margin (MD023)Remove indentation
Heading ending with punctuation (MD026)Strip trailing punctuation
Headings not surrounded by blank lines (MD022)Insert blank lines
Code fences not surrounded by blank lines (MD031)Insert blank lines
Spaces inside emphasis markers ** text ** (MD037)Remove inner spaces
Spaces inside code spans ` code ` (MD038)Remove inner spaces
File not ending with exactly one newline (MD047)Normalize EOF newline

Display only (no unique safe fix): empty link [](), multiple H1 headings (MD025), heading level jumps (MD001), code fence without a language (MD040), bare URLs (MD034), emphasis used as a heading (MD036), inline HTML (MD033).

Installation

  1. Run npm install && npm run build in this directory.
  2. Copy main.js, manifest.json, and styles.css into <your-vault>/.obsidian/plugins/markdown-autofix/.
  3. Enable "Markdown Autofix" in Settings → Community plugins.

Privacy

  • No network access, no telemetry, no external services.
  • The plugin only reads and modifies the currently active Markdown document in the editor. All edits go through normal editor transactions and are undoable.
  • Settings (toggles) are stored locally in the plugin's data.json inside your vault.

中文说明

实时检测当前笔记的 Markdown 语法错误并自动修复(可撤销)。错误波浪线显示可在设置或命令面板中开关;光标所在行与代码围栏内的内容不会被检测或修改。

For plugin developers

Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.