Skip to content
This repository was archived by the owner on Mar 16, 2023. It is now read-only.

Commit c092c45

Browse files
committed
Language override for highlighting codeblocks
1 parent fadc84a commit c092c45

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

assets/js/app.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,18 @@ marked.setOptions(
105105
sanitize: false,
106106
smartLists: true,
107107
smartypants: true,
108-
highlight: function(code) //use highlight.js for syntax highlighting.
109-
{
110-
return highlight.highlightAuto(code).value;
111-
}
108+
highlight: function(code, lang) //use highlight.js for syntax highlighting.
109+
{
110+
try
111+
{
112+
content = highlight.highlight(lang, code).value;
113+
}
114+
catch (err)
115+
{
116+
content = highlight.highlightAuto(code).value;
117+
}
118+
return content;
119+
}
112120
});
113121

114122
$(document).on("click", "list-item", function()

0 commit comments

Comments
 (0)