GetRD / academic-file-converter

📚 Import Bibtex publications and Jupyter Notebook blog posts into your Markdown website or book. 将Bibtex转换为Markdown网站
https://docs.hugoblox.com/reference/content-types/#automatically-import-publications-from-bibtex
MIT License
356 stars 101 forks source link

import assets: include MathJax & Reveal extensions #15

Closed gcushen closed 4 years ago

gcushen commented 5 years ago

Problem, as defined in #13:

[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (MathMenu.js, line 0)
[Error] Refused to execute http://localhost:1313/extensions/MathMenu.js?V=2.7.4 as script because "X-Content-Type: nosniff" was given and its Content-Type is not a script MIME type.
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (MathZoom.js, line 0)
[Error] Refused to execute http://localhost:1313/extensions/MathZoom.js?V=2.7.4 as script because "X-Content-Type: nosniff" was given and its Content-Type is not a script MIME type.

Similar situation with other dynamically loaded scripts such as Reveal extensions.

danielschemmel commented 4 years ago

I have successfully (manually) gotten mathjax to work by dumping all the additional mathjax scripts in /static/js/vendor. Note that MathJax is loaded unconditionally that way due too the inclusion of its core script in /static/js/vendor/main.min.js - a fix for that would require a slight modification to site_head.html in the template.

gcushen commented 4 years ago

Since this issue was originally opened, Academic has evolved to using the industry standard Node JS approach to downloading offline assets - see comment at https://github.com/gcushen/hugo-academic/pull/1554#issuecomment-596151573 .

At the time of writing, Bootstrap and the speaker notes tool are the only built-in offline assets.

Hence, please consider opening a PR on the Academic repo to improve handling of offline assets in https://github.com/gcushen/hugo-academic/blob/master/package.json and https://github.com/gcushen/hugo-academic/blob/master/scripts/update_bootstrap.sh .

Ideally, we would attempt to integrate the Node JS approach to offline files closely with the Academic online CDN approach, whether that be using Academic's existing Assets Library or refactoring Academic to attempt to grab the versioning of CDN assets from the package.json. A potential issue with the latter is that the CDN package naming and version naming/availability can differ to that in the NPM Package Registry.

As a result of the above effort, our early Python-based approach to downloading assets will likely be deprecated once offline support has migrated to the Node JS approach.