-
Hi, I'm trying to understand how to update highlighting. My use case is line highlighting and a change of the attribute Let's suppose I have a simple code block: <pre id="id-pre" data-line="1"><code language="language-css">div {
color: "red";
}
</code></pre> and then later I want to set or modify the attribute: pre = document.querySelector("#id-pre");
pre.setAttribute("data-line", "2"); How can I properly re-process the code with Prism?
I couldn't find any example or doc for that kind of call. And I don't understand why 1 (all) is working and 2 (element) is not. Could someone give me a hint on the proper expected syntax? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I use Prism.highlightElement() on the < code > itself and line-numbers as well as line-highlight works for me on subsequent executions. Additional difference is that I've included a < code id="xyz" class="language-xyz match-braces rainbow-braces line-numbers">< /code > without a "language" attribute. |
Beta Was this translation helpful? Give feedback.
I use Prism.highlightElement() on the < code > itself and line-numbers as well as line-highlight works for me on subsequent executions. Additional difference is that I've included a < code id="xyz" class="language-xyz match-braces rainbow-braces line-numbers">< /code > without a "language" attribute.