1.5 KiB
1.5 KiB
Subresource Integrity
If you are loading Highlight.js via CDN you may wish to use Subresource Integrity to guarantee that you are using a legimitate build of the library.
To do this you simply need to add the integrity
attribute for each JavaScript file you download via CDN. These digests are used by the browser to confirm the files downloaded have not been modified.
<script
src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"
integrity="sha384-xBsHBR6BS/LSlO3cOyY2D/4KkmaHjlNn3NnXUMFFc14HLZD7vwVgS3+6U/WkHAra"></script>
<!-- including any other grammars you might need to load -->
<script
src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/go.min.js"
integrity="sha384-WmGkHEmwSI19EhTfO1nrSk3RziUQKRWg3vO0Ur3VYZjWvJRdRnX4/scQg+S2w1fI"></script>
The full list of digests for every file can be found below.
Digests
sha384-bWwkdmOCj83zZ8/m+oPD9goRMhrPCb25ZA6aTyg7vcsq9IpuyED38kQSw1Na4UTZ /es/languages/markdown.js
sha384-SqGSUq0DMQ0OUQnQnTuVDCJyhANd/MFNj+0PF67S+VXgHpR8A4tPsf/3GoSFRmrx /es/languages/markdown.min.js
sha384-U+zIQPoVdPCO0o4poik2hYNbHtNm+L5OojDTulgIeEZTNz+LooLAm72d66mNjwKD /languages/markdown.js
sha384-mCUujHHbWJEjcupTTfWOk9YR3YCYNHaA578+TTXUd4LPi7fGNuMQbysbl1pmcIGd /languages/markdown.min.js
sha384-T3iuPyfWZPoYqIwEboJ5mGxyhhRxCQ99OlkULesV7CKerMVXEgDyOzWrQmJREI0r /highlight.js
sha384-mgfo9RLqcM7eT8VO/iNHqxvxaYUdFMrThn508chNhk8vGeQL4wWOeALavxswYdCz /highlight.min.js