https://github.com/nickserv/doc-validator
A library/tool for validating JavaScript code in Markdown documentation
https://github.com/nickserv/doc-validator
Last synced: 11 months ago
JSON representation
A library/tool for validating JavaScript code in Markdown documentation
- Host: GitHub
- URL: https://github.com/nickserv/doc-validator
- Owner: nickserv
- Created: 2021-03-27T06:13:36.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-03-05T23:18:14.000Z (over 3 years ago)
- Last Synced: 2025-09-06T04:46:44.638Z (11 months ago)
- Language: JavaScript
- Homepage:
- Size: 292 KB
- Stars: 5
- Watchers: 3
- Forks: 2
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
Awesome Lists containing this project
README
# `doc-validator`
A library/tool for validating JavaScript code in Markdown documentation
## [Inspiration](https://twitter.com/bitandbang/status/1375534850506129418)
## 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](https://github.com/nickmccurdy/doc-validator/milestone/1)).
## 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).
````js
const { parse } = require("doc-validator")
;(async () => {
await parse('```js\nconsole.log("Hello, world!")\n```')
})()
````
### Planned
- `type`
- `run`
- `test`