Skip to content

Advanced usage

matubu edited this page Mar 5, 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', { hideLineNumbers: true })

and also an option object who contains

  • hideLineNumbers (by default false) that allow you to hide the line numbering

Styling 🌈

  • The class shj-mode-header will add a header with the language name

πŸ“¦ npm link

πŸ“¦ deno link

πŸ“¦ github package

πŸ“ documentation

✨ demo

Clone this wiki locally