Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not add "undefined" to the beginning of the result of .fixMarkup() #1453

Merged
merged 1 commit into from
Feb 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/highlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ https://highlightjs.org/
} else if (options.tabReplace) {
return p1.replace(/\t/g, options.tabReplace);
}
return '';
});
}

Expand Down
21 changes: 21 additions & 0 deletions test/api/fixmarkup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict';

let should = require('should');
let hljs = require('../../build');

describe('.fixmarkup()', function() {
after(function() {
hljs.configure({ useBR: false })
})

it('should not add "undefined" to the beginning of the result (#1452)', function() {
hljs.configure({ useBR: true })
const value = '{ <span class="hljs-attr">"some"</span>: \n <span class="hljs-string">"json"</span> }';
const result = hljs.fixMarkup(value);


result.should.equal(
'{ <span class="hljs-attr">"some"</span>: <br> <span class="hljs-string">"json"</span> }'
);
});
});
1 change: 1 addition & 0 deletions test/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ describe('hljs', function() {
require('./starters');
require('./getLanguage');
require('./highlight');
require('./fixmarkup');
});