mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2025-08-31 18:04:07 +07:00
Add markdown format support (#25)
Co-authored-by: Dawid Dziurla <dawidd0811@gmail.com>
This commit is contained in:
18
node_modules/showdown/test/node/cli.js
generated
vendored
Normal file
18
node_modules/showdown/test/node/cli.js
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
var semver = require('semver'),
|
||||
cmd = 'node bin/showdown.js';
|
||||
|
||||
describe('showdown cli', function () {
|
||||
'use strict';
|
||||
if (semver.gt(process.versions.node, '0.12.0')) {
|
||||
var execSync = require('child_process').execSync;
|
||||
it('basic stdin stdout', function () {
|
||||
var otp = execSync(cmd + ' makehtml -q', {
|
||||
encoding: 'utf8',
|
||||
input: '**foo**'
|
||||
});
|
||||
otp.trim().should.equal('<p><strong>foo</strong></p>');
|
||||
});
|
||||
}
|
||||
});
|
||||
*/
|
146
node_modules/showdown/test/node/performance.js
generated
vendored
Normal file
146
node_modules/showdown/test/node/performance.js
generated
vendored
Normal file
@ -0,0 +1,146 @@
|
||||
/**
|
||||
* Created by Tivie on 21/12/2016.
|
||||
*/
|
||||
'use strict';
|
||||
var fs = require('fs'),
|
||||
showdown = require('../bootstrap').showdown,
|
||||
converter = new showdown.Converter(),
|
||||
pkg = require('../../package.json'),
|
||||
performance = require('../performance/performance.js');
|
||||
|
||||
performance.setLibraryName(pkg.name);
|
||||
performance.setVersion(pkg.version);
|
||||
performance.setGithubLink('https://github.com/showdownjs/showdown/tree/');
|
||||
|
||||
var globals = {
|
||||
gHtmlBlocks: [],
|
||||
gHtmlMdBlocks: [],
|
||||
gHtmlSpans: [],
|
||||
gUrls: {},
|
||||
gTitles: {},
|
||||
gDimensions: {},
|
||||
gListLevel: 0,
|
||||
hashLinkCounts: {},
|
||||
langExtensions: [],
|
||||
outputModifiers: [],
|
||||
converter: converter,
|
||||
ghCodeBlocks: []
|
||||
},
|
||||
options = showdown.getOptions();
|
||||
|
||||
function runTests () {
|
||||
var testMDFile = fs.readFileSync('test/performance.testfile.md', 'utf8');
|
||||
new performance.Suite('Basic')
|
||||
.setOption('cycles', 50)
|
||||
.add('Simple "Hello World"', function () {
|
||||
converter.makeHtml('*Hello* **World**!');
|
||||
})
|
||||
.add('performance.testfile.md', {
|
||||
prepare: function () {
|
||||
return testMDFile;
|
||||
},
|
||||
test: function (mdText) {
|
||||
converter.makeHtml(mdText);
|
||||
}
|
||||
});
|
||||
new performance.Suite('subParsers')
|
||||
.setOption('cycles', 20)
|
||||
.add('hashHTMLBlocks', function () {
|
||||
showdown.subParser('hashHTMLBlocks')(testMDFile, options, globals);
|
||||
})
|
||||
.add('anchors', function () {
|
||||
showdown.subParser('anchors')(testMDFile, options, globals);
|
||||
})
|
||||
.add('autoLinks', function () {
|
||||
showdown.subParser('autoLinks')(testMDFile, options, globals);
|
||||
})
|
||||
/*
|
||||
.add('blockGamut', function () {
|
||||
showdown.subParser('blockGamut')(testMDFile, options, globals);
|
||||
})
|
||||
*/
|
||||
.add('blockQuotes', function () {
|
||||
showdown.subParser('blockQuotes')(testMDFile, options, globals);
|
||||
})
|
||||
.add('codeBlocks', function () {
|
||||
showdown.subParser('codeBlocks')(testMDFile, options, globals);
|
||||
})
|
||||
.add('codeSpans', function () {
|
||||
showdown.subParser('codeSpans')(testMDFile, options, globals);
|
||||
})
|
||||
.add('detab', function () {
|
||||
showdown.subParser('detab')(testMDFile, options, globals);
|
||||
})
|
||||
.add('encodeAmpsAndAngles', function () {
|
||||
showdown.subParser('encodeAmpsAndAngles')(testMDFile, options, globals);
|
||||
})
|
||||
.add('encodeBackslashEscapes', function () {
|
||||
showdown.subParser('encodeBackslashEscapes')(testMDFile, options, globals);
|
||||
})
|
||||
.add('encodeCode', function () {
|
||||
showdown.subParser('encodeCode')(testMDFile, options, globals);
|
||||
})
|
||||
.add('escapeSpecialCharsWithinTagAttributes', function () {
|
||||
showdown.subParser('escapeSpecialCharsWithinTagAttributes')(testMDFile, options, globals);
|
||||
})
|
||||
.add('githubCodeBlocks', function () {
|
||||
showdown.subParser('githubCodeBlocks')(testMDFile, options, globals);
|
||||
})
|
||||
.add('hashBlock', function () {
|
||||
showdown.subParser('hashBlock')(testMDFile, options, globals);
|
||||
})
|
||||
.add('hashElement', function () {
|
||||
showdown.subParser('hashElement')(testMDFile, options, globals);
|
||||
})
|
||||
.add('hashHTMLSpans', function () {
|
||||
showdown.subParser('hashHTMLSpans')(testMDFile, options, globals);
|
||||
})
|
||||
.add('hashPreCodeTags', function () {
|
||||
showdown.subParser('hashPreCodeTags')(testMDFile, options, globals);
|
||||
})
|
||||
.add('headers', function () {
|
||||
showdown.subParser('headers')(testMDFile, options, globals);
|
||||
})
|
||||
.add('horizontalRule', function () {
|
||||
showdown.subParser('horizontalRule')(testMDFile, options, globals);
|
||||
})
|
||||
.add('images', function () {
|
||||
showdown.subParser('images')(testMDFile, options, globals);
|
||||
})
|
||||
.add('italicsAndBold', function () {
|
||||
showdown.subParser('italicsAndBold')(testMDFile, options, globals);
|
||||
})
|
||||
.add('lists', function () {
|
||||
showdown.subParser('lists')(testMDFile, options, globals);
|
||||
})
|
||||
.add('outdent', function () {
|
||||
showdown.subParser('outdent')(testMDFile, options, globals);
|
||||
})
|
||||
.add('paragraphs', function () {
|
||||
showdown.subParser('paragraphs')(testMDFile, options, globals);
|
||||
})
|
||||
.add('spanGamut', function () {
|
||||
showdown.subParser('spanGamut')(testMDFile, options, globals);
|
||||
})
|
||||
.add('strikethrough', function () {
|
||||
showdown.subParser('strikethrough')(testMDFile, options, globals);
|
||||
})
|
||||
.add('stripLinkDefinitions', function () {
|
||||
showdown.subParser('stripLinkDefinitions')(testMDFile, options, globals);
|
||||
})
|
||||
.add('tables', function () {
|
||||
showdown.subParser('tables')(testMDFile, options, globals);
|
||||
})
|
||||
.add('unescapeSpecialChars', function () {
|
||||
showdown.subParser('unescapeSpecialChars')(testMDFile, options, globals);
|
||||
});
|
||||
}
|
||||
|
||||
function generateLogs () {
|
||||
performance.generateLog(null, null, true);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
runTests: runTests,
|
||||
generateLogs: generateLogs
|
||||
};
|
184
node_modules/showdown/test/node/showdown.Converter.js
generated
vendored
Normal file
184
node_modules/showdown/test/node/showdown.Converter.js
generated
vendored
Normal file
@ -0,0 +1,184 @@
|
||||
/**
|
||||
* Created by Estevao on 31-05-2015.
|
||||
*/
|
||||
require('source-map-support').install();
|
||||
require('chai').should();
|
||||
require('sinon');
|
||||
var showdown = require('../bootstrap').showdown;
|
||||
|
||||
describe('showdown.Converter', function () {
|
||||
'use strict';
|
||||
|
||||
describe('option methods', function () {
|
||||
var converter = new showdown.Converter();
|
||||
|
||||
it('setOption() should set option foo=baz', function () {
|
||||
converter.setOption('foo', 'baz');
|
||||
});
|
||||
|
||||
it('getOption() should get option foo to equal baz', function () {
|
||||
converter.getOption('foo').should.equal('baz');
|
||||
});
|
||||
|
||||
it('getOptions() should contain foo=baz', function () {
|
||||
var options = converter.getOptions();
|
||||
options.should.have.ownProperty('foo');
|
||||
options.foo.should.equal('baz');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Converter.options extensions', function () {
|
||||
var runCount;
|
||||
showdown.extension('testext', function () {
|
||||
return [{
|
||||
type: 'output',
|
||||
filter: function (text) {
|
||||
runCount = runCount + 1;
|
||||
return text;
|
||||
}
|
||||
}];
|
||||
});
|
||||
|
||||
var converter = new showdown.Converter({extensions: ['testext']});
|
||||
|
||||
it('output extensions should run once', function () {
|
||||
runCount = 0;
|
||||
converter.makeHtml('# testext');
|
||||
runCount.should.equal(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('metadata methods', function () {
|
||||
var converter = new showdown.Converter();
|
||||
|
||||
it('_setMetadataPair() should set foo to bar', function () {
|
||||
converter._setMetadataPair('foo', 'bar');
|
||||
converter.getMetadata().should.eql({foo: 'bar'});
|
||||
});
|
||||
|
||||
it('_setMetadata should set metadata to {baz: bazinga}', function () {
|
||||
converter._setMetadataRaw('{baz: bazinga}');
|
||||
converter.getMetadata(true).should.eql('{baz: bazinga}');
|
||||
});
|
||||
});
|
||||
|
||||
describe('converter.setFlavor()', function () {
|
||||
|
||||
/**
|
||||
* Test setFlavor('github')
|
||||
*/
|
||||
describe('github', function () {
|
||||
var converter = new showdown.Converter(),
|
||||
ghOpts = showdown.getFlavorOptions('github');
|
||||
|
||||
converter.setFlavor('github');
|
||||
|
||||
for (var opt in ghOpts) {
|
||||
if (ghOpts.hasOwnProperty(opt)) {
|
||||
check(opt, ghOpts[opt]);
|
||||
}
|
||||
}
|
||||
function check (key, val) {
|
||||
it('should set ' + opt + ' to ' + val, function () {
|
||||
converter.getOption(key).should.equal(val);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe('getFlavor method', function () {
|
||||
|
||||
// reset showdown
|
||||
showdown.setFlavor('vanilla');
|
||||
|
||||
describe('flavor', function () {
|
||||
it('should be vanilla by default', function () {
|
||||
var converter = new showdown.Converter();
|
||||
converter.getFlavor().should.equal('vanilla');
|
||||
});
|
||||
|
||||
it('should be changed if global option is changed', function () {
|
||||
showdown.setFlavor('github');
|
||||
var converter = new showdown.Converter();
|
||||
converter.getFlavor().should.equal('github');
|
||||
showdown.setFlavor('vanilla');
|
||||
});
|
||||
|
||||
it('should not be changed if converter is initialized before global change', function () {
|
||||
var converter = new showdown.Converter();
|
||||
showdown.setFlavor('github');
|
||||
converter.getFlavor().should.equal('vanilla');
|
||||
showdown.setFlavor('vanilla');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('extension methods', function () {
|
||||
var extObjMock = {
|
||||
type: 'lang',
|
||||
filter: function () {}
|
||||
},
|
||||
extObjFunc = function () {
|
||||
return extObjMock;
|
||||
};
|
||||
|
||||
it('addExtension() should add an extension Object', function () {
|
||||
var converter = new showdown.Converter();
|
||||
converter.addExtension(extObjMock);
|
||||
converter.getAllExtensions().language.should.contain(extObjMock);
|
||||
});
|
||||
|
||||
it('addExtension() should unwrap an extension wrapped in a function', function () {
|
||||
var converter = new showdown.Converter();
|
||||
|
||||
converter.addExtension(extObjFunc);
|
||||
converter.getAllExtensions().language.should.contain(extObjMock);
|
||||
});
|
||||
|
||||
it('useExtension() should use a previous registered extension in showdown', function () {
|
||||
showdown.extension('foo', extObjMock);
|
||||
var converter = new showdown.Converter();
|
||||
|
||||
converter.useExtension('foo');
|
||||
converter.getAllExtensions().language.should.contain(extObjMock);
|
||||
showdown.resetExtensions();
|
||||
});
|
||||
});
|
||||
|
||||
describe('events', function () {
|
||||
var events = [
|
||||
'anchors',
|
||||
'autoLinks',
|
||||
'blockGamut',
|
||||
'blockQuotes',
|
||||
'codeBlocks',
|
||||
'codeSpans',
|
||||
'githubCodeBlocks',
|
||||
'headers',
|
||||
'images',
|
||||
'italicsAndBold',
|
||||
'lists',
|
||||
'paragraph',
|
||||
'spanGamut'
|
||||
//'strikeThrough',
|
||||
//'tables'
|
||||
];
|
||||
|
||||
for (var i = 0; i < events.length; ++i) {
|
||||
runListener(events[i] + '.before');
|
||||
runListener(events[i] + '.after');
|
||||
}
|
||||
|
||||
function runListener (name) {
|
||||
it('should listen to ' + name, function () {
|
||||
var converter = new showdown.Converter();
|
||||
converter.listen(name, function (evtName, text) {
|
||||
evtName.should.equal(name);
|
||||
text.should.match(/^[\s\S]*foo[\s\S]*$/);
|
||||
return text;
|
||||
})
|
||||
.makeHtml('foo');
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
78
node_modules/showdown/test/node/showdown.Converter.makeHtml.js
generated
vendored
Normal file
78
node_modules/showdown/test/node/showdown.Converter.makeHtml.js
generated
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
/**
|
||||
* Created by Estevao on 15-01-2015.
|
||||
*/
|
||||
|
||||
describe('showdown.Converter', function () {
|
||||
'use strict';
|
||||
|
||||
require('source-map-support').install();
|
||||
require('chai').should();
|
||||
|
||||
var showdown = require('../bootstrap').showdown;
|
||||
|
||||
describe('makeHtml() with option omitExtraWLInCodeBlocks', function () {
|
||||
var converter = new showdown.Converter({omitExtraWLInCodeBlocks: true}),
|
||||
text = 'var foo = bar;',
|
||||
html = converter.makeHtml(' ' + text);
|
||||
it('should omit extra line after code tag', function () {
|
||||
var expectedHtml = '<pre><code>' + text + '</code></pre>';
|
||||
html.should.equal(expectedHtml);
|
||||
});
|
||||
});
|
||||
|
||||
describe('makeHtml() with option prefixHeaderId', function () {
|
||||
var converter = new showdown.Converter(),
|
||||
text = 'foo header';
|
||||
|
||||
it('should prefix header id with "section"', function () {
|
||||
converter.setOption('prefixHeaderId', true);
|
||||
var html = converter.makeHtml('# ' + text),
|
||||
expectedHtml = '<h1 id="sectionfooheader">' + text + '</h1>';
|
||||
html.should.equal(expectedHtml);
|
||||
});
|
||||
|
||||
it('should prefix header id with custom string', function () {
|
||||
converter.setOption('prefixHeaderId', 'blabla');
|
||||
var html = converter.makeHtml('# ' + text),
|
||||
expectedHtml = '<h1 id="blablafooheader">' + text + '</h1>';
|
||||
html.should.equal(expectedHtml);
|
||||
});
|
||||
});
|
||||
|
||||
describe('makeHtml() with option metadata', function () {
|
||||
var converter = new showdown.Converter(),
|
||||
text1 =
|
||||
'---SIMPLE\n' +
|
||||
'foo: bar\n' +
|
||||
'baz: bazinga\n' +
|
||||
'---\n',
|
||||
text2 =
|
||||
'---TIVIE\n' +
|
||||
'a: b\n' +
|
||||
'c: 123\n' +
|
||||
'---\n';
|
||||
|
||||
it('should correctly set metadata', function () {
|
||||
converter.setOption('metadata', true);
|
||||
|
||||
var expectedHtml = '',
|
||||
expectedObj = {foo: 'bar', baz: 'bazinga'},
|
||||
expectedRaw = 'foo: bar\nbaz: bazinga',
|
||||
expectedFormat = 'SIMPLE';
|
||||
converter.makeHtml(text1).should.equal(expectedHtml);
|
||||
converter.getMetadata().should.eql(expectedObj);
|
||||
converter.getMetadata(true).should.equal(expectedRaw);
|
||||
converter.getMetadataFormat().should.equal(expectedFormat);
|
||||
});
|
||||
|
||||
it('consecutive calls should reset metadata', function () {
|
||||
converter.makeHtml(text2);
|
||||
var expectedObj = {a: 'b', c: '123'},
|
||||
expectedRaw = 'a: b\nc: 123',
|
||||
expectedFormat = 'TIVIE';
|
||||
converter.getMetadata().should.eql(expectedObj);
|
||||
converter.getMetadata(true).should.equal(expectedRaw);
|
||||
converter.getMetadataFormat().should.equal(expectedFormat);
|
||||
});
|
||||
});
|
||||
});
|
25
node_modules/showdown/test/node/showdown.Converter.makeMarkdown.js
generated
vendored
Normal file
25
node_modules/showdown/test/node/showdown.Converter.makeMarkdown.js
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Created by Estevao on 15-01-2015.
|
||||
*/
|
||||
|
||||
describe('showdown.Converter', function () {
|
||||
'use strict';
|
||||
|
||||
require('source-map-support').install();
|
||||
require('chai').should();
|
||||
var jsdom = require('jsdom');
|
||||
var document = new jsdom.JSDOM('', {}).window.document; // jshint ignore:line
|
||||
var showdown = require('../bootstrap').showdown;
|
||||
|
||||
describe('makeMarkdown()', function () {
|
||||
var converter = new showdown.Converter();
|
||||
|
||||
it('should parse a simple html string', function () {
|
||||
var html = '<a href="/somefoo.html">a link</a>\n';
|
||||
var md = '[a link](</somefoo.html>)';
|
||||
|
||||
converter.makeMd(html, document).should.equal(md);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
248
node_modules/showdown/test/node/showdown.helpers.js
generated
vendored
Normal file
248
node_modules/showdown/test/node/showdown.helpers.js
generated
vendored
Normal file
@ -0,0 +1,248 @@
|
||||
/**
|
||||
* Created by Estevao on 27/01/2017.
|
||||
*/
|
||||
/*jshint expr: true*/
|
||||
/*jshint -W053 */
|
||||
/*jshint -W010 */
|
||||
/*jshint -W009 */
|
||||
var bootstrap = require('../bootstrap.js'),
|
||||
showdown = bootstrap.showdown;
|
||||
|
||||
describe('encodeEmailAddress()', function () {
|
||||
'use strict';
|
||||
var encoder = showdown.helper.encodeEmailAddress,
|
||||
email = 'foobar@example.com',
|
||||
encodedEmail = encoder(email);
|
||||
|
||||
it('should encode email', function () {
|
||||
encodedEmail.should.not.equal(email);
|
||||
});
|
||||
|
||||
it('should decode to original email', function () {
|
||||
var decodedEmail = encodedEmail.replace(/&#(.+?);/g, function (wm, cc) {
|
||||
if (cc.charAt(0) === 'x') {
|
||||
//hex
|
||||
return String.fromCharCode('0' + cc);
|
||||
} else {
|
||||
//dec
|
||||
return String.fromCharCode(cc);
|
||||
}
|
||||
});
|
||||
decodedEmail.should.equal(email);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isString()', function () {
|
||||
'use strict';
|
||||
var isString = showdown.helper.isString;
|
||||
|
||||
it('should return true for new String Object', function () {
|
||||
isString(new String('some string')).should.be.true;
|
||||
});
|
||||
|
||||
it('should return true for String Object', function () {
|
||||
isString(String('some string')).should.be.true;
|
||||
});
|
||||
|
||||
it('should return true for string literal', function () {
|
||||
isString('some string').should.be.true;
|
||||
});
|
||||
|
||||
it('should return false for integers', function () {
|
||||
isString(5).should.be.false;
|
||||
});
|
||||
|
||||
it('should return false for random objects', function () {
|
||||
isString({foo: 'bar'}).should.be.false;
|
||||
});
|
||||
|
||||
it('should return false for arrays', function () {
|
||||
isString(['bar']).should.be.false;
|
||||
});
|
||||
});
|
||||
|
||||
describe('isFunction()', function () {
|
||||
'use strict';
|
||||
var isFunction = showdown.helper.isFunction;
|
||||
|
||||
it('should return true for closures', function () {
|
||||
isFunction(function () {}).should.be.true;
|
||||
});
|
||||
|
||||
it('should return true for defined functions', function () {
|
||||
function foo () {}
|
||||
isFunction(foo).should.be.true;
|
||||
});
|
||||
|
||||
it('should return true for function variables', function () {
|
||||
var bar = function () {};
|
||||
isFunction(bar).should.be.true;
|
||||
});
|
||||
|
||||
it('should return false for hash objects', function () {
|
||||
isFunction({}).should.be.false;
|
||||
});
|
||||
|
||||
it('should return false for objects', function () {
|
||||
isFunction(new Object ()).should.be.false;
|
||||
});
|
||||
|
||||
it('should return false for string primitives', function () {
|
||||
isFunction('foo').should.be.false;
|
||||
});
|
||||
});
|
||||
|
||||
describe('isArray()', function () {
|
||||
'use strict';
|
||||
var isArray = showdown.helper.isArray;
|
||||
|
||||
it('should return true for short syntax arrays', function () {
|
||||
isArray([]).should.be.true;
|
||||
});
|
||||
|
||||
it('should return true for array objects', function () {
|
||||
var myArr = new Array();
|
||||
isArray(myArr).should.be.true;
|
||||
});
|
||||
|
||||
it('should return false for functions', function () {
|
||||
isArray(function () {}).should.be.false;
|
||||
function baz () {}
|
||||
isArray(baz).should.be.false;
|
||||
});
|
||||
|
||||
it('should return false for objects', function () {
|
||||
isArray({}).should.be.false;
|
||||
isArray(new Object ()).should.be.false;
|
||||
});
|
||||
|
||||
it('should return false for strings', function () {
|
||||
isArray('foo').should.be.false;
|
||||
isArray(new String('foo')).should.be.false;
|
||||
});
|
||||
});
|
||||
|
||||
describe('isUndefined()', function () {
|
||||
'use strict';
|
||||
var isUndefined = showdown.helper.isUndefined;
|
||||
|
||||
it('should return true if nothing is passed', function () {
|
||||
isUndefined().should.be.true;
|
||||
});
|
||||
|
||||
it('should return true if a variable is initialized but not defined', function () {
|
||||
var myVar;
|
||||
isUndefined(myVar).should.be.true;
|
||||
});
|
||||
|
||||
it('should return false for null', function () {
|
||||
isUndefined(null).should.be.false;
|
||||
});
|
||||
|
||||
it('should return false for 0', function () {
|
||||
isUndefined(0).should.be.false;
|
||||
});
|
||||
|
||||
it('should return false for empty string', function () {
|
||||
isUndefined('').should.be.false;
|
||||
});
|
||||
|
||||
it('should return false for empty booleans false or true', function () {
|
||||
isUndefined(false).should.be.false;
|
||||
isUndefined(true).should.be.false;
|
||||
});
|
||||
|
||||
it('should return false for anything not undefined', function () {
|
||||
isUndefined('foo').should.be.false;
|
||||
isUndefined(2).should.be.false;
|
||||
isUndefined({}).should.be.false;
|
||||
});
|
||||
});
|
||||
|
||||
describe('stdExtName()', function () {
|
||||
'use strict';
|
||||
var stdExtName = showdown.helper.stdExtName;
|
||||
|
||||
it('should remove certain chars', function () {
|
||||
var str = 'bla_- \nbla';
|
||||
//[_?*+\/\\.^-]
|
||||
stdExtName(str).should.not.match(/[_?*+\/\\.^-]/g);
|
||||
});
|
||||
it('should make everything lowercase', function () {
|
||||
var str = 'BLABLA';
|
||||
//[_?*+\/\\.^-]
|
||||
stdExtName(str).should.equal('blabla');
|
||||
});
|
||||
});
|
||||
|
||||
describe('forEach()', function () {
|
||||
'use strict';
|
||||
var forEach = showdown.helper.forEach;
|
||||
|
||||
it('should throw an error if first parameter is undefined', function () {
|
||||
(function () {forEach();}).should.throw('obj param is required');
|
||||
});
|
||||
|
||||
it('should throw an error if second parameter is undefined', function () {
|
||||
(function () {forEach([]);}).should.throw('callback param is required');
|
||||
});
|
||||
|
||||
it('should throw an error if second parameter is not a function', function () {
|
||||
(function () {forEach([], 'foo');}).should.throw('callback param must be a function/closure');
|
||||
});
|
||||
|
||||
it('should throw an error if first parameter is not an object or an array', function () {
|
||||
(function () {forEach('foo', function () {});}).should.throw('obj does not seem to be an array or an iterable object');
|
||||
});
|
||||
|
||||
it('should not throw even if object is empty', function () {
|
||||
(function () {forEach({}, function () {});}).should.not.throw();
|
||||
});
|
||||
|
||||
it('should iterate array items', function () {
|
||||
var myArray = ['banana', 'orange', 'grape'];
|
||||
forEach(myArray, function (val, key, obj) {
|
||||
key.should.be.a('number');
|
||||
(key % 1).should.equal(0);
|
||||
val.should.equal(myArray[key]);
|
||||
obj.should.equal(myArray);
|
||||
});
|
||||
});
|
||||
|
||||
it('should iterate over object properties', function () {
|
||||
var myObj = {foo: 'banana', bar: 'orange', baz: 'grape'};
|
||||
forEach(myObj, function (val, key, obj) {
|
||||
myObj.should.have.ownProperty(key);
|
||||
val.should.equal(myObj[key]);
|
||||
obj.should.equal(myObj);
|
||||
});
|
||||
});
|
||||
|
||||
it('should iterate only over object own properties', function () {
|
||||
var Obj1 = {foo: 'banana'},
|
||||
myObj = Object.create(Obj1);
|
||||
myObj.bar = 'orange';
|
||||
myObj.baz = 'grape';
|
||||
|
||||
myObj.should.have.ownProperty('bar');
|
||||
myObj.should.have.ownProperty('baz');
|
||||
myObj.should.not.have.ownProperty('foo');
|
||||
|
||||
forEach(myObj, function (val, key) {
|
||||
key.should.not.equal('foo');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('matchRecursiveRegExp()', function () {
|
||||
'use strict';
|
||||
|
||||
var rRegExp = showdown.helper.matchRecursiveRegExp;
|
||||
|
||||
it('should match nested elements', function () {
|
||||
var result = rRegExp('<div><div>a</div></div>', '<div\\b[^>]*>', '</div>', 'gim');
|
||||
result.should.deep.equal([['<div><div>a</div></div>', '<div>a</div>', '<div>', '</div>']]);
|
||||
});
|
||||
|
||||
});
|
||||
|
158
node_modules/showdown/test/node/showdown.js
generated
vendored
Normal file
158
node_modules/showdown/test/node/showdown.js
generated
vendored
Normal file
@ -0,0 +1,158 @@
|
||||
require('source-map-support').install();
|
||||
require('chai').should();
|
||||
var expect = require('chai').expect,
|
||||
showdown = require('../bootstrap').showdown;
|
||||
|
||||
describe('showdown.options', function () {
|
||||
'use strict';
|
||||
|
||||
describe('setOption() and getOption()', function () {
|
||||
it('should set option foo=bar', function () {
|
||||
showdown.setOption('foo', 'bar');
|
||||
showdown.getOption('foo').should.equal('bar');
|
||||
showdown.resetOptions();
|
||||
(typeof showdown.getOption('foo')).should.equal('undefined');
|
||||
});
|
||||
});
|
||||
|
||||
describe('getDefaultOptions()', function () {
|
||||
it('should get default options', function () {
|
||||
var opts = require('../optionswp').getDefaultOpts(true);
|
||||
expect(showdown.getDefaultOptions()).to.be.eql(opts);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('showdown.extension()', function () {
|
||||
'use strict';
|
||||
|
||||
var extObjMock = {
|
||||
type: 'lang',
|
||||
filter: function () {}
|
||||
},
|
||||
extObjFunc = function () {
|
||||
return extObjMock;
|
||||
};
|
||||
|
||||
describe('should register', function () {
|
||||
it('an extension object', function () {
|
||||
showdown.extension('foo', extObjMock);
|
||||
showdown.extension('foo').should.eql([extObjMock]);
|
||||
showdown.resetExtensions();
|
||||
});
|
||||
|
||||
it('an extension function', function () {
|
||||
showdown.extension('foo', extObjFunc);
|
||||
showdown.extension('foo').should.eql([extObjMock]);
|
||||
showdown.resetExtensions();
|
||||
});
|
||||
|
||||
it('a listener extension', function () {
|
||||
showdown.extension('foo', {
|
||||
type: 'listener',
|
||||
listeners: {
|
||||
foo: function (name, txt) {
|
||||
return txt;
|
||||
}
|
||||
}
|
||||
});
|
||||
showdown.resetExtensions();
|
||||
});
|
||||
});
|
||||
|
||||
describe('should refuse to register', function () {
|
||||
it('a generic object', function () {
|
||||
var fn = function () {
|
||||
showdown.extension('foo', {});
|
||||
};
|
||||
expect(fn).to.throw();
|
||||
});
|
||||
|
||||
it('an extension with invalid type', function () {
|
||||
var fn = function () {
|
||||
showdown.extension('foo', {
|
||||
type: 'foo'
|
||||
});
|
||||
};
|
||||
expect(fn).to.throw(/type .+? is not recognized\. Valid values: "lang\/language", "output\/html" or "listener"/);
|
||||
});
|
||||
|
||||
it('an extension without regex or filter', function () {
|
||||
var fn = function () {
|
||||
showdown.extension('foo', {
|
||||
type: 'lang'
|
||||
});
|
||||
};
|
||||
expect(fn).to.throw(/extensions must define either a "regex" property or a "filter" method/);
|
||||
});
|
||||
|
||||
it('a listener extension without a listeners property', function () {
|
||||
var fn = function () {
|
||||
showdown.extension('foo', {
|
||||
type: 'listener'
|
||||
});
|
||||
};
|
||||
expect(fn).to.throw(/Extensions of type "listener" must have a property called "listeners"/);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('showdown.getAllExtensions()', function () {
|
||||
'use strict';
|
||||
var extObjMock = {
|
||||
type: 'lang',
|
||||
filter: function () {}
|
||||
};
|
||||
|
||||
it('should return all extensions', function () {
|
||||
showdown.extension('bar', extObjMock);
|
||||
showdown.getAllExtensions().should.eql({bar: [extObjMock]});
|
||||
});
|
||||
});
|
||||
|
||||
describe('showdown.setFlavor()', function () {
|
||||
'use strict';
|
||||
it('should set flavor to github', function () {
|
||||
showdown.setFlavor('github');
|
||||
showdown.getFlavor().should.equal('github');
|
||||
showdown.setFlavor('vanilla');
|
||||
});
|
||||
|
||||
it('should set options correctly', function () {
|
||||
showdown.setFlavor('github');
|
||||
var ghOpts = showdown.getFlavorOptions('github'),
|
||||
shOpts = showdown.getOptions();
|
||||
for (var opt in ghOpts) {
|
||||
if (ghOpts.hasOwnProperty(opt)) {
|
||||
shOpts.should.have.property(opt);
|
||||
shOpts[opt].should.equal(ghOpts[opt]);
|
||||
}
|
||||
}
|
||||
showdown.setFlavor('vanilla');
|
||||
});
|
||||
|
||||
it('should switch between flavors correctly', function () {
|
||||
showdown.setFlavor('github');
|
||||
var ghOpts = showdown.getFlavorOptions('github'),
|
||||
shOpts = showdown.getOptions(),
|
||||
dfOpts = showdown.getDefaultOptions();
|
||||
for (var opt in dfOpts) {
|
||||
if (ghOpts.hasOwnProperty(opt)) {
|
||||
shOpts[opt].should.equal(ghOpts[opt]);
|
||||
} else {
|
||||
shOpts[opt].should.equal(dfOpts[opt]);
|
||||
}
|
||||
}
|
||||
showdown.setFlavor('original');
|
||||
var orOpts = showdown.getFlavorOptions('original');
|
||||
shOpts = showdown.getOptions();
|
||||
for (opt in dfOpts) {
|
||||
if (orOpts.hasOwnProperty(opt)) {
|
||||
shOpts[opt].should.equal(orOpts[opt]);
|
||||
} else {
|
||||
shOpts[opt].should.equal(dfOpts[opt]);
|
||||
}
|
||||
}
|
||||
showdown.setFlavor('vanilla');
|
||||
});
|
||||
});
|
279
node_modules/showdown/test/node/testsuite.features.js
generated
vendored
Normal file
279
node_modules/showdown/test/node/testsuite.features.js
generated
vendored
Normal file
@ -0,0 +1,279 @@
|
||||
/**
|
||||
* Created by Estevao on 08-06-2015.
|
||||
*/
|
||||
var bootstrap = require('../bootstrap.js'),
|
||||
showdown = bootstrap.showdown,
|
||||
assertion = bootstrap.assertion,
|
||||
testsuite = bootstrap.getTestSuite('test/features/'),
|
||||
tableSuite = bootstrap.getTestSuite('test/features/tables/'),
|
||||
simplifiedAutoLinkSuite = bootstrap.getTestSuite('test/features/simplifiedAutoLink/'),
|
||||
openLinksInNewWindowSuite = bootstrap.getTestSuite('test/features/openLinksInNewWindow/'),
|
||||
disableForced4SpacesIndentedSublistsSuite = bootstrap.getTestSuite('test/features/disableForced4SpacesIndentedSublists/'),
|
||||
rawHeaderIdSuite = bootstrap.getTestSuite('test/features/rawHeaderId/'),
|
||||
rawPrefixHeaderIdSuite = bootstrap.getTestSuite('test/features/rawPrefixHeaderId/'),
|
||||
emojisSuite = bootstrap.getTestSuite('test/features/emojis/'),
|
||||
underlineSuite = bootstrap.getTestSuite('test/features/underline/'),
|
||||
literalMidWordUnderscoresSuite = bootstrap.getTestSuite('test/features/literalMidWordUnderscores/'),
|
||||
literalMidWordAsterisksSuite = bootstrap.getTestSuite('test/features/literalMidWordAsterisks/'),
|
||||
completeHTMLOutputSuite = bootstrap.getTestSuite('test/features/completeHTMLOutput/'),
|
||||
metadataSuite = bootstrap.getTestSuite('test/features/metadata/'),
|
||||
splitAdjacentBlockquotesSuite = bootstrap.getTestSuite('test/features/splitAdjacentBlockquotes/');
|
||||
|
||||
describe('makeHtml() features testsuite', function () {
|
||||
'use strict';
|
||||
|
||||
describe('issues', function () {
|
||||
for (var i = 0; i < testsuite.length; ++i) {
|
||||
var converter;
|
||||
if (testsuite[i].name === '#143.support-image-dimensions') {
|
||||
converter = new showdown.Converter({parseImgDimensions: true});
|
||||
} else if (testsuite[i].name === '#69.header-level-start') {
|
||||
converter = new showdown.Converter({headerLevelStart: 3});
|
||||
} else if (testsuite[i].name === '#164.1.simple-autolink' || testsuite[i].name === '#204.certain-links-with-at-and-dot-break-url') {
|
||||
converter = new showdown.Converter({simplifiedAutoLink: true});
|
||||
} else if (testsuite[i].name === 'literalMidWordUnderscores') {
|
||||
converter = new showdown.Converter({literalMidWordUnderscores: true});
|
||||
} else if (testsuite[i].name === '#164.2.disallow-underscore-emphasis-mid-word') {
|
||||
converter = new showdown.Converter({literalMidWordUnderscores: true});
|
||||
} else if (testsuite[i].name === '#164.3.strikethrough' || testsuite[i].name === '#214.escaped-markdown-chars-break-strikethrough') {
|
||||
converter = new showdown.Converter({strikethrough: true});
|
||||
} else if (testsuite[i].name === 'disable-gh-codeblocks') {
|
||||
converter = new showdown.Converter({ghCodeBlocks: false});
|
||||
} else if (testsuite[i].name === '#164.4.tasklists') {
|
||||
converter = new showdown.Converter({tasklists: true});
|
||||
} else if (testsuite[i].name === '#198.literalMidWordUnderscores-changes-behavior-of-asterisk') {
|
||||
converter = new showdown.Converter({literalMidWordUnderscores: true});
|
||||
} else if (testsuite[i].name === '#259.es6-template-strings-indentation-issues') {
|
||||
converter = new showdown.Converter({smartIndentationFix: true});
|
||||
} else if (testsuite[i].name === '#284.simplifiedAutoLink-does-not-match-GFM-style') {
|
||||
converter = new showdown.Converter({simplifiedAutoLink: true});
|
||||
} else if (testsuite[i].name === 'disableForced4SpacesIndentedSublists') {
|
||||
converter = new showdown.Converter({disableForced4SpacesIndentedSublists: true});
|
||||
} else if (testsuite[i].name === '#206.treat-single-line-breaks-as-br') {
|
||||
converter = new showdown.Converter({simpleLineBreaks: true});
|
||||
} else if (testsuite[i].name === 'simpleLineBreaks2') {
|
||||
converter = new showdown.Converter({simpleLineBreaks: true});
|
||||
} else if (testsuite[i].name === '#316.new-simpleLineBreaks-option-breaks-lists') {
|
||||
converter = new showdown.Converter({simpleLineBreaks: true});
|
||||
} else if (testsuite[i].name === '#323.simpleLineBreaks-breaks-with-strong') {
|
||||
converter = new showdown.Converter({simpleLineBreaks: true});
|
||||
} else if (testsuite[i].name === '#318.simpleLineBreaks-does-not-work-with-chinese-characters') {
|
||||
converter = new showdown.Converter({simpleLineBreaks: true});
|
||||
} else if (testsuite[i].name === 'simpleLineBreaks-handle-html-pre') {
|
||||
converter = new showdown.Converter({simpleLineBreaks: true});
|
||||
} else if (testsuite[i].name === 'excludeTrailingPunctuationFromURLs-option') {
|
||||
converter = new showdown.Converter({simplifiedAutoLink: true, excludeTrailingPunctuationFromURLs: true});
|
||||
} else if (testsuite[i].name === 'requireSpaceBeforeHeadingText') {
|
||||
converter = new showdown.Converter({requireSpaceBeforeHeadingText: true});
|
||||
} else if (testsuite[i].name === '#320.github-compatible-generated-header-id') {
|
||||
converter = new showdown.Converter({ghCompatibleHeaderId: true});
|
||||
} else if (testsuite[i].name === 'ghMentions') {
|
||||
converter = new showdown.Converter({ghMentions: true});
|
||||
} else if (testsuite[i].name === 'disable-email-encoding') {
|
||||
converter = new showdown.Converter({encodeEmails: false});
|
||||
} else if (testsuite[i].name === '#330.simplifiedAutoLink-drops-character-before-and-after-linked-mail') {
|
||||
converter = new showdown.Converter({encodeEmails: false, simplifiedAutoLink: true});
|
||||
} else if (testsuite[i].name === '#331.allow-escaping-of-tilde') {
|
||||
converter = new showdown.Converter({strikethrough: true});
|
||||
} else if (testsuite[i].name === 'enable-literalMidWordAsterisks') {
|
||||
converter = new showdown.Converter({literalMidWordAsterisks: true});
|
||||
} else if (testsuite[i].name === 'prefixHeaderId-simple') {
|
||||
converter = new showdown.Converter({prefixHeaderId: true});
|
||||
} else if (testsuite[i].name === 'prefixHeaderId-string') {
|
||||
converter = new showdown.Converter({prefixHeaderId: 'my-prefix-'});
|
||||
} else if (testsuite[i].name === 'prefixHeaderId-string-and-ghCompatibleHeaderId') {
|
||||
converter = new showdown.Converter({prefixHeaderId: 'my-prefix-', ghCompatibleHeaderId: true});
|
||||
} else if (testsuite[i].name === 'prefixHeaderId-string-and-ghCompatibleHeaderId2') {
|
||||
converter = new showdown.Converter({prefixHeaderId: 'my prefix ', ghCompatibleHeaderId: true});
|
||||
} else if (testsuite[i].name === 'simplifiedAutoLink') {
|
||||
converter = new showdown.Converter({simplifiedAutoLink: true, strikethrough: true});
|
||||
} else if (testsuite[i].name === 'customizedHeaderId-simple') {
|
||||
converter = new showdown.Converter({customizedHeaderId: true});
|
||||
} else if (testsuite[i].name === '#378.simplifiedAutoLinks-with-excludeTrailingPunctuationFromURLs') {
|
||||
converter = new showdown.Converter({simplifiedAutoLink: true, excludeTrailingPunctuationFromURLs: true});
|
||||
} else if (testsuite[i].name === '#374.escape-html-tags') {
|
||||
converter = new showdown.Converter({backslashEscapesHTMLTags: true});
|
||||
} else if (testsuite[i].name === '#379.openLinksInNewWindow-breaks-em-markdup') {
|
||||
converter = new showdown.Converter({openLinksInNewWindow: true});
|
||||
} else if (testsuite[i].name === '#398.literalMidWordAsterisks-treats-non-word-characters-as-characters') {
|
||||
converter = new showdown.Converter({literalMidWordAsterisks: true});
|
||||
} else {
|
||||
converter = new showdown.Converter();
|
||||
}
|
||||
it(testsuite[i].name.replace(/-/g, ' '), assertion(testsuite[i], converter));
|
||||
}
|
||||
});
|
||||
|
||||
/** test Table Syntax Support **/
|
||||
describe('table support', function () {
|
||||
var converter,
|
||||
suite = tableSuite;
|
||||
for (var i = 0; i < suite.length; ++i) {
|
||||
if (suite[i].name === 'basic-with-header-ids') {
|
||||
converter = new showdown.Converter({tables: true, tablesHeaderId: true});
|
||||
} else if (suite[i].name === '#179.parse-md-in-table-ths') {
|
||||
converter = new showdown.Converter({tables: true, strikethrough: true});
|
||||
} else {
|
||||
converter = new showdown.Converter({tables: true});
|
||||
}
|
||||
it(suite[i].name.replace(/-/g, ' '), assertion(suite[i], converter));
|
||||
}
|
||||
});
|
||||
|
||||
/** test simplifiedAutoLink Support **/
|
||||
describe('simplifiedAutoLink support in', function () {
|
||||
var converter,
|
||||
suite = simplifiedAutoLinkSuite;
|
||||
for (var i = 0; i < suite.length; ++i) {
|
||||
if (suite[i].name === 'emphasis-and-strikethrough') {
|
||||
converter = new showdown.Converter({simplifiedAutoLink: true, strikethrough: true});
|
||||
} else if (suite[i].name === 'disallow-underscores') {
|
||||
converter = new showdown.Converter({literalMidWordUnderscores: true, simplifiedAutoLink: true});
|
||||
} else if (suite[i].name === 'disallow-asterisks') {
|
||||
converter = new showdown.Converter({literalMidWordAsterisks: true, simplifiedAutoLink: true});
|
||||
} else {
|
||||
converter = new showdown.Converter({simplifiedAutoLink: true});
|
||||
}
|
||||
it(suite[i].name.replace(/-/g, ' '), assertion(suite[i], converter));
|
||||
}
|
||||
});
|
||||
|
||||
/** test openLinksInNewWindow support **/
|
||||
describe('openLinksInNewWindow support in', function () {
|
||||
var converter,
|
||||
suite = openLinksInNewWindowSuite;
|
||||
for (var i = 0; i < suite.length; ++i) {
|
||||
if (suite[i].name === 'simplifiedAutoLink') {
|
||||
converter = new showdown.Converter({openLinksInNewWindow: true, simplifiedAutoLink: true});
|
||||
} else {
|
||||
converter = new showdown.Converter({openLinksInNewWindow: true});
|
||||
}
|
||||
it(suite[i].name.replace(/-/g, ' '), assertion(suite[i], converter));
|
||||
}
|
||||
});
|
||||
|
||||
/** test disableForced4SpacesIndentedSublists support **/
|
||||
describe('disableForced4SpacesIndentedSublists support in', function () {
|
||||
var converter,
|
||||
suite = disableForced4SpacesIndentedSublistsSuite;
|
||||
for (var i = 0; i < suite.length; ++i) {
|
||||
converter = new showdown.Converter({disableForced4SpacesIndentedSublists: true});
|
||||
it(suite[i].name.replace(/-/g, ' '), assertion(suite[i], converter));
|
||||
}
|
||||
});
|
||||
|
||||
/** test rawHeaderId support **/
|
||||
describe('rawHeaderId support', function () {
|
||||
var converter,
|
||||
suite = rawHeaderIdSuite;
|
||||
for (var i = 0; i < suite.length; ++i) {
|
||||
if (suite[i].name === 'with-prefixHeaderId') {
|
||||
converter = new showdown.Converter({rawHeaderId: true, prefixHeaderId: '/prefix/'});
|
||||
} else {
|
||||
converter = new showdown.Converter({rawHeaderId: true});
|
||||
}
|
||||
it(suite[i].name.replace(/-/g, ' '), assertion(suite[i], converter));
|
||||
}
|
||||
});
|
||||
|
||||
/** test rawPrefixHeaderId support **/
|
||||
describe('rawPrefixHeaderId support', function () {
|
||||
var converter,
|
||||
suite = rawPrefixHeaderIdSuite;
|
||||
for (var i = 0; i < suite.length; ++i) {
|
||||
converter = new showdown.Converter({rawPrefixHeaderId: true, prefixHeaderId: '/prefix/'});
|
||||
it(suite[i].name.replace(/-/g, ' '), assertion(suite[i], converter));
|
||||
}
|
||||
});
|
||||
|
||||
/** test emojis support **/
|
||||
describe('emojis support', function () {
|
||||
var converter,
|
||||
suite = emojisSuite;
|
||||
for (var i = 0; i < suite.length; ++i) {
|
||||
if (suite[i].name === 'simplifiedautolinks') {
|
||||
converter = new showdown.Converter({emoji: true, simplifiedAutoLink: true});
|
||||
} else {
|
||||
converter = new showdown.Converter({emoji: true});
|
||||
}
|
||||
|
||||
it(suite[i].name.replace(/-/g, ' '), assertion(suite[i], converter));
|
||||
}
|
||||
});
|
||||
|
||||
/** test underline support **/
|
||||
describe('underline support', function () {
|
||||
var converter,
|
||||
suite = underlineSuite;
|
||||
for (var i = 0; i < suite.length; ++i) {
|
||||
if (suite[i].name === 'simplifiedautolinks') {
|
||||
converter = new showdown.Converter({underline: true, simplifiedAutoLink: true});
|
||||
} else {
|
||||
converter = new showdown.Converter({underline: true});
|
||||
}
|
||||
it(suite[i].name.replace(/-/g, ' '), assertion(suite[i], converter));
|
||||
}
|
||||
});
|
||||
|
||||
/** test literalMidWordUnderscores option **/
|
||||
describe('literalMidWordUnderscores option', function () {
|
||||
var converter,
|
||||
suite = literalMidWordUnderscoresSuite;
|
||||
for (var i = 0; i < suite.length; ++i) {
|
||||
converter = new showdown.Converter({literalMidWordUnderscores: true});
|
||||
it(suite[i].name.replace(/-/g, ' '), assertion(suite[i], converter));
|
||||
}
|
||||
});
|
||||
|
||||
/** test literalMidWordAsterisks option **/
|
||||
describe('literalMidWordAsterisks option', function () {
|
||||
var converter,
|
||||
suite = literalMidWordAsterisksSuite;
|
||||
for (var i = 0; i < suite.length; ++i) {
|
||||
converter = new showdown.Converter({literalMidWordAsterisks: true});
|
||||
it(suite[i].name.replace(/-/g, ' '), assertion(suite[i], converter));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/** test completeHTMLDocument option **/
|
||||
describe('completeHTMLDocument option', function () {
|
||||
var converter,
|
||||
suite = completeHTMLOutputSuite;
|
||||
for (var i = 0; i < suite.length; ++i) {
|
||||
converter = new showdown.Converter({completeHTMLDocument: true});
|
||||
|
||||
it(suite[i].name.replace(/-/g, ' '), assertion(suite[i], converter));
|
||||
}
|
||||
});
|
||||
|
||||
/** test metadata option **/
|
||||
describe('metadata option', function () {
|
||||
var converter,
|
||||
suite = metadataSuite;
|
||||
|
||||
for (var i = 0; i < suite.length; ++i) {
|
||||
if (suite[i].name === 'embeded-in-output' ||
|
||||
suite[i].name === 'embeded-two-consecutive-metadata-blocks' ||
|
||||
suite[i].name === 'embeded-two-consecutive-metadata-blocks-different-symbols') {
|
||||
converter = new showdown.Converter({metadata: true, completeHTMLDocument: true});
|
||||
} else if (suite[i].name === 'ignore-metadata') {
|
||||
converter = new showdown.Converter({metadata: false});
|
||||
} else {
|
||||
converter = new showdown.Converter({metadata: true});
|
||||
}
|
||||
it(suite[i].name.replace(/-/g, ' '), assertion(suite[i], converter));
|
||||
}
|
||||
});
|
||||
|
||||
/** test metadata option **/
|
||||
describe('splitAdjacentBlockquotes option', function () {
|
||||
var converter,
|
||||
suite = splitAdjacentBlockquotesSuite;
|
||||
|
||||
for (var i = 0; i < suite.length; ++i) {
|
||||
converter = new showdown.Converter({splitAdjacentBlockquotes: true});
|
||||
it(suite[i].name.replace(/-/g, ' '), assertion(suite[i], converter));
|
||||
}
|
||||
});
|
||||
});
|
22
node_modules/showdown/test/node/testsuite.ghost.js
generated
vendored
Normal file
22
node_modules/showdown/test/node/testsuite.ghost.js
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Created by Estevao on 14-07-2015.
|
||||
*/
|
||||
var bootstrap = require('../bootstrap.js'),
|
||||
converter = new bootstrap.showdown.Converter({
|
||||
strikethrough: true,
|
||||
literalMidWordUnderscores: true,
|
||||
simplifiedAutoLink: true,
|
||||
tables: true,
|
||||
parseImgDimensions: true, //extra
|
||||
tasklists: true //extra
|
||||
}),
|
||||
assertion = bootstrap.assertion,
|
||||
testsuite = bootstrap.getTestSuite('test/ghost/');
|
||||
|
||||
//MD-Testsuite (borrowed from karlcow/markdown-testsuite)
|
||||
describe('makeHtml() ghost testsuite', function () {
|
||||
'use strict';
|
||||
for (var i = 0; i < testsuite.length; ++i) {
|
||||
it(testsuite[i].name.replace(/-/g, ' '), assertion(testsuite[i], converter));
|
||||
}
|
||||
});
|
14
node_modules/showdown/test/node/testsuite.issues.js
generated
vendored
Normal file
14
node_modules/showdown/test/node/testsuite.issues.js
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Created by Estevao on 08-06-2015.
|
||||
*/
|
||||
var bootstrap = require('../bootstrap.js'),
|
||||
converter = new bootstrap.showdown.Converter(),
|
||||
assertion = bootstrap.assertion,
|
||||
testsuite = bootstrap.getTestSuite('test/issues/');
|
||||
|
||||
describe('makeHtml() issues testsuite', function () {
|
||||
'use strict';
|
||||
for (var i = 0; i < testsuite.length; ++i) {
|
||||
it(testsuite[i].name.replace(/-/g, ' '), assertion(testsuite[i], converter));
|
||||
}
|
||||
});
|
12
node_modules/showdown/test/node/testsuite.karlcow.js
generated
vendored
Normal file
12
node_modules/showdown/test/node/testsuite.karlcow.js
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
var bootstrap = require('../bootstrap.js'),
|
||||
converter = new bootstrap.showdown.Converter({noHeaderId: true}),
|
||||
assertion = bootstrap.assertion,
|
||||
testsuite = bootstrap.getTestSuite('test/karlcow/');
|
||||
|
||||
//MD-Testsuite (borrowed from karlcow/markdown-testsuite)
|
||||
describe('makeHtml() karlcow testsuite', function () {
|
||||
'use strict';
|
||||
for (var i = 0; i < testsuite.length; ++i) {
|
||||
it(testsuite[i].name.replace(/-/g, ' '), assertion(testsuite[i], converter));
|
||||
}
|
||||
});
|
12
node_modules/showdown/test/node/testsuite.makemd.js
generated
vendored
Normal file
12
node_modules/showdown/test/node/testsuite.makemd.js
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
var bootstrap = require('../bootstrap.js'),
|
||||
converter = new bootstrap.showdown.Converter(),
|
||||
testsuite = bootstrap.getHtmlToMdTestSuite('test/makeMd/'),
|
||||
assertion = bootstrap.assertion;
|
||||
|
||||
describe('makeMd() standard testsuite', function () {
|
||||
'use strict';
|
||||
for (var i = 0; i < testsuite.length; ++i) {
|
||||
it(testsuite[i].name.replace(/-/g, ' '), assertion(testsuite[i], converter, 'makeMd'));
|
||||
}
|
||||
});
|
||||
|
11
node_modules/showdown/test/node/testsuite.standard.js
generated
vendored
Normal file
11
node_modules/showdown/test/node/testsuite.standard.js
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
var bootstrap = require('../bootstrap.js'),
|
||||
converter = new bootstrap.showdown.Converter(),
|
||||
assertion = bootstrap.assertion,
|
||||
testsuite = bootstrap.getTestSuite('test/cases/');
|
||||
|
||||
describe('makeHtml() standard testsuite', function () {
|
||||
'use strict';
|
||||
for (var i = 0; i < testsuite.length; ++i) {
|
||||
it(testsuite[i].name.replace(/-/g, ' '), assertion(testsuite[i], converter));
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user