Javascript Syntax Highlighting CDN URLs in HTML export are incorrect and return 404

Viewed 14

The HTML export for Javascript syntax highlighting includes incorrect CDN URLs for
highlight.js that return a 404 error.

Exported URL (broken):
https://cdn.jsdelivr.net/npm/highlight.js@11.9.0/lib/highlight.min.js

Correct URL:
https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.11.1/build/highlight.min.js

The issue is twofold: the path uses the npm package instead of the GitHub
cdn-release repository, and the version is outdated. The npm package does not
include prebuilt distribution files, so /lib/highlight.min.js does not exist
on that CDN path.

The correct block for export should be:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.11.1/build/styles/github.min.css">

<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.11.1/build/highlight.min.js"></script>

<script>hljs.highlightAll();</script>
1 Answers

I'll update this, thanks.