md-verify
v1.0.0
Published
> Verify markdown with rules.
Downloads
5
Maintainers
Readme
Get Started | md-verify
Verify markdown with rules.
Table of contents
What is md-verify?
md-verify matches a markdown input against defined rules. Fun fact: Rules are written in markdown.
Benefits / Usage of md-verify
You can verify pull request bodies if they match the defined template in your PULL_REQUEST_TEMPLATE.md file, etc.
Installation
For cli usage
npm install -g md-verify
For nodejs/browser usage.
npm install --save md-verify
CLI
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"
API
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);
}
Contributing
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 🚀
Issues
If you find a bug, please file an issue on the issue tracker.