A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/PrismJS/prism/issues/3528 below:

Change signature of `Prism.highlight{Element,All,AllUnder}` · Issue #3528 · PrismJS/prism · GitHub

Motivation
Similar to #3416, it would be nice to have all optional arguments of Prism.highlight{Element,All,AllUnder} in an options dictionary.

Description
So the new signature should be:

(Updated after the below discussion)

interface HighlightAllOptions {
  root?: Element;
  async?: boolean;
  callback?: (element: Element) => void;
}
function highlightAll(options?: HighlightAllOptions) { ... } 

interface HighlightElementOptions {
  async?: boolean;
  callback?: (element: Element) => void;
}
function highlightElement(element: T, options?: HighlightElementOptions) { ... }

Example usage:

Prism.highlightAll({ root: document.querySelector("#page") })

Thoughts? @LeaVerou @Golmote @mAAdhaTTah @JaKXz


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4