-
Notifications
You must be signed in to change notification settings - Fork 17
Advanced usage
matubu edited this page Mar 5, 2022
·
3 revisions
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 defaultfalse
) that allow you to hide the line numbering
- The class
shj-mode-header
will add a header with the language name