Summary
The markdown parser incorrectly handles multi-line quote blocks that contain empty continuation lines (> without content).
Steps to Reproduce
Import a markdown file with this content:
> **First line of quote**
>
> **Second line of quote**
> **Third line of quote**
Expected Result
One quote-block node containing all lines:
> **First line of quote**
>
> **Second line of quote**
> **Third line of quote**
Actual Result
Three separate nodes:
quote-block: > **First line of quote**
text: >
text: (remaining content, not as quote-block)
Example in Production
See node bdeb3a1b-7a93-425a-b724-a45e850fb16c (NodeSpace Testing Guide):
Original file (docs/architecture/development/testing-guide.md):
> **✅ AUTHORITATIVE DOCUMENT**: This is the single source of truth...
>
> **Status**: Active (Updated 2025-01-16)
> **Scope**: Covers actual implementation approach...
Parsed children (first 3):
- Index 0:
quote-block - only first line
- Index 1:
text - just >
- Index 2:
text - should be part of quote
Root Cause
In packages/core/src/mcp/handlers/markdown.rs (lines 252-259):
} else if content_line.starts_with("> ") {
// Quote block
let mut quote_lines = vec![content_line];
while i + 1 < lines.len() && lines[i + 1].trim_start().starts_with("> ") {
i += 1;
quote_lines.push(lines[i].trim_start());
}
("quote-block", quote_lines.join("\n"), None, true, None)
}
Bug: The check starts_with("> ") requires a space after >. Empty quote continuation lines are just > (no space), so they don't match and the loop exits.
Fix
The condition should also match > alone (empty quote continuation):
while i + 1 < lines.len() {
let next_trimmed = lines[i + 1].trim_start();
if next_trimmed.starts_with("> ") || next_trimmed == ">" {
i += 1;
quote_lines.push(next_trimmed);
} else {
break;
}
}
Acceptance Criteria
Summary
The markdown parser incorrectly handles multi-line quote blocks that contain empty continuation lines (
>without content).Steps to Reproduce
Import a markdown file with this content:
Expected Result
One
quote-blocknode containing all lines:Actual Result
Three separate nodes:
quote-block:> **First line of quote**text:>text: (remaining content, not as quote-block)Example in Production
See node
bdeb3a1b-7a93-425a-b724-a45e850fb16c(NodeSpace Testing Guide):Original file (
docs/architecture/development/testing-guide.md):Parsed children (first 3):
quote-block- only first linetext- just>text- should be part of quoteRoot Cause
In
packages/core/src/mcp/handlers/markdown.rs(lines 252-259):Bug: The check
starts_with("> ")requires a space after>. Empty quote continuation lines are just>(no space), so they don't match and the loop exits.Fix
The condition should also match
>alone (empty quote continuation):Acceptance Criteria
>) are parsed as singlequote-block>prefixes correctly (for rendering)