'user strict'; import plugin from '..'; const test = require('ava'); const unified = require('unified'); const raw = require('rehype-raw'); const reParse = require('remark-parse'); const stringify = require('rehype-stringify'); const remark2rehype = require('remark-rehype'); const parse5 = require('parse5'); const render = text => unified() .use(reParse) .use(plugin) .use(remark2rehype) .use(stringify) .processSync(text); const renderRaw = text => unified() .use(reParse) .use(plugin) .use(remark2rehype, {allowDangerousHTML: true}) .use(raw) .use(stringify) .processSync(text); test('simple citation', t => { const {contents} = render('>This is a citation'); t.deepEqual(parse5.parse(contents), parse5.parse('
\n') ); }); test('simple citation raw', t => { const {contents} = renderRaw('>This is a citation'); t.deepEqual(parse5.parse(contents), parse5.parse('This is a citation
\n
\n') ); }); test('question', t => { const {contents} = renderRaw('>!question\nWhat does the š¦ say ?'); t.deepEqual(parse5.parse(contents), parse5.parse('This is a citation
\n
What does the š¦ say ?
Be carefull
š
ā¢ļø
š¤«