-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Closed
Labels
discuss/proposeProposal for a new feature/directionProposal for a new feature/directionenhancementAn enhancement or new featureAn enhancement or new featureparser
Milestone
Description
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:
- new
highlightAPI as shown above -
highlightAuto->highlight(code) -
highlightAutois deprecated -
highlightBlock->highlightElementenh(parser) add highlightElement, deprecate highlightBlock #3003 -
highlightBlock-> deprecated enh(parser) add highlightElement, deprecate highlightBlock #3003 -
fixMarkup-> deprecated, will be removed with v11 -
initHighlightingOnLoad->highlightAll() -
initHighlighting->highlightAll()
tlienart, P4sca1, SuiteLHY, nilslindemann, rkok and 3 more
Metadata
Metadata
Assignees
Labels
discuss/proposeProposal for a new feature/directionProposal for a new feature/directionenhancementAn enhancement or new featureAn enhancement or new featureparser