File: README.md

package info (click to toggle)
node-markdown-it 22.2.3%2Bdfsg%2B~12.2.3-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,816 kB
  • sloc: javascript: 6,872; makefile: 226
file content (71 lines) | stat: -rw-r--r-- 1,608 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# markdown-it-testgen

[![Build Status](https://img.shields.io/travis/markdown-it/markdown-it-testgen/master.svg?style=flat)](https://travis-ci.org/markdown-it/markdown-it-testgen)
[![NPM version](https://img.shields.io/npm/v/markdown-it-testgen.svg?style=flat)](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)