diff --git a/docs/language-highlight.md b/docs/language-highlight.md index 1e089c10d..1956af71f 100644 --- a/docs/language-highlight.md +++ b/docs/language-highlight.md @@ -51,3 +51,13 @@ function getAdder(int $x): int return 123; } ``` + +## Highlighting Dynamic Content +Code blocks [dynamically created from javascript](https://docsify.js.org/#/configuration?id=executescript) can be highlighted using the method `Prism.highlightElement` like so: + +```javascript +var code = document.createElement("code"); +code.innerHTML = "console.log('Hello World!')"; +code.setAttribute("class", "lang-javascript"); +Prism.highlightElement(code); +```