We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3ab4bf5 commit 6472717Copy full SHA for 6472717
docs/USING_ADVANCED.md
@@ -20,8 +20,10 @@ const marked = require('marked');
20
// `highlight` example uses `highlight.js`
21
marked.setOptions({
22
renderer: new marked.Renderer(),
23
- highlight: function(code) {
24
- return require('highlight.js').highlightAuto(code).value;
+ highlight: function(code, language) {
+ const hljs = require('highlight.js');
25
+ const validLanguage = hljs.getLanguage(language) ? language : 'plaintext';
26
+ return hljs.highlight(validLanguage, code).value;
27
},
28
pedantic: false,
29
gfm: true,
0 commit comments