We can improve cold start times by only loading route modules when the particular pattern matches. This PR introduces the concept of lazy middlewares, routes and handlers to do that.
14 lines
482 B
TypeScript
14 lines
482 B
TypeScript
import { Prism } from "../utils/prism.ts";
|
|
|
|
export function CodeBlock(
|
|
{ code, lang }: { code: string; lang: "js" | "ts" | "jsx" | "md" | "bash" },
|
|
) {
|
|
return (
|
|
<pre
|
|
class="rounded-lg text-base leading-relaxed bg-slate-800 text-white p-4 sm:p-6 md:p-4 lg:p-6 2xl:p-8 overflow-x-auto"
|
|
data-language={lang}
|
|
// deno-lint-ignore react-no-danger
|
|
><code dangerouslySetInnerHTML={{ __html: Prism.highlight(code, Prism.languages[lang], lang)}} /></pre>
|
|
);
|
|
}
|