GithubHelp home page GithubHelp logo

md-verify's Introduction

Get Started | md-verify

Verify markdown with rules.

example usage

Code Style: Prettier Github Actions: Build Passing TypeScript: Strict

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.

  1. Create a fork
  2. Create your feature branch: git checkout -b my-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request ๐Ÿš€

Issues

If you find a bug, please file an issue on the issue tracker.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.