feat: more decoration

This commit is contained in:
TrèsAbhi committed 2026-03-19 18:26:08 -05:00
1 parent c99ed0cb53
commit b9bbf22f2c
6 files changed
+39 -20

No files matched your search

@@ -0,0 +1,23 @@
---
import { all, createStarryNight } from "@wooorm/starry-night";
import { HighlightedCodeContent } from "./HighlightedCodeContent";
interface Props {
lang: string;
content: string;
}
const { lang, content } = Astro.props;
const starryNight = await createStarryNight(all);
const scope = starryNight.flagToScope(lang);
if (scope === undefined && lang.length > 0) {
throw new Error(`Unsupported language: ${lang}`);
}
const tree =
lang.length === 0 ? content : starryNight.highlight(content, scope!);
---
<HighlightedCodeContent {tree} />