Skip to content

Commit

Permalink
Allow codeBlocks to be extended via options.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonkemp committed Mar 8, 2018
1 parent f78dcd7 commit 1fadf74
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var Promise = require('bluebird'),

module.exports = function (html, options) {
return new Promise(function (resolve, reject) {
var opt = extend({
var opt = extend(true, {
extraCss: '',
applyStyleTags: true,
removeStyleTags: true,
Expand Down
6 changes: 6 additions & 0 deletions test/expected/codeblocks-external.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!DOCTYPE html>
<html>
<body>
<h1><<Hi>></h1>
</body>
</html>
6 changes: 6 additions & 0 deletions test/fixtures/codeblocks-external.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!DOCTYPE html>
<html>
<body>
<h1><<Hi>></h1>
</body>
</html>
10 changes: 10 additions & 0 deletions test/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,4 +284,14 @@ describe('inline-css', function() {
};
compare(path.join('test', 'fixtures', 'ejs.html'), path.join('test', 'expected', 'ejs.html'), options, done);
});

it('Should ignore user defined code blocks', function(done) {
var options = {
xmlMode: true,
codeBlocks: {
craze: { start: '<<', end: '>>' }
}
};
compare(path.join('test', 'fixtures', 'codeblocks-external.html'), path.join('test', 'expected', 'codeblocks-external.html'), options, done);
});
});

0 comments on commit 1fadf74

Please sign in to comment.