Skip to content

Commit 72485a3

Browse files
authored
docs: Add dynamic code block highlighting documentation (#1626)
1 parent 66303fe commit 72485a3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Diff for: docs/language-highlight.md

+10
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,13 @@ function getAdder(int $x): int
5151
return 123;
5252
}
5353
```
54+
55+
## Highlighting Dynamic Content
56+
Code blocks [dynamically created from javascript](https://docsify.js.org/#/configuration?id=executescript) can be highlighted using the method `Prism.highlightElement` like so:
57+
58+
```javascript
59+
var code = document.createElement("code");
60+
code.innerHTML = "console.log('Hello World!')";
61+
code.setAttribute("class", "lang-javascript");
62+
Prism.highlightElement(code);
63+
```

0 commit comments

Comments
 (0)