| 163 | } |
| 164 | |
| 165 | const splitNodesByNewline = (nodes: ReactNode[]): ReactNode[][] => { |
| 166 | const lines: ReactNode[][] = [[]] |
| 167 | nodes.forEach((node) => { |
| 168 | if (typeof node === 'string') { |
| 169 | const parts = node.split('\n') |
| 170 | parts.forEach((part, idx) => { |
| 171 | if (part.length > 0) { |
| 172 | lines[lines.length - 1].push(part) |
| 173 | } |
| 174 | if (idx < parts.length - 1) { |
| 175 | lines.push([]) |
| 176 | } |
| 177 | }) |
| 178 | } else { |
| 179 | lines[lines.length - 1].push(node) |
| 180 | } |
| 181 | }) |
| 182 | return lines |
| 183 | } |
| 184 | |
| 185 | const hasUnescapedMarker = (value: string): boolean => { |
| 186 | if (!value) { |