({
code,
notes = {},
}: {
code: RawCode
notes?: Record<string, { children: React.ReactNode }>
})
| 50 | } |
| 51 | |
| 52 | export async function CodeWithNotes({ |
| 53 | code, |
| 54 | notes = {}, |
| 55 | }: { |
| 56 | code: RawCode |
| 57 | notes?: Record<string, { children: React.ReactNode }> |
| 58 | }) { |
| 59 | const highlighted = await highlight(code, theme) |
| 60 | |
| 61 | highlighted.annotations = highlighted.annotations.map((a) => { |
| 62 | const note = notes[a.query] |
| 63 | if (!note) return a |
| 64 | return { |
| 65 | ...a, |
| 66 | data: { |
| 67 | ...a.data, |
| 68 | children: note.children, |
| 69 | }, |
| 70 | } |
| 71 | }) |
| 72 | |
| 73 | return <HighCode className="min-h-full" highlighted={highlighted} /> |
| 74 | } |
| 75 | |
| 76 | async function CalloutCode({ code }: { code: RawCode }) { |
| 77 | const highlighted = await highlight(code, theme) |
nothing calls this directly
no test coverage detected
searching dependent graphs…