https://github.com/markdown-it/markdown-it-testgen
Tests generator for markdown-it and plugins
https://github.com/markdown-it/markdown-it-testgen
Last synced: about 2 months ago
JSON representation
Tests generator for markdown-it and plugins
- Host: GitHub
- URL: https://github.com/markdown-it/markdown-it-testgen
- Owner: markdown-it
- License: mit
- Created: 2014-12-20T18:11:35.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2019-07-09T04:09:49.000Z (almost 7 years ago)
- Last Synced: 2026-02-25T21:32:55.889Z (2 months ago)
- Language: JavaScript
- Size: 17.6 KB
- Stars: 8
- Watchers: 5
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# markdown-it-testgen
[](https://travis-ci.org/markdown-it/markdown-it-testgen)
[](https://www.npmjs.org/package/markdown-it-testgen)
> This package parses fixtures in commonmark spec format and generates tests for
[markdown-it](https://github.com/markdown-it/markdown-it) parser and
[plugins](https://www.npmjs.org/browse/keyword/markdown-it-plugin).
```bash
npm install markdown-it-testgen
```
## Fixture format
Each fixture can have optional metadata in yaml format:
```yaml
---
desc: Batch description # file name used if not exists.
skip: true # mark batch as pending
---
```
Then tests should follow in this format:
```
optional header
.
source
data
.
parsed
data
.
header2
.
src
.
result
.
```
If header missed - line number will be used instead.
## API
### module.exports(path, options, md)
- __path__ - file or directory name
- __options__ (not mandatory)
- __header__ - Default `false`. Set `true` to use heaters for test names
- __sep__ - array of allowed separators for samples, [ '.' ] by default
- __assert__ - custom assertion package, `require('chai').assert` by default.
- __md__ - `markdown-it` instance to parse and compare samples
### module.exports.load(path, options, iterator)
For each loaded file - parse and pass data to iterator functions. Currently used for tests only.
## License
[MIT](https://github.com/markdown-it/markdown-it-testgen/blob/master/LICENSE)