For those finding there way here from the deprecation warning it's easy to upgrade your code:
// The old API:
highlight(language, code, ignore_illegals, continuation) {
// The new API take an options object literal:
highlight(code, { language, ignoreIllegals}) {
So to upgrade your code:
// before
html = highlight("vbscript","your code goes here", true)
// after
html = highlight("your code goes here", {language: "vbscript", ignoreIllegals: true })
IE, just switch the order of the arguments and pass language and ignoreIllegals in the options object now.
Advantages:
- target of the verb [highlight] is now the first argument, which makes more sense, such as
format(drive), highlight(code)
- no need to remember order of the arguments
- we can still support the old API for legacy (ie, non-breaking change)
- fewer arguments are generally better (easier to understand, now at the call site you always see the names of the optional arguments, etc)
Checklist:
For those finding there way here from the deprecation warning it's easy to upgrade your code:
So to upgrade your code:
IE, just switch the order of the arguments and pass
languageandignoreIllegalsin the options object now.Advantages:
format(drive),highlight(code)Checklist:
highlightAPI as shown abovehighlightAuto->highlight(code)highlightAutois deprecatedhighlightBlock->highlightElementenh(parser) add highlightElement, deprecate highlightBlock #3003highlightBlock-> deprecated enh(parser) add highlightElement, deprecate highlightBlock #3003fixMarkup-> deprecated, will be removed with v11initHighlightingOnLoad->highlightAll()initHighlighting->highlightAll()