Open joshgoebel opened 2 years ago
Yup. My bad.
Does this look better? https://github.com/highlightjs/highlightjs-octave/commit/b73793a5fa307d420a866628255ffb76384654a2
Now looks like:
As far as I can tell your distributable doesn't match the HLJS CDN "spec" of self-registration so this code won't work.
<script type="text/javascript" src="/path/to/octave.min.js"></script>
It effectively does nothing. It sets an octave
variable (in the global scope), nothing more. You'd need to add the registration hook to the CDN version also.
hljs.registerLanguage("octave", octave);
Typically 3rd party grammars have two JS files... one for server-side require/import use, which you're already providing but then also then a second "ready-to-roll" CDN web-ready distributable that's CJS and does self-registration. If you use the Highlight.js build process (see 3rd party maintainer docs) you get this file for free (and we recommend people just check it into git
)... there are of ways to build it yourself - but using our build process provides security and sanity checks as well.
Since you're already using your own build system you could probably sort it out by creating a second entry point that ALSO includes self-registration and then publish that file as web-ready CJS in dist
. (I'd still recommend you run ours periodically though for the security regex scanning)
See robots-txt dist
for an example of what a finalized CDN-ready product looks like:
https://github.com/highlightjs/highlightjs-robots-txt/blob/master/dist/robots-txt.min.js
A newer example with the nicer bundling and build header:
https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.4.0/languages/basic.min.js
Work for this is now on the separate https://github.com/apjanke/highlightjs-octave/tree/fix-usage-instructions branch. I'll review "basic" language definition and use that as a guideline.
window.hljsDefineVue
doesn't look right...