addons-linter/scripts/build-rules

20 строки
614 B
JavaScript
Executable File

#!/usr/bin/env node
/* eslint-disable import/no-extraneous-dependencies, global-require */
const fs = require('fs');
const md = require('markdown-it')();
const markdownItAnchor = require('markdown-it-anchor');
const markdownItFootnote = require('markdown-it-footnote');
md.use(markdownItAnchor, {
permalink: true,
});
md.use(markdownItFootnote);
const markdown = md.render(
fs.readFileSync('docs/rules.md', { encoding: 'utf8' })
);
const template = fs.readFileSync('docs/rules.tmpl', { encoding: 'utf8' });
const html = template.replace('{{MARKDOWN}}', markdown);
fs.writeFileSync('docs/index.html', html);