You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fixMarkup is the second half of the transformation process that happens when someone uses useBR. The first half of the process is private code.
This function is really only useful when paired with the first half, which is private code.
The library does this automatically when you use highlightBlock.
It's the only random utility function we currently expose other than inherit.
We should focus on highlighting, not providing random string utility functions. So far the only need for this to be public I've heard is #2529. That was actually a misunderstanding and the function wasn't required at all.
The use case though was:
I'm using React (or something) and I need to highlightBlock but without calling highlightBlock (since I can't modify the DOM). So I'm essentially building my own highlightBlock and I want to use this method like the internal code does.
I'm pretty sure the simple answer here is the block in question doesn't need to be part of the DOM... so you could make a new block, highlight, and then fetch the code...
letdiv=document.createElement('div');div.innerHTML=actualElement.innerHTML;hljs.highlightBlock(div);// do with div.result it as you please
But really I'd like to learn more about the popular/common usage patterns with React/Vue/other frameworks and see if we could better support them in general - or make them easy to support with an official plugin. IE, if there is some weird need for fixMarkup now, remove that need.
The text was updated successfully, but these errors were encountered:
fixMarkup
is the second half of the transformation process that happens when someone usesuseBR
. The first half of the process is private code.highlightBlock
.inherit
.We should focus on highlighting, not providing random string utility functions. So far the only need for this to be public I've heard is #2529. That was actually a misunderstanding and the function wasn't required at all.
The use case though was:
I'm pretty sure the simple answer here is the block in question doesn't need to be part of the DOM... so you could make a new block, highlight, and then fetch the code...
But really I'd like to learn more about the popular/common usage patterns with React/Vue/other frameworks and see if we could better support them in general - or make them easy to support with an official plugin. IE, if there is some weird need for
fixMarkup
now, remove that need.The text was updated successfully, but these errors were encountered: