Highlighting dynamically generated content #217
-
Hey, my website uses content delivery. I convert markdown text to html using marked, and store the result in innerHtml. Is there a way to highlight code segments contained in innerHtml using this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The Try ngx-highlightjs/projects/ngx-highlightjs/src/lib/highlight.service.ts Lines 64 to 74 in b4b7ba2 ngx-highlightjs/projects/ngx-highlightjs/src/lib/highlight.service.ts Lines 76 to 84 in b4b7ba2 |
Beta Was this translation helpful? Give feedback.
The
[highlight]
directive will not be helpful in this use case, however, you can take advantage of the service call to the libraryTry
highlightJS.highlightElement(contentWrapperEl).subrscribe
orhighlightJS.highlightAll().subscribe()
ngx-highlightjs/projects/ngx-highlightjs/src/lib/highlight.service.ts
Lines 64 to 74 in b4b7ba2