Browse Source

Added highlight test

pull/14/head
Vitaly Puzrin 10 years ago
parent
commit
2058ae5458
  1. 2
      lib/renderer.js
  2. 20
      test/misc.js

2
lib/renderer.js

@ -100,7 +100,7 @@ rules.code = function (tokens, idx /*, options*/) {
rules.fence = function (tokens, idx, options) {
var token = tokens[idx];
var langClass = '';
var langPrefix = options.langPrefix || '';
var langPrefix = options.langPrefix;
var params, langName = '';
var highlighted;

20
test/misc.js

@ -72,6 +72,26 @@ describe('API', function () {
assert.strictEqual(succeeded, true);
});
it('highlight', function () {
var md = new Remarkable({
highlight: function (str) {
return '==' + str + '==';
}
});
assert.strictEqual(md.render('```\nhl\n```'), '<pre><code>==hl\n==</code></pre>\n');
});
it('highlight escape by default', function () {
var md = new Remarkable({
highlight: function () {
return '';
}
});
assert.strictEqual(md.render('```\n&\n```'), '<pre><code>&amp;\n</code></pre>\n');
});
});

Loading…
Cancel
Save