$ markdown-fixer --check heading.mdheading.md 1:2 warning MDX010 Add a space after the heading marker: "# " rather than "#". (fixable) 3:2 warning MDX030 Add a space after the "-" list marker. (fixable) 4:2 warning MDX030 Add a space after the "-" list marker. (fixable)3 problem(s) in 1 file(s): 3 fixable, 0 error(s), 3 warning(s), 0 info.$ markdown-fixer --write heading.mdheading.md No problems. Fixed 3 issue(s).Fixed 3 issue(s) in 1 file(s).No remaining Markdown issues.
表格 table.md
MDX060 · 1 個可修正
分隔列每格補到三個連字號,原本的靠右對齊保留。
修正前table.md紅線:回報位置
123
| 欄位 | 值 |
| - | --: |
| a | 1 |
修正後table.md紅塊:插入的字元
123
| 欄位 | 值 |
| --- | ---: |
| a | 1 |
$ markdown-fixer --check table.mdtable.md 2:3 warning MDX060 Table delimiter cell has fewer than three hyphens. (fixable)1 problem(s) in 1 file(s): 1 fixable, 0 error(s), 1 warning(s), 0 info.$ markdown-fixer --write table.mdtable.md No problems. Fixed 1 issue(s).Fixed 1 issue(s) in 1 file(s).No remaining Markdown issues.
CJK 粗體 cjk.md
MDX042 ×3 · 3 個可修正
把全形冒號移到 ** 外面,GitHub 上的粗體才會生效,意思不變。
修正前cjk.md紅線:回報位置
12
**審查執行:**2026-11-04
**Spec 來源:**本次工作
修正後cjk.md紅塊:移動後的位置
12
**審查執行**:2026-11-04
**Spec 來源**:本次工作
$ markdown-fixer --check cjk.mdcjk.md 1:1 warning MDX042 Unpaired `**` next to CJK or full-width punctuation renders literally instead of emphasis. Move the full-width punctuation outside the delimiters (`**X:**Y` becomes `**X**:Y`) or reword. (fixable) 1:8 warning MDX042 Unpaired `**` next to CJK or full-width punctuation renders literally instead of emphasis. Move the full-width punctuation outside the delimiters (`**X:**Y` becomes `**X**:Y`) or reword. (fixable) 2:11 warning MDX042 Unpaired `**` next to CJK or full-width punctuation renders literally instead of emphasis. Move the full-width punctuation outside the delimiters (`**X:**Y` becomes `**X**:Y`) or reword. (fixable)3 problem(s) in 1 file(s): 3 fixable, 0 error(s), 3 warning(s), 0 info.$ markdown-fixer --write cjk.mdcjk.md No problems. Fixed 3 issue(s).Fixed 3 issue(s) in 1 file(s).No remaining Markdown issues.
空白與檔尾 whitespace.md
MDX004 · MDX005 · MDX003 · 3 個可修正
行尾三個空格只留下強制換行用的兩個、三個空行收成一個、再補上檔尾換行。
修正前whitespace.md· 第 3、4 行將刪除
12345
段落一。···
段落二沒有換行結尾
修正後whitespace.md少了兩行,內容不變
123
段落一。
段落二沒有換行結尾
$ markdown-fixer --check whitespace.mdwhitespace.md 1:5 warning MDX004 Trailing whitespace. Exactly two trailing spaces create a hard line break; other trailing whitespace is noise. (fixable) 3:1 warning MDX005 Multiple consecutive blank lines. Use one blank line between blocks. (fixable) 5:1 warning MDX003 File does not end with a newline. (fixable)3 problem(s) in 1 file(s): 3 fixable, 0 error(s), 3 warning(s), 0 info.$ markdown-fixer --write whitespace.mdwhitespace.md No problems. Fixed 3 issue(s).Fixed 3 issue(s) in 1 file(s).No remaining Markdown issues.
use markdown_fixer::{Options, diagnose, fix_document};
fn main() {
let text = "#Title\n\n-item\n";
let options = Options::default();
for p in diagnose(text, &options) {
println!("{}:{} {} {}", p.line, p.column, p.rule, p.message);
}
let result = fix_document(text, &options);
if result.refused {
eprintln!("not fixed: {}", result.reason);
}
assert_eq!(result.text, "# Title\n\n- item\n");
}
C ABI
提供 cdylib 與 staticlib,標頭檔是手寫的 markdown_fixer.h。Swift、C#、Go、Python 都能直接呼叫,完整 API 見 docs/ffi.md。