From 9267c3b3621fd0b6b872b83732792f58bca7827b Mon Sep 17 00:00:00 2001 From: Mark Scherer Date: Sat, 18 Jul 2026 17:32:30 +0200 Subject: [PATCH] Keep tight list items unwrapped when source lines are enabled The tight-list renderer strips a plain paragraph wrapper from item content, but a paragraph stamped with data-source-line no longer matched the pattern, so enabling sourceLines grew

wrappers inside tight items - a structure change the opt-in attribute-only option must never cause. Strip anchor-only wrappers the same way (the li keeps its own anchor, matching carve-js and carve-rs) and lock the contract with a byte-identity regression test. --- src/Renderer/HtmlRenderer.php | 4 +++- tests/TestCase/SourceLineTrackingTest.php | 23 ++++++++++++++++++----- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/Renderer/HtmlRenderer.php b/src/Renderer/HtmlRenderer.php index 3eea16d..7df6ba6 100644 --- a/src/Renderer/HtmlRenderer.php +++ b/src/Renderer/HtmlRenderer.php @@ -768,7 +768,9 @@ protected function renderListItem(ListItem $node, bool $tight = true): string // This handles both: // 1. Single paragraph:

text

-> text // 2. Paragraph followed by nested list:

text

\n