Skip to content

Commit a00e127

Browse files
committed
1
1 parent ab45b21 commit a00e127

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

web/markdown.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,21 @@ function renderMarkdwon(markdownViewId, markdownFileURL) {
5353
if (this.readyState == 4 && this.status == 200) {
5454
const markdown = this.responseText;
5555

56+
5657
marked.setOptions({
5758
highlight: function (code, lang) {
5859
return hljs.highlightAuto(code, [lang]).value;
5960
}
6061
});
6162

63+
6264
const html = marked.parse(markdown);
6365
document.getElementById(markdownViewId).innerHTML = html;
66+
67+
68+
document.querySelectorAll(`#${markdownViewId} pre code`).forEach((block) => {
69+
hljs.highlightElement(block);
70+
});
6471
}
6572
}
6673
;

0 commit comments

Comments
 (0)