Skip to content

Commit ae51965

Browse files
authored
Add dynamic code block highlighting documentation
1 parent 66303fe commit ae51965

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

docs/language-highlight.md

Lines changed: 10 additions & 0 deletions
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 = "echo 'Hello World!'"
61+
code.setAttribute("class", "lang-bash");
62+
Prism.highlightElement(code);
63+
```

0 commit comments

Comments
 (0)