From 739c2e2cc8db456514f81def7fa8c519656fdaa7 Mon Sep 17 00:00:00 2001 From: s-crypt <41712656+s-crypt@users.noreply.github.com> Date: Sun, 18 Feb 2024 20:26:04 -0800 Subject: [PATCH] perf(cdn): CDNJS instead of JSDelivr (#891) --- docs/advanced/making plugins.md | 4 ++-- quartz/plugins/transformers/latex.ts | 4 ++-- quartz/plugins/transformers/ofm.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/advanced/making plugins.md b/docs/advanced/making plugins.md index 565f5bd..d9ed9e3 100644 --- a/docs/advanced/making plugins.md +++ b/docs/advanced/making plugins.md @@ -84,10 +84,10 @@ export const Latex: QuartzTransformerPlugin = (opts?: Options) => { externalResources() { if (engine === "katex") { 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: [ { - 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", contentType: "external", }, diff --git a/quartz/plugins/transformers/latex.ts b/quartz/plugins/transformers/latex.ts index ab10a4f..c9f6bff 100644 --- a/quartz/plugins/transformers/latex.ts +++ b/quartz/plugins/transformers/latex.ts @@ -26,12 +26,12 @@ export const Latex: QuartzTransformerPlugin = (opts?: Options) => { return { 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: [ { // 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", contentType: "external", }, diff --git a/quartz/plugins/transformers/ofm.ts b/quartz/plugins/transformers/ofm.ts index e110e40..6aad230 100644 --- a/quartz/plugins/transformers/ofm.ts +++ b/quartz/plugins/transformers/ofm.ts @@ -619,7 +619,7 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin let mermaidImport = undefined document.addEventListener('nav', async () => { 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 darkMode = document.documentElement.getAttribute('saved-theme') === 'dark' mermaid.initialize({