Skip to content

Applying `highlightAll` to an element

Scott Mueller edited this page Aug 17, 2024 · 1 revision

For scoping and a potential performance improvement, here's a function to apply highlightAll to a single element:

const highlightAllElement = el => el.querySelectorAll('pre code').forEach(hljs.highlightElement)
  1. José e Maria Maria
  2. José J&M
Clone this wiki locally