doc-validator

0.3.0 • Public • Published

doc-validator

A library/tool for validating JavaScript code in Markdown documentation

Inspiration

Status

In development. JavaScript code in Markdown documentation can be parsed via the API or CLI, but there is no support for running code yet (see 1.0.0 milestone).

Usage

Library

Install doc-validator as a dependency. All commands take a Markdown source string and return an Array of any Errors reported. Errors are not thrown to make it easier to detect multiple errors from separate JavaScript code examples in the same file, so you will probably want to print or throw them.

Tool

Install doc-validator globally for any project, or as a local development dependency for CI and test scripts. Use with a filename like doc-validator parse README.md to parse existing Markdown files, or pass stdin with no path argument for advanced scripting.

API

parse

Parses JavaScript using Babel. Modern standardized syntax is supported, including ES modules (supported by Node).

const { parse } = require("doc-validator")
;(async () => {
  await parse('```js\nconsole.log("Hello, world!")\n```')
})()

Planned

  • type
  • run
  • test

Readme

Keywords

none

Package Sidebar

Install

npm i doc-validator

Weekly Downloads

3

Version

0.3.0

License

ISC

Unpacked Size

5.47 kB

Total Files

12

Last publish

Collaborators

  • nickmccurdy