Skip to content

Apply adjacent-inline separator on all inline buffers in HtmlToDjot#206

Merged
dereuromark merged 1 commit into
masterfrom
fix/htmltodjot-adjacent-inline-buffers
Jun 2, 2026
Merged

Apply adjacent-inline separator on all inline buffers in HtmlToDjot#206
dereuromark merged 1 commit into
masterfrom
fix/htmltodjot-adjacent-inline-buffers

Conversation

@dereuromark
Copy link
Copy Markdown
Contributor

Follow-up to #205, which fixed adjacent same-delimiter inline runs but only on the processChildren() path.

Problem

The separator in #205 covered paragraphs, but two other code paths buffer inline output by hand and so still produced the malformed token:

<em>a</em><em>b</em>                       ->  _a__b_     ->  <em>a_</em>b_     (processBlock buffer)
<ul><li><em>a</em><em>b</em></li></ul>     ->  - _a__b_   ->  <em>a_</em>b_     (processList buffer)

(Paragraph-wrapped input was already correct after #205.)

Fix

Extract the inline join into a shared appendInline() helper that inserts the {} separator when two pieces would merge a same-delimiter run, and use it on all three concatenation paths: processChildren(), the processBlock() inline buffer, and the processList() list-item buffer. Table cells already delegate to those, so they are covered too.

The property test gains bare-top-level and list-item adjacency cases across em, strong, sub, sup and code, asserting (whitespace-normalized) that the two runs stay separate regardless of the surrounding block.

The same-delimiter separator added in #205 only ran through
processChildren(), so it covered paragraphs but not the two other places
that buffer inline output by hand: processBlock() (bare top-level inline)
and processList() (list-item content). There `<em>a</em><em>b</em>`
still serialized to `_a__b_` and round-tripped to `<em>a_</em>b_`.

Extract the join into a shared appendInline() helper and use it on all
three concatenation paths, so adjacency is handled the same everywhere.

Extend the property test with bare and list contexts across em, strong,
sub, sup and code.
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.82%. Comparing base (a2aa1bb) to head (360b1c5).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #206      +/-   ##
============================================
+ Coverage     91.79%   91.82%   +0.03%     
- Complexity     3457     3458       +1     
============================================
  Files           104      104              
  Lines          9798     9799       +1     
============================================
+ Hits           8994     8998       +4     
+ Misses          804      801       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dereuromark dereuromark marked this pull request as ready for review June 2, 2026 18:11
@dereuromark dereuromark merged commit a46d0a6 into master Jun 2, 2026
6 checks passed
@dereuromark dereuromark deleted the fix/htmltodjot-adjacent-inline-buffers branch June 2, 2026 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant