Repository navigation
Add markdown healing via remend at segment boundaries - #2
Merged
Merged
Conversation
Implements spec §2.3 — text segments are healed with remend before interpolation, closing unclosed bold, italic, strikethrough, code spans, links, images, and math at component and exec block boundaries. - src/heal.ts: healSegment wrapper (htmlTags: false, trailing-space restore) - src/expand.ts: healing integrated into expandSegments text branch - src/heal.test.ts: 28 Tier F tests (F1–F28) covering all spec scenarios - specs/executable-mdx-spec.md: updated with §2.3, Tier F, decisions 22–24
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
When the boundary scanner splits a document at component or exec block boundaries, it can produce text segments with unclosed markdown constructs. For example:
The scanner produces two text segments:
Hello **world\n(unclosed bold) and\nmore text. Without healing, the unclosed**bleeds into the component expansion output, corrupting the rendered markdown. Components and exec blocks are semantic boundaries — markdown constructs (emphasis, links, code spans, math) cannot span them. Each text segment must be valid markdown independently.Summary
remendpackage to close unclosed markdown constructs (bold, italic, strikethrough, code spans, links, images, math) at segment boundarieshealSegmentwrapper that runs after the boundary scanner and before interpolation, preserving trailing whitespace thatremendwould otherwise striphtmlTags: falsebehavior, orphaned closers, nested constructs, no-op cases, interpolation interaction, Content slot interaction, and math blocksChanges
src/heal.tshealSegmentwrapper —remend(text, { htmlTags: false })with trailing-space preservationsrc/expand.tsexpandSegmentstext branch: heal → interpolatesrc/heal.test.tsmod.tshealSegmentspecs/executable-mdx-spec.mdpackage.jsonremenddependencyTest Results
All 115 tests pass (87 pre-existing + 28 new Tier F).