emgithub
emgithub copied to clipboard
Multiple `<script>` tags loaded for highlightjs
In this part of the code:
https://github.com/yusanshi/emgithub/blob/684c4445e80cb5255ee7af68bb1e463c1f44c3ed/embed-v2.js#L340-L342
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.