Skip to content

fix: Preserve Markdown inline boundary spaces - #79

Merged
EmilStenstrom merged 1 commit into
mainfrom
agent/fix-markdown-inline-whitespace
Aug 6, 2026
Merged

fix: Preserve Markdown inline boundary spaces#79
EmilStenstrom merged 1 commit into
mainfrom
agent/fix-markdown-inline-whitespace

Conversation

@EmilStenstrom

Copy link
Copy Markdown
Owner

Summary

Preserve collapsed whitespace that appears just inside a, b, strong, em, and i elements when serializing to Markdown. This reimplements the behavior reported in #78 against the current Markdown builder.

The fix records leading and trailing collapsed whitespace in child builders and feeds it back through the parent builder's ordinary whitespace handling. It also avoids duplicate spaces after heading and list markers.

Inline child builders inherit the active blockquote depth, so formatting and link elements cannot reset the existing bound on deeply nested blockquote prefixes.

User impact

Rich-text HTML such as <p>This is <b>very </b>important.</p> now serializes as This is **very** important. instead of joining the surrounding words. Equivalent link and emphasis boundaries behave consistently.

Validation

  • pre-commit run --all-files
  • 100% test coverage
  • parser differential at 100%
  • focused Markdown and DOM test suite

@EmilStenstrom
EmilStenstrom marked this pull request as ready for review August 6, 2026 23:10
@EmilStenstrom
EmilStenstrom merged commit 00c697a into main Aug 6, 2026
3 checks passed
@EmilStenstrom
EmilStenstrom deleted the agent/fix-markdown-inline-whitespace branch August 6, 2026 23:10
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