Skip to content

Commit

Permalink
📦 Update to highlight.js 11 (ampproject#5916)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasrohmer authored May 31, 2021
1 parent 9b945fa commit a480f68
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion boilerplate/lib/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function readTemplate(name) {
if (ext === 'js') {
ext = 'javascript';
}
string = hljs.highlight(ext, string).value;
string = hljs.highlight(string, {language: ext}).value;
if (ext === 'html') {
string = highlightSections(string);
}
Expand Down
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
"handlebars": "4.7.7",
"handlebars-loader": "1.7.1",
"handlebars-registrar": "1.5.2",
"highlight.js": "10.7.2",
"highlight.js": "11.0.0",
"hogan.js": "3.0.2",
"html-loader": "2.1.2",
"html-minifier": "4.0.0",
Expand Down
4 changes: 2 additions & 2 deletions platform/lib/samples/CodeSection.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const hintEndHtml = '</label>';
marked.setOptions({
highlight: function (code, lang) {
if (lang) {
return hljs.highlight(lang, code).value;
return hljs.highlight(code, {language: lang}).value;
} else {
return hljs.highlightAuto(code).value;
}
Expand Down Expand Up @@ -288,7 +288,7 @@ module.exports = class CodeSection {
}

highlight(name, value) {
let result = hljs.highlight(name, value).value;
let result = hljs.highlight(value, {language: name}).value;
result = this.replaceHints(result);
return result;
}
Expand Down

0 comments on commit a480f68

Please sign in to comment.