-1

I am using cayman theme for github for writing scientific articles which i can host on Github pages. I am using mathjax to render equations.

I have pasted the following lines inside the cayman/_includes/head-custom.html file.

<script type="text/javascript" id="MathJax-script" async
  src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
</script>

Mathjax renders the math equations correctly (local and remote), but it produces an error on Github (image attached). I can not make anything out of this error, I am a little concerned that it may create bigger issue later on.

Any guesses why this error and how to fix it.

enter image description here

pkj
  • 559
  • 1
  • 9
  • 21

1 Answers1

1

It appears that your html-proofer test script implementation is set to check for CORS/SRI on external js resources and thus is throwing a validation error because it's expecting a couple of additional attributes on all <script> tags (that aren't there currently on the tags in question), crossorigin="anonymous" and integrity="...insert-sha256-value-here..."

My understanding is that SRI needs to be supported by the developer and therefore the integrity value should be coming from them.

If MathJax hasn't provided an integrity value along with their CDN script code then I think you may need to disable checking for CORS/SRI to eliminate the error.

Do you have access to the script that contains the command that runs html-proofer, and if so, can you see if it's checking for SRI? Might look something like this:

htmlproofer --check-sri ...

According to the html-proofer docs, --check-sri defaults to false, so if this option is being set and you can disable it, I'd give that a try.

Aaron Sarnat
  • 1,207
  • 8
  • 16
  • FYI according to [this SO question](https://stackoverflow.com/questions/39374880/sub-resource-integrity-value-for-maps-google-com-maps-api-js) there is a way you can generate your own `integrity` value but it sounds brittle. And there may be an issue if your script src path includes a specific version number. – Aaron Sarnat Aug 26 '21 at 07:14
  • According to [this GitHub issue](https://github.com/mathjax/MathJax/issues/1366), adding SRI support to MathJax is an open feature request. – Aaron Sarnat Aug 26 '21 at 07:19