diff options
Diffstat (limited to 'packages/ui/src/components/code.tsx')
| -rw-r--r-- | packages/ui/src/components/code.tsx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/packages/ui/src/components/code.tsx b/packages/ui/src/components/code.tsx index f1c7efada..a31649788 100644 --- a/packages/ui/src/components/code.tsx +++ b/packages/ui/src/components/code.tsx @@ -11,20 +11,21 @@ export type CodeProps<T = {}> = FileOptions<T> & { export function Code<T>(props: CodeProps<T>) { let container!: HTMLDivElement const [local, others] = splitProps(props, ["file", "class", "classList", "annotations"]) - const file = () => local.file createEffect(() => { const instance = new File<T>({ theme: { dark: "oc-1-dark", light: "oc-1-light" }, // or any Shiki theme overflow: "wrap", // or 'scroll' themeType: "system", // 'system', 'light', or 'dark' + disableFileHeader: true, disableLineNumbers: false, // optional // lang: 'typescript', // optional - auto-detected from filename if not provided ...others, }) + container.innerHTML = "" instance.render({ - file: file(), + file: local.file, lineAnnotations: local.annotations, containerWrapper: container, }) |
