Created
March 24, 2022 10:13
-
-
Save guilatrova/7e72cff3b5cb7099268bb6e19b84ea90 to your computer and use it in GitHub Desktop.
Highlightjs with copy badge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Coding styles --> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.1.0/highlight.min.js" integrity="sha512-z+/WWfyD5tccCukM4VvONpEtLmbAm5LDu7eKiyMQJ9m7OfPEDL7gENyDRL3Yfe8XAuGsS2fS4xSMnl6d30kqGQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> | |
<!-- For the highlight badge --> | |
<script src="https://unpkg.com/highlightjs-badge/highlightjs/highlight.pack.js"></script> | |
<script src="https://unpkg.com/highlightjs-badge/highlightjs-badge.min.js"></script> | |
<script> | |
hljs.initHighlightingOnLoad(); | |
document.addEventListener("DOMContentLoaded", (event) => { | |
var pres = document.querySelectorAll("pre>code"); | |
for (var i = 0; i < pres.length; i++) { | |
hljs.highlightBlock(pres[i]); | |
} | |
var options = { | |
contentSelector: "article", | |
loadDelay:0, | |
copyIconClass: "code-badge-copy-icon", | |
checkIconClass: "code-badge-check-icon", | |
}; | |
window.highlightJsBadge(options); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment