MCPcopy Create free account
hub / github.com/TheOrcDev/8bitcn-ui / highlightCode

Function highlightCode

lib/highlight-code.ts:53–77  ·  view source on GitHub ↗
(code: string, language = "tsx")

Source from the content-addressed store, hash-verified

51] as ShikiTransformer[];
52
53export async function highlightCode(code: string, language = "tsx") {
54 const html = await codeToHtml(code, {
55 lang: language,
56 themes: {
57 dark: "github-dark",
58 light: "github-light",
59 },
60 transformers: [
61 {
62 pre(node) {
63 node.properties.class =
64 "no-scrollbar min-w-0 overflow-x-auto px-4 py-3.5 outline-none has-[[data-highlighted-line]]:px-0 has-[[data-line-numbers]]:px-0 has-[[data-slot=tabs]]:p-0 !bg-transparent";
65 },
66 code(node) {
67 node.properties["data-line-numbers"] = "";
68 },
69 line(node) {
70 node.properties["data-line"] = "";
71 },
72 },
73 ],
74 });
75
76 return html;
77}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected