(text: string)
| 112 | } |
| 113 | |
| 114 | function createBracketAwareTextNodes(text: string): PhrasingContent[] { |
| 115 | const nodes: PhrasingContent[] = []; |
| 116 | const bracketPattern = /\[[^\]]+\]/g; |
| 117 | let lastIndex = 0; |
| 118 | |
| 119 | for (const match of text.matchAll(bracketPattern)) { |
| 120 | const [value] = match; |
| 121 | const start = match.index ?? 0; |
| 122 | |
| 123 | if (start > lastIndex) { |
| 124 | nodes.push({ type: "text", value: text.slice(lastIndex, start) }); |
| 125 | } |
| 126 | |
| 127 | nodes.push(createInlineCode(value)); |
| 128 | lastIndex = start + value.length; |
| 129 | } |
| 130 | |
| 131 | if (lastIndex < text.length) { |
| 132 | nodes.push({ type: "text", value: text.slice(lastIndex) }); |
| 133 | } |
| 134 | |
| 135 | if (nodes.length === 0) { |
| 136 | nodes.push({ type: "text", value: text }); |
| 137 | } |
| 138 | |
| 139 | return nodes; |
| 140 | } |
| 141 | |
| 142 | function createList(items: ListItem[]): List { |
| 143 | return { |
no test coverage detected
searching dependent graphs…