Verify markdown with rules.
md-verify matches a markdown input against defined rules. Fun fact: Rules are written in markdown.
You can verify pull request bodies if they match the defined template in your PULL_REQUEST_TEMPLATE.md file, etc.
For cli usage
npm install -g md-verify
For nodejs/browser usage.
npm install --save md-verify
The source is expected to be piped into the md-verify command.
-
From a file
cat /path/to/file.md | npx md-verify@latest \ --rule="# Heading" \ -- rule="## H2 Heading" \ -- rule="- List item"
-
From a string
echo '# md file content...' | npx md-verify@latest \ --rule="# Heading" \ -- rule="## H2 Heading" \ -- rule="- List item"
import fs from "fs";
import mdVerify, { VerifyError } from "md-verify";
try {
let source = fs.readFileSync("/path/to/md/file").toString("binary");
let rules = [
"## PR Checklist",
"# Get Started",
"## Overview",
"- Fish",
"- [CONTRIBUTING.md](/link/to/contributing.md)",
];
mdVerify(source, rules);
// if no error - means the markdown matches the rules.
} catch (e: any) {
console.log((e as VerifyError).errors);
}
PRs are greatly appreciated.
- Create a fork
- Create your feature branch: git checkout -b my-feature
- Commit your changes: git commit -am 'Add some feature'
- Push to the branch: git push origin my-new-feature
- Submit a pull request ๐
If you find a bug, please file an issue on the issue tracker.