From 2bb4277d7febc8c1ca819b359b41ac9a72cf4008 Mon Sep 17 00:00:00 2001 From: Okiki Ojo Date: Sun, 30 Jul 2023 03:03:07 +0000 Subject: [PATCH] fix: deno deploy `npm:...` import error --- deps.ts | 6 +++++- docs.tsx | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/deps.ts b/deps.ts index 9aa9fac..1230a0e 100644 --- a/deps.ts +++ b/deps.ts @@ -15,7 +15,11 @@ export { default as withHtmlInMarkdown } from "https://esm.sh/rehype-raw" export { default as toHtml } from "https://esm.sh/rehype-stringify" export { default as toHast } from "https://esm.sh/remark-rehype" export { default as withShiki } from "https://esm.sh/@stefanprobst/remark-shiki" -export * as shiki from "npm:shiki" + +// https://deno.bundlejs.com/file?q=shiki + +// @deno-types=https://esm.sh/shiki +export * as shiki from "https://unpkg.com/shiki/dist/index.browser.mjs" export { default as GithubMarkdownFlavor } from "https://esm.sh/remark-gfm" diff --git a/docs.tsx b/docs.tsx index b1a8ebc..679c1cf 100644 --- a/docs.tsx +++ b/docs.tsx @@ -1,8 +1,6 @@ -/** @jsx h */ import { ColorScheme, fromMarkdown, - h, html, path, shiki, @@ -24,8 +22,10 @@ const __dirname = dirname(fromFileUrl(import.meta.url)); // check the color scheme with system settings automatically html.use(ColorScheme("dark")); +shiki.setCDN("https://unpkg.com/shiki/"); +const highlighter = await shiki.getHighlighter({ theme: "github-dark" }); + export async function getDocs() { - const highlighter = await shiki.getHighlighter({ theme: "github-dark" }); const file = await unified() .use(fromMarkdown) // Parse markdown content to a syntax tree .use(GithubMarkdownFlavor) -- 2.51.2