()
| 134 | } |
| 135 | |
| 136 | parseCallout(): TaggedCallout { |
| 137 | const typeMatch = this.readUntil('\n') |
| 138 | .trim() |
| 139 | .match(/^(info|warning|error)\s*(.*)$/); |
| 140 | if (!typeMatch) { |
| 141 | throw new Error('Invalid callout type'); |
| 142 | } |
| 143 | const type = typeMatch[1] as 'info' | 'warning' | 'error'; |
| 144 | const labelText = typeMatch[2]; |
| 145 | const labelParsed = parseSpan(labelText); |
| 146 | const contentLines: string[] = []; |
| 147 | while (!this.atEnd()) { |
| 148 | const lineStartPos = this.pos; |
| 149 | if (this.match(':::')) { |
| 150 | if (this.peek() === '\n') this.consume(); |
| 151 | break; |
| 152 | } else { |
| 153 | this.pos = lineStartPos; |
| 154 | } |
| 155 | const line = this.readUntil('\n'); |
| 156 | contentLines.push(line); |
| 157 | if (!this.atEnd()) this.consume(); // Consume the newline |
| 158 | } |
| 159 | const contentString = contentLines.join('\n'); |
| 160 | const nestedParser = new MarkdownParser(contentString); |
| 161 | const contentBlocks = nestedParser.parseBlocks(); |
| 162 | return { |
| 163 | tag: 'callout', |
| 164 | type, |
| 165 | label: labelParsed, |
| 166 | content: contentBlocks, |
| 167 | }; |
| 168 | } |
| 169 | |
| 170 | parseList(): TaggedList { |
| 171 | const items: TaggedText[][] = []; |
no test coverage detected