If we had npm, here were the would-be configuration.
npm markdown-it@8.4.0
npm install @centerforopenscience/markdown-it-toc@1.1.1
npm install markdown-it-highlightjs@3.0.0
npm install markdown-it-ins-del@0.1.1
npm install markdown-it-sanitizer@0.4.3
npm install markdown-it-mathjax@2.0.0For MFR, a customized local copy of each script is stored in the extension's static folder. There are a few issues:
-
MFR scripts run directly in the browser without Babel. For ES5 compatibility, developers must use Babel to convert ES6
markdown-it-highlightjsto an ES5 version. -
MFR does not use a package manager. Thus,
requireis NOT available. For theviewer.makoto be able to load these libraries, customization is necessary to export viaroot.<PLUGIN_NAME>. The main script in theviewer.makouseswindow.<PLUGIN_NAME>to access them.markdown-itandmarkdown-it-sanitizerare already set up to be exported code. MFR loads theminversion directly.markdown-it-toc,markdown-it-highlightjs,markdown-it-ins-delandmarkdown-it-mathjaxare not. The following wrapper must be used.(function (root, factory) { if (typeof exports === "object") { module.exports = factory(); } else { root.<PLUGIN_NAME> = factory(); } }) (this, function () { return function(md/*, optional arguments*/) { /* library code */ } });
Here is a list of the original copies of the scripts: