';
+const start = '';
const gutterStart = '';
@@ -37,7 +37,9 @@ function code(str, lang) {
let data;
if (lang) {
- data = hljs.highlight(lang.toLowerCase(), str);
+ data = hljs.highlight(str, {
+ language: lang.toLowerCase()
+ });
} else if (lang === null) {
data = {value: str};
} else {
@@ -93,7 +95,7 @@ describe('highlight', () => {
it('wrap: false (without hljs, without lang)', done => {
const result = highlight(testString, {gutter: false, wrap: false});
result.should.eql([
- '',
+ '',
entities.encode(testString),
' '
].join(''));
@@ -103,7 +105,7 @@ describe('highlight', () => {
it('wrap: false (with hljs, without lang)', done => {
const result = highlight(testString, {gutter: false, wrap: false, hljs: true});
result.should.eql([
- '',
+ '',
entities.encode(testString),
' '
].join(''));
@@ -115,7 +117,9 @@ describe('highlight', () => {
hljs.configure({classPrefix: ''});
result.should.eql([
'',
- hljs.highlight('json', testString).value,
+ hljs.highlight(testString, {
+ language: 'json'
+ }).value,
' '
].join(''));
validateHtmlAsync(result, done);
@@ -126,7 +130,9 @@ describe('highlight', () => {
hljs.configure({classPrefix: 'hljs-'});
result.should.eql([
'',
- hljs.highlight('json', testString).value,
+ hljs.highlight(testString, {
+ language: 'json'
+ }).value,
' '
].join(''));
validateHtmlAsync(result, done);
@@ -137,7 +143,9 @@ describe('highlight', () => {
hljs.configure({classPrefix: 'hljs-'});
result.should.eql([
'',
- hljs.highlight('json', testString).value.replace('{', '{'),
+ hljs.highlight(testString, {
+ language: 'json'
+ }).value.replace('{', '{'),
' '
].join(''));
validateHtmlAsync(result, done);
@@ -148,7 +156,9 @@ describe('highlight', () => {
hljs.configure({classPrefix: 'hljs-'});
result.should.eql([
'',
- hljs.highlight('json', testString).value,
+ hljs.highlight(testString, {
+ language: 'json'
+ }).value,
'\n '
].join(''));
validateHtmlAsync(result, done);
@@ -199,7 +209,7 @@ describe('highlight', () => {
});
result.should.eql([
- `${caption}`,
+ `${caption}`,
gutter(1, 4),
code(testString),
end
@@ -218,7 +228,7 @@ describe('highlight', () => {
result.should.eql([
'',
`${caption} `,
- '',
+ '',
entities.encode(testString),
' '
].join(''));
@@ -252,7 +262,9 @@ describe('highlight', () => {
result.should.eql([
'',
spaces,
- hljs.highlight('json', testString).value,
+ hljs.highlight(testString, {
+ language: 'json'
+ }).value,
' '
].join(''));
validateHtmlAsync(result, done);
|