diff --git a/docs/USING_ADVANCED.md b/docs/USING_ADVANCED.md index ee8b3126dae..a8d4c0cc220 100644 --- a/docs/USING_ADVANCED.md +++ b/docs/USING_ADVANCED.md @@ -20,8 +20,9 @@ const marked = require('marked'); // `highlight` example uses `highlight.js` marked.setOptions({ renderer: new marked.Renderer(), - highlight: function(code) { - return require('highlight.js').highlightAuto(code).value; + highlight: function(code, language) { + const validLanguage = hljs.getLanguage(language) ? language : 'plaintext'; + return require('highlight.js').highlight(validLanguage, code).value; }, pedantic: false, gfm: true,