Keep numbered lists counting across nested items and blank lines
A list ended at the first line that was not an item, so a numbered list with nested bullets, wrapped lines or blank lines between items became one-item lists that each showed 1. Lists now nest (an item holds the blocks indented under it), continue across blank lines, join wrapped lines, and number from their first item. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -83,7 +83,11 @@ class _SpeechBuilder {
|
||||
_part = part;
|
||||
_markdown = markdown;
|
||||
_cursor = 0;
|
||||
for (final block in chatMarkdownCache.blocksFor(markdown)) {
|
||||
_blocks(chatMarkdownCache.blocksFor(markdown));
|
||||
}
|
||||
|
||||
void _blocks(List<MarkdownBlock> blocks) {
|
||||
for (final block in blocks) {
|
||||
switch (block) {
|
||||
case MarkdownHeading(text: final text):
|
||||
_visible(text);
|
||||
@@ -92,7 +96,10 @@ class _SpeechBuilder {
|
||||
case MarkdownQuote(lines: final lines):
|
||||
lines.where((line) => line.trim().isNotEmpty).forEach(_visible);
|
||||
case MarkdownList(items: final items):
|
||||
items.forEach(_visible);
|
||||
for (final item in items) {
|
||||
_visible(item.text);
|
||||
_blocks(item.children);
|
||||
}
|
||||
case MarkdownTable(header: final header, rows: final rows):
|
||||
_phrase('Table.', _cursor);
|
||||
[...header, ...rows.expand((row) => row)].forEach(_visible);
|
||||
|
||||
Reference in New Issue
Block a user