-
Notifications
You must be signed in to change notification settings - Fork 85
Open
Labels
help wantedExtra attention is neededExtra attention is needed
Description
In this part of the code:
Lines 340 to 342 in 684c444
| const HLJSURL = "https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.6.0/build/highlight.min.js"; | |
| const HLJSNumURL = "https://cdn.jsdelivr.net/npm/highlightjs-line-numbers.js@2.8.0/dist/highlightjs-line-numbers.min.js"; | |
| const loadHLJS = typeof hljs != "undefined" && typeof hljs.highlightElement != "undefined" ? Promise.resolve() : loadScript(HLJSURL); |
We check if the global variable hljs is present. If not, we load the script. But it seems that if we load multiple code snippets fast enough, hljs will be undefined while they are being loaded, causing multiple <script> tags to appear to load highlightjs.
This issue may or may not appear depending on the internet connectivity. But it is there. To mitigate this issue, I suggest that we check the existence of the script tag loading highlighjs library instead of checking hljs variable.
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed