Skip to content

Commit

Permalink
fix: syntax highlighting in markdown now uses the styling of the prop…
Browse files Browse the repository at this point in the history
…er language
  • Loading branch information
anthonyattard authored and hackjutsu committed Aug 14, 2019
1 parent 804c0f4 commit 228bb33
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/utilities/markdown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@ import MdKatex from 'markdown-it-katex'

// Configure markdown-it
const Md = MarkdownIt({

highlight: (str, lang) => {
return HighlightJS.highlightAuto(str).value
if (lang && HighlightJS.getLanguage(lang)) {
try {
return HighlightJS.highlight(lang, str).value;
} catch (__) {}
}
return HighlightJS.highlightAuto(str).value;
}
})
.use(MdTaskList)
Expand Down

0 comments on commit 228bb33

Please sign in to comment.