Change CDN links (#1243)

This commit is contained in:
Lukas Drgon
2018-04-04 14:54:00 +02:00
committed by ylemkimon
parent f35c41883c
commit 0f17ac5080
2 changed files with 4 additions and 4 deletions

View File

@@ -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:
```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">
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.9.0/katex.min.js" integrity="sha384-jmxIlussZWB7qCuB+PgKG1uLjjxbVVIayPJwi6cG6Zb4YKq0JIw+OMnkkEC7kYCq" crossorigin="anonymous"></script>
<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://cdn.jsdelivr.net/npm/katex@0.9.0/dist/katex.min.js" integrity="sha384-jmxIlussZWB7qCuB+PgKG1uLjjxbVVIayPJwi6cG6Zb4YKq0JIw+OMnkkEC7kYCq" crossorigin="anonymous"></script>
```
#### In-browser rendering

View File

@@ -26,7 +26,7 @@ Promise.all(process.argv.slice(3).map(file =>
// 5 - integrity opening quote: "
// 6 - old hash: 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 = {};
body = body.replace(re, (m, pre, oq1, post, file, oq2, old, algo) => {
if (old) {
@@ -35,7 +35,7 @@ Promise.all(process.argv.slice(3).map(file =>
return pre + version + post;
});
return Promise.all(Object.keys(hashes).map(hash =>
read(path.join("dist", hashes[hash].file), null)
read(hashes[hash].file, null)
.then(data => {
body = body.replace(hash, sriToolbox.generate({
algorithms: [hashes[hash].algo],