Skip to content

Instantly share code, notes, and snippets.

@kartiknair
Created March 10, 2020 07:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kartiknair/45176df0f4bba8d59914c7acd4737d39 to your computer and use it in GitHub Desktop.
Save kartiknair/45176df0f4bba8d59914c7acd4737d39 to your computer and use it in GitHub Desktop.
const marked = require("marked");
marked.setOptions({
renderer: new marked.Renderer(),
highlight: function(code, language) {
const hljs = require("highlight.js");
const validLanguage = hljs.getLanguage(language) ? language : "plaintext";
return hljs.highlight(validLanguage, code).value;
},
pedantic: false,
gfm: true,
breaks: false,
sanitize: false,
smartLists: true,
smartypants: false,
xhtml: false
});
module.exports = marked;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment