/** * Created by Tivie on 15-01-2015. */ //let showdown = require('../../.build/showdown.js') || require('showdown'); chai.should(); describe('showdown.Converter', function () { 'use strict'; describe('Converter.options extensions', function () { let runCount; showdown.extension('testext', function () { return [{ type: 'output', filter: function (text) { runCount = runCount + 1; return text; } }]; }); let converter = new showdown.Converter({extensions: ['testext']}); it('output extensions should run once', function () { runCount = 0; converter.makeHtml('# testext'); runCount.should.equal(1); }); }); describe('makeHtml() with option omitExtraWLInCodeBlocks', function () { let converter = new showdown.Converter({omitExtraWLInCodeBlocks: true}), text = 'var foo = bar;', html = converter.makeHtml(' ' + text); it('should omit extra line after code tag', function () { let expectedHtml = '
' + text + '
';
html.should.equal(expectedHtml);
});
});
describe('makeHtml() with option prefixHeaderId', function () {
let converter = new showdown.Converter(),
text = 'foo header';
it('should prefix header id with "section"', function () {
converter.setOption('prefixHeaderId', true);
let html = converter.makeHtml('# ' + text),
expectedHtml = '