mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-07 12:18:39 +00:00
Change CDN links (#1243)
This commit is contained in:
@@ -17,8 +17,8 @@ KaTeX supports all major browsers, including Chrome, Safari, Firefox, Opera, Edg
|
|||||||
You can [download KaTeX](https://github.com/khan/katex/releases) and host it on your server or include the `katex.min.js` and `katex.min.css` files on your page directly from a CDN:
|
You can [download KaTeX](https://github.com/khan/katex/releases) and host it on your server or include the `katex.min.js` and `katex.min.css` files on your page directly from a CDN:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.9.0/katex.min.css" integrity="sha384-TEMocfGvRuD1rIAacqrknm5BQZ7W7uWitoih+jMNFXQIbNl16bO8OZmylH/Vi/Ei" crossorigin="anonymous">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.9.0/dist/katex.min.css" integrity="sha384-TEMocfGvRuD1rIAacqrknm5BQZ7W7uWitoih+jMNFXQIbNl16bO8OZmylH/Vi/Ei" crossorigin="anonymous">
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.9.0/katex.min.js" integrity="sha384-jmxIlussZWB7qCuB+PgKG1uLjjxbVVIayPJwi6cG6Zb4YKq0JIw+OMnkkEC7kYCq" crossorigin="anonymous"></script>
|
<script src="https://cdn.jsdelivr.net/npm/katex@0.9.0/dist/katex.min.js" integrity="sha384-jmxIlussZWB7qCuB+PgKG1uLjjxbVVIayPJwi6cG6Zb4YKq0JIw+OMnkkEC7kYCq" crossorigin="anonymous"></script>
|
||||||
```
|
```
|
||||||
|
|
||||||
#### In-browser rendering
|
#### In-browser rendering
|
||||||
|
@@ -26,7 +26,7 @@ Promise.all(process.argv.slice(3).map(file =>
|
|||||||
// 5 - integrity opening quote: "
|
// 5 - integrity opening quote: "
|
||||||
// 6 - old hash: sha384-…
|
// 6 - old hash: sha384-…
|
||||||
// 7 - integrity hash algorithm: sha384
|
// 7 - integrity hash algorithm: sha384
|
||||||
const re = /((["'])https?:\/\/cdnjs.cloudflare.com\/ajax\/libs\/KaTeX\/)[^\/"']+(\/([^"']+)\2(?:\s+integrity=(["'])(([^-]+)-[^"']+)\5)?)/g;
|
const re = /((["'])https?:\/\/cdn\.jsdelivr\.net\/npm\/katex@)[^\/"']+(\/([^"']+)\2(?:\s+integrity=(["'])(([^-]+)-[^"']+)\5)?)/g;
|
||||||
const hashes = {};
|
const hashes = {};
|
||||||
body = body.replace(re, (m, pre, oq1, post, file, oq2, old, algo) => {
|
body = body.replace(re, (m, pre, oq1, post, file, oq2, old, algo) => {
|
||||||
if (old) {
|
if (old) {
|
||||||
@@ -35,7 +35,7 @@ Promise.all(process.argv.slice(3).map(file =>
|
|||||||
return pre + version + post;
|
return pre + version + post;
|
||||||
});
|
});
|
||||||
return Promise.all(Object.keys(hashes).map(hash =>
|
return Promise.all(Object.keys(hashes).map(hash =>
|
||||||
read(path.join("dist", hashes[hash].file), null)
|
read(hashes[hash].file, null)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
body = body.replace(hash, sriToolbox.generate({
|
body = body.replace(hash, sriToolbox.generate({
|
||||||
algorithms: [hashes[hash].algo],
|
algorithms: [hashes[hash].algo],
|
||||||
|
Reference in New Issue
Block a user