code-server
dedevs-ui/code-serverFreeComponent
Code server component
See it running
Open the demo on dedevs-ui
ui.dedevs.com/components/code-serverInstall it
npx shadcn@latest add https://ui.dedevs.com/r/code-server.jsonSource
1import {2 transformerNotationDiff,3 transformerNotationErrorLevel,4 transformerNotationFocus,5 transformerNotationHighlight,6 transformerNotationWordHighlight,7} from '@shikijs/transformers';8import type { HTMLAttributes } from 'react';9import {10 type BundledLanguage,11 type CodeOptionsMultipleThemes,12 codeToHtml,13} from 'shiki';1415export type CodeBlockContentProps = HTMLAttributes<HTMLDivElement> & {16 themes?: CodeOptionsMultipleThemes['themes'];17 language?: BundledLanguage;18 children: string;19 syntaxHighlighting?: boolean;20};2122export const CodeBlockContent = async ({23 children,24 themes,25 language,26 syntaxHighlighting = true,27 ...props28}: CodeBlockContentProps) => {29 const html = syntaxHighlighting30 ? await codeToHtml(children as string, {31 lang: language ?? 'typescript',32 themes: themes ?? {33 light: 'vitesse-light',34 dark: 'vitesse-dark',35 },36 transformers: [37 transformerNotationDiff({38 matchAlgorithm: 'v3',39 }),40 transformerNotationHighlight({41 matchAlgorithm: 'v3',42 }),43 transformerNotationWordHighlight({44 matchAlgorithm: 'v3',45 }),46 transformerNotationFocus({47 matchAlgorithm: 'v3',48 }),49 transformerNotationErrorLevel({50 matchAlgorithm: 'v3',51 }),52 ],53 })54 : children;5556 return (57 <div58 // biome-ignore lint/security/noDangerouslySetInnerHtml: "Kinda how Shiki works"59 dangerouslySetInnerHTML={{ __html: html }}60 className="bg-background border rounded-lg"61 {...props}62 />63 );64};
Files it writes
More from dedevs-ui
All 30 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| ai-branchai-branch | dedevs-ui | Components | Free | no deps | |
| ai-conversationai-conversation | dedevs-ui | Components | Free | no deps | |
| ai-inputai-input | dedevs-ui | Components | Free | no deps | |
| ai-messageai-message | dedevs-ui | Components | Free | no deps | |
| ai-reasoningai-reasoning | dedevs-ui | Components | Free | no deps | |
| ai-responseai-response | dedevs-ui | Components | Free | no deps | |
| ai-serverai-server | dedevs-ui | Components | Free | no deps | |
| ai-simpleai-simple | dedevs-ui | Components | Free | no deps |
