|
@@ -45,6 +45,25 @@
|
|
|
});
|
|
|
});
|
|
|
|
|
|
+ describe('Converter.options 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);
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
function filter() {
|
|
|
return function (file) {
|
|
|
var ext = file.slice(-3);
|