Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unescape non-breaking spaces #514

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions autoload/lsp/markdown.vim
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ def Unescape(text: string, block_marker: string = ""): string
result = result->substitute(' \@<! \=\n', ' ', 'g')
# change hard line breaks
result = result->substitute(' \{2,}\n', '\n', 'g')
# replace non-breaking spaces with spaces
result = result->substitute('&nbsp;', ' ', 'g')
return result->substitute($'\\\({punctuation}\)', '\1', 'g')
enddef

Expand Down
17 changes: 16 additions & 1 deletion test/markdown_tests.vim
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,22 @@ def g:Test_Markdown()
[],
[{'col': 13, 'type': 'LspMarkdownCode', 'length': 15}]
]
]
],
[
# non-breaking space characters
# Input text
[
'&nbsp;&nbsp;This is text.',
],
# Expected text
[
' This is text.',
],
# Expected text properties
[
[]
]
],
]

var doc: dict<list<any>>
Expand Down