perf(cdn): CDNJS instead of JSDelivr (#891)

This commit is contained in:
s-crypt 2024-02-18 20:26:04 -08:00 committed by GitHub
parent b1a105371b
commit 739c2e2cc8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 5 deletions

View File

@ -84,10 +84,10 @@ export const Latex: QuartzTransformerPlugin<Options> = (opts?: Options) => {
externalResources() { externalResources() {
if (engine === "katex") { if (engine === "katex") {
return { return {
css: ["https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/katex.min.css"], css: ["https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/katex.min.css"],
js: [ js: [
{ {
src: "https://cdn.jsdelivr.net/npm/katex@0.16.7/dist/contrib/copy-tex.min.js", src: "https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.7/contrib/copy-tex.min.js",
loadTime: "afterDOMReady", loadTime: "afterDOMReady",
contentType: "external", contentType: "external",
}, },

View File

@ -26,12 +26,12 @@ export const Latex: QuartzTransformerPlugin<Options> = (opts?: Options) => {
return { return {
css: [ css: [
// base css // base css
"https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.css", "https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/katex.min.css",
], ],
js: [ js: [
{ {
// fix copy behaviour: https://github.com/KaTeX/KaTeX/blob/main/contrib/copy-tex/README.md // fix copy behaviour: https://github.com/KaTeX/KaTeX/blob/main/contrib/copy-tex/README.md
src: "https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/contrib/copy-tex.min.js", src: "https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/contrib/copy-tex.min.js",
loadTime: "afterDOMReady", loadTime: "afterDOMReady",
contentType: "external", contentType: "external",
}, },

View File

@ -619,7 +619,7 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin<Partial<Options>
let mermaidImport = undefined let mermaidImport = undefined
document.addEventListener('nav', async () => { document.addEventListener('nav', async () => {
if (document.querySelector("code.mermaid")) { if (document.querySelector("code.mermaid")) {
mermaidImport ||= await import('https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs') mermaidImport ||= await import('https://cdnjs.cloudflare.com/ajax/libs/mermaid/10.7.0/mermaid.esm.min.mjs')
const mermaid = mermaidImport.default const mermaid = mermaidImport.default
const darkMode = document.documentElement.getAttribute('saved-theme') === 'dark' const darkMode = document.documentElement.getAttribute('saved-theme') === 'dark'
mermaid.initialize({ mermaid.initialize({