forked from vkarpov15/dookie
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocs.js
More file actions
24 lines (18 loc) · 691 Bytes
/
docs.js
File metadata and controls
24 lines (18 loc) · 691 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
'use strict';
const acquit = require('acquit');
const fs = require('fs');
require('acquit-ignore')();
require('acquit-markdown')();
acquit.output(function(str) {
return str.replace(/acquit:ignore:end\s+/g, '');
});
const header = fs.readFileSync('./HEADER.md', 'utf8');
let markdown =
acquit.parse(fs.readFileSync('./test/examples.test.js', 'utf8'));
const re = new RegExp('@import:[\\S]+', 'g');
markdown.match(re).forEach(function(statement) {
const file = statement.substr('@import:'.length);
const data = fs.readFileSync(file, 'utf8');
markdown = markdown.replace(statement, '```yaml\n' + data + '\n```');
});
fs.writeFileSync('./README.md', `${header}\n\n${markdown}`);