feat(reflow): add atomic_spans configuration and refactor inline wrapping#742
Merged
rvben merged 6 commits intoJul 19, 2026
Conversation
…s-spans" This reverts commit c0f492b.
This reverts commit eef23bb.
This reverts commit 2e8bded.
…ping
Introduce `atomic_spans` configuration (defaulting to true) to MD013
to control whether inline formatting spans (emphasis, strong, strikethrough,
and code spans) are treated as atomic units or allowed to wrap at whitespace.
Refactor wrapping and sentence-splitting logic with extensive optimizations:
- Add safety guards in eligibility checks to prevent wrapping inside spans
that contain nested format markers (`*`, `_`, `~`, `` ` ``), preventing syntax
corruption.
- Prevent wrapping from starting a line with definition lists (`:`), Pandoc
divs (`:::`), or table rows (`|`) to avoid accidental block construct triggers.
- Optimize sentence boundary checks from O(N^2) to O(1) by passing pre-computed
byte offsets, resolving performance scaling bottlenecks.
- Eliminate paragraph-sized `Vec<bool>` mask allocations for inline code spans by
maintaining sorted code span indexes inline.
- Implement allocation-free `Element::display_len` to avoid string formatting
just to measure visual lengths, and defer `format!("{element}")` calls to the
final emission.
- Optimize config budget calculation in `min_effective_line_length` using stack-
allocated arrays instead of vectors.
- Single-pass character collection in the sentence splitter.
Assisted-by: Antigravity with Gemini
chandlerc
deleted the
featreflow-add-atomicspans-configuration/zovxzmvkpnzv
branch
July 20, 2026 08:21
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.
Introduce
atomic_spansconfiguration (defaulting to true) to MD013to control whether inline formatting spans (emphasis, strong, strikethrough,
and code spans) are treated as atomic units or allowed to wrap at whitespace.
Refactor wrapping and sentence-splitting logic with extensive optimizations:
that contain nested format markers (
*,_,~, ```), preventing syntaxcorruption.
:), Pandocdivs (
:::), or table rows (|) to avoid accidental block construct triggers.byte offsets, resolving performance scaling bottlenecks.
Vec<bool>mask allocations for inline code spans bymaintaining sorted code span indexes inline.
Element::display_lento avoid string formattingjust to measure visual lengths, and defer
format!("{element}")calls to thefinal emission.
min_effective_line_lengthusing stack-allocated arrays instead of vectors.
Reverts the three
emphasis_spanscommits that this replaces.Assisted-by: Antigravity with Gemini