Skip to content

Preserve multiple spaces on plain text paste#1041

Open
zoltanhosszu wants to merge 1 commit into
mainfrom
keep-pasted-spaces
Open

Preserve multiple spaces on plain text paste#1041
zoltanhosszu wants to merge 1 commit into
mainfrom
keep-pasted-spaces

Conversation

@zoltanhosszu
Copy link
Copy Markdown
Contributor

@zoltanhosszu zoltanhosszu commented May 6, 2026

Plain-text paste collapsed runs of consecutive spaces, breaking ASCII tables and other space-aligned content. The collapse comes from HTML/Lexical whitespace normalization. This patch substitutes runs of 2+ spaces with a regular space + &nbsps before Marked sees them, so the spacing survives the round trip while single spaces (and code-block paste) are untouched.

Example table

+--------+--------+--------+
| Name   | Score  | Level  |
+--------+--------+--------+
| Alice  |   87   |   3    |
| Bob    |   42   |   7    |
| Clara  |   65   |   5    |
+--------+--------+--------+

Expectation

image

Turned into codeblock:
image

Reality

image

Turned into codeblock:
image

Copilot AI review requested due to automatic review settings May 6, 2026 15:42
@zoltanhosszu zoltanhosszu requested a review from samuelpecher May 11, 2026 07:43
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