From 70d16913f3e9933421cc9cc01db68f9138ed3af3 Mon Sep 17 00:00:00 2001 From: Max Richter Date: Wed, 2 Aug 2023 17:21:03 +0200 Subject: [PATCH] feat: add some highlighting to markdown renderer --- components/RecipeHero.tsx | 2 +- components/layouts/main.tsx | 6 + lib/documents.ts | 18 +-- lib/highlight.ts | 79 +++++++++++ lib/string.ts | 3 +- routes/_app.tsx | 1 + routes/api/articles/create/index.ts | 13 ++ routes/articles/[name].tsx | 4 +- static/prism-material-dark.css | 205 ++++++++++++++++++++++++++++ static/prism-twilight.css | 169 +++++++++++++++++++++++ 10 files changed, 485 insertions(+), 15 deletions(-) create mode 100644 lib/highlight.ts create mode 100644 static/prism-material-dark.css create mode 100644 static/prism-twilight.css diff --git a/components/RecipeHero.tsx b/components/RecipeHero.tsx index fddad8e..18cde2b 100644 --- a/components/RecipeHero.tsx +++ b/components/RecipeHero.tsx @@ -31,7 +31,7 @@ export function RecipeHero( Recipe Banner )} diff --git a/components/layouts/main.tsx b/components/layouts/main.tsx index 70171e6..1184f9b 100644 --- a/components/layouts/main.tsx +++ b/components/layouts/main.tsx @@ -1,5 +1,7 @@ import { ComponentChildren } from "preact"; import { menu } from "@lib/menus.ts"; +import { CSS, KATEX_CSS,render } from "https://deno.land/x/gfm/mod.ts"; +import { Head } from "$fresh/runtime.ts"; export type Props = { children: ComponentChildren; @@ -15,6 +17,10 @@ export const MainLayout = ({ children, url }: Props) => { class="md:grid mx-auto" style={{ gridTemplateColumns: "200px 1fr", maxWidth: "1024px" }} > + + + +