Markdown parser, done right. 100% CommonMark support, extensions, syntax plugins & high speed
https://markdown-it.github.io/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
834 B
29 lines
834 B
1 year ago
|
#!/usr/bin/env node
|
||
|
|
||
|
import shell from 'shelljs';
|
||
|
import { readFileSync, writeFileSync } from 'fs';
|
||
|
|
||
|
function escape(input) {
|
||
|
return input
|
||
|
.replaceAll('&', '&')
|
||
|
.replaceAll('<', '<')
|
||
|
.replaceAll('>', '>')
|
||
|
.replaceAll('"', '"');
|
||
|
//.replaceAll("'", ''');
|
||
|
}
|
||
|
|
||
|
shell.rm('-rf', 'demo');
|
||
|
shell.mkdir('demo');
|
||
|
|
||
|
shell.cp('support/demo_template/README.md', 'demo/');
|
||
|
shell.cp('support/demo_template/index.css', 'demo/');
|
||
|
|
||
|
// Read html template and inject escaped sample
|
||
|
const html = readFileSync('support/demo_template/index.html', 'utf8');
|
||
|
const sample = readFileSync('support/demo_template/sample.md', 'utf8');
|
||
|
|
||
|
const output = html.replace('<!--SAMPLE-->', escape(sample));
|
||
|
writeFileSync('demo/index.html', output);
|
||
|
|
||
|
shell.exec('node_modules/.bin/rollup -c support/demo_template/rollup.config.mjs');
|