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.
35 lines
908 B
35 lines
908 B
'use strict';
|
|
|
|
|
|
var p = require('path');
|
|
var load = require('markdown-it-testgen').load;
|
|
var assert = require('chai').assert;
|
|
|
|
|
|
function normalize(text) {
|
|
return text.replace(/<blockquote>\n<\/blockquote>/g, '<blockquote></blockquote>');
|
|
}
|
|
|
|
|
|
function generate(path, md) {
|
|
load(path, function (data) {
|
|
data.meta = data.meta || {};
|
|
|
|
var desc = data.meta.desc || p.relative(path, data.file);
|
|
|
|
(data.meta.skip ? describe.skip : describe)(desc, function () {
|
|
data.fixtures.forEach(function (fixture) {
|
|
it(fixture.header ? fixture.header : 'line ' + (fixture.first.range[0] - 1), function () {
|
|
assert.strictEqual(md.render(fixture.first.text), normalize(fixture.second.text));
|
|
});
|
|
});
|
|
});
|
|
});
|
|
}
|
|
|
|
|
|
describe('CommonMark', function () {
|
|
var md = require('../')('commonmark');
|
|
|
|
generate(p.join(__dirname, 'fixtures/commonmark/good.txt'), md);
|
|
});
|
|
|