vue-markdown icon indicating copy to clipboard operation
vue-markdown copied to clipboard

Highlight doesn't work when vue-markdown is called from <router-view/>

Open bjankie1 opened this issue 6 years ago • 2 comments

When vue-markdown is placec outside of router-view it works like a charm with highlighting. When the same component is called from within router-view component the highlighting doesn't apply. I will try to attach a screenshot presenting the effect. It seems to be some kind of race condition related to prism invocation.

bjankie1 avatar Jul 04 '18 20:07 bjankie1

Screenshot

bjankie1 avatar Jul 04 '18 20:07 bjankie1

I think I've found the answer: https://github.com/PrismJS/prism/issues/907

Prism only runs on DOMContentLoaded and highlights what's there. To highlight any other element, use Prism.highlightElement(). If there are many, use Prism.highlightAll(), but keep in mind that will also go over already highlighted elements and re-highlight them.

bjankie1 avatar Jul 05 '18 07:07 bjankie1