Skip to content

Highlighting dynamically generated content #217

Answered by MurhafSousli
MixusMinimax asked this question in Q&A
Discussion options

You must be logged in to vote

The [highlight] directive will not be helpful in this use case, however, you can take advantage of the service call to the library

Try highlightJS.highlightElement(contentWrapperEl).subrscribe or highlightJS.highlightAll().subscribe()

/**
* Applies highlighting to a DOM node containing code.
* This function is the one to use to apply highlighting dynamically after page load or within initialization code of third-party JavaScript frameworks.
* The function uses language detection by default but you can specify the language in the class attribute of the DOM node. See…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@MixusMinimax
Comment options

@MurhafSousli
Comment options

Answer selected by MixusMinimax
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants