MCPcopy
hub / github.com/code-hike/codehike / HighCode

Function HighCode

apps/web/components/code.tsx:54–148  ·  view source on GitHub ↗
({
  highlighted,
  className,
  style,
  extraHandlers = [],
}: {
  highlighted: HighlightedCode
  className?: string
  style?: React.CSSProperties
  extraHandlers?: AnnotationHandler[]
})

Source from the content-addressed store, hash-verified

52}
53
54export function HighCode({
55 highlighted,
56 className,
57 style,
58 extraHandlers = [],
59}: {
60 highlighted: HighlightedCode
61 className?: string
62 style?: React.CSSProperties
63 extraHandlers?: AnnotationHandler[]
64}) {
65 const { title, flags } = extractFlags(highlighted)
66 const h = { ...highlighted, meta: title }
67
68 const handlers = [
69 ...extraHandlers,
70 mark,
71 tooltip,
72 pill,
73 fold,
74 link,
75 focus,
76 ruler,
77 flags.includes("a") && tokenTransitions,
78 flags.includes("n") && lineNumbers,
79 diff,
80 ...collapse,
81 flags.includes("w") && wordWrap,
82 callout,
83 ].filter(Boolean) as AnnotationHandler[]
84
85 const pre = (
86 <Pre
87 code={h}
88 className="m-0 py-2 px-0 bg-editor-background rounded-none group flex-1 selection:bg-editor-selectionBackground"
89 handlers={handlers}
90 style={{
91 backgroundColor: "var(--bg-color)",
92 }}
93 />
94 )
95
96 if (title) {
97 return (
98 <div
99 className={cn(
100 "border border-editorGroup-border rounded overflow-hidden my-2",
101 className,
102 )}
103 style={
104 {
105 "--border-color": "var(--ch-23)",
106 borderColor: "var(--border-color)",
107 ...style,
108 } as any
109 }
110 >
111 <div

Callers

nothing calls this directly

Calls 2

cnFunction · 0.90
extractFlagsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…