mirror of
https://gitee.com/docsifyjs/docsify.git
synced 2024-11-29 18:48:14 +08:00
docs: Add dynamic code block highlighting documentation (#1626)
This commit is contained in:
parent
66303fec4c
commit
72485a38c1
@ -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);
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user