Skip to content

Advanced usage

matubu edited this page Jan 8, 2022 · 3 revisions

Custom Usage 🔧

You can use the highlightElement to allow better control what and when to highlight elements, For example, here’s the equivalent of highlightAll:

document
	.querySelectorAll('[class*="shj-lang-"]')
	.forEach(elm => highlightElement(elm));

The highlightElement can also take the language and the layout mode of element to highlight:

highlightElement(elm, '[language]', '[multi|in|one]line')

Styling 🌈

  • The class shj-mode-header will add a header with the language name
Clone this wiki locally