[New Feature] Add web folder to support web documentation

This commit is contained in:
Rudy Haryanto
2022-10-04 20:17:17 +07:00
parent c27f624ca8
commit a54aa04c9b
251 changed files with 11079 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
const path = require('path');
const fs = require('fs');
const test = require('tape');
const remark = require('remark');
const snackplayer = require('../');
const read = name => fs.readFileSync(path.join(__dirname, name), 'utf8');
const normalizeLineEndings = str => str.replace(/\r\n/g, '\n');
test('remark-snackplayer', async t => {
const processor = remark().use(snackplayer);
processor.process(read('markdown/test1.md'), (err, file) => {
if (err) t.fail('Failed to process markdown/test1.md');
t.equal(
normalizeLineEndings(String(file)),
normalizeLineEndings(read('output/output1.html')),
'With 1 Code Block'
);
});
processor.process(read('markdown/test2.md'), (err, file) => {
if (err) t.fail('Failed to process markdown/test2.md');
t.equal(
normalizeLineEndings(String(file)),
normalizeLineEndings(read('output/output2.html')),
'With 2 Code Blocks'
);
});
});