javascript - How to let marked and google-code-prettify work together? -
I am using some markdown code to convert html, which contains some code blocks, so I highlight the code I want to use.
Callback is given for the marked code, as documented:
marked .setOptions ({gfm: true, pedantic: false, notation) : True, // Callback for Code Highlighter Highlight: Function (Code, Lang) {if (lang === 'js') {return javascriptHighlighter (code);} Return code;}});
But I have not found any method like Google Code-Prettify with javascritHighlighter (..)
. How do they work together?
Just did it yourself The function you are looking for is:
< Pre> / ** * @ The ultimate source codehit {string} is a lot of HTML printing. * The name of the language to use the * ultimate opt_long extension {string} * Typically, filename extensions such as 'CPP' or 'Java' * @ Palom opt_numberLines {number | The boolean} is the right number for the number lines, * or the 1-indexed number of the first line in the source codeheel
then you want to do something like:
PrettyPrintOne (code, 'js', wrong) / function prettyPrintOne (sourceCodeHtml, opt_langExtension, opt_numberLines)
Comments
Post a Comment