(props: unknown)
| 16 | }) |
| 17 | |
| 18 | export async function CodeWithNotes(props: unknown) { |
| 19 | const { code, notes = [] } = parseProps(props, ContentSchema) |
| 20 | const highlighted = await highlight(code, theme) |
| 21 | |
| 22 | // find matches between annotations and notes |
| 23 | // and add the note as data to the annotation |
| 24 | highlighted.annotations = await Promise.all( |
| 25 | highlighted.annotations.map(async (a) => { |
| 26 | const note = notes.find((n) => a.query && n.title === a.query) |
| 27 | if (!note) return a |
| 28 | |
| 29 | let children = note.children |
| 30 | if (note.code) { |
| 31 | const highlighted = await highlight(note.code, theme) |
| 32 | children = ( |
| 33 | <HighCode highlighted={highlighted} className="border-none my-0" /> |
| 34 | ) |
| 35 | } |
| 36 | |
| 37 | return { |
| 38 | ...a, |
| 39 | data: { |
| 40 | ...a.data, |
| 41 | children, |
| 42 | }, |
| 43 | } |
| 44 | }), |
| 45 | ) |
| 46 | |
| 47 | return <HighCode highlighted={highlighted} /> |
| 48 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…