(heading: Heading, state: RenderState)
| 590 | } |
| 591 | |
| 592 | const renderHeading = (heading: Heading, state: RenderState): ReactNode[] => { |
| 593 | const { palette, nextKey } = state |
| 594 | const depth = Math.max(1, Math.min(heading.depth, 6)) |
| 595 | const color = palette.headingFg[depth] ?? palette.headingFg[6] |
| 596 | const childNodes = renderNodes( |
| 597 | heading.children as MarkdownNode[], |
| 598 | state, |
| 599 | heading.type, |
| 600 | ) |
| 601 | |
| 602 | return [ |
| 603 | <span key={nextKey()} fg={color} attributes={TextAttributes.BOLD}> |
| 604 | {childNodes.map((segment, idx) => ( |
| 605 | <KeyedFragment key={nextKey() + '-' + idx}>{segment}</KeyedFragment> |
| 606 | ))} |
| 607 | </span>, |
| 608 | '\n\n', |
| 609 | ] |
| 610 | } |
| 611 | |
| 612 | const renderInlineCode = ( |
| 613 | inlineCode: InlineCode, |
no test coverage detected