✨ feat(mq-lang): add squeeze_whitespace - #2437
Merged
Merged
Conversation
harehare
added this pull request to stack #2438
September 24, 2026 05:16
Merging this PR will not alter performance
Comparing Footnotes
|
harehare
force-pushed
the
feat/squeeze-whitespace
branch
from
September 24, 2026 05:55
0fa6e1d to
1aca49d
Compare
Joining or re-flowing text from multiple sources commonly leaves runs of extra spaces/tabs/newlines behind, with no single builtin to clean that up. Adds squeeze_whitespace(s), collapsing whitespace runs to one space and trimming the ends. String-only (mirrors normalize_newlines' own convention): gsub/trim on a markdown node only behave correctly for leaf nodes (text, code, ...) — on a container node (heading, paragraph, ...) they flatten it to its rendered source text instead, which isn't something this function should paper over.
harehare
force-pushed
the
feat/squeeze-whitespace
branch
from
September 24, 2026 07:45
1aca49d to
ff0fde8
Compare
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.
Summary
Joining or re-flowing text from multiple sources commonly leaves runs of extra spaces/tabs/newlines behind, with no single builtin to clean that up. Adds squeeze_whitespace(s), collapsing whitespace runs to one space and trimming the ends. String-only (mirrors normalize_newlines' own convention): gsub/trim on a markdown node only behave correctly for leaf nodes (text, code, ...) — on a container node (heading, paragraph, ...) they flatten it to its rendered source text instead, which isn't something this function should paper over.
Type of Change
Checklist
cargo fmtandcargo clippyand addressed any warningsjust test-alland all tests pass/docs, crateREADME.md) if neededAdditional Context