-
Notifications
You must be signed in to change notification settings - Fork 114
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
bug: html tag not removed in treesitter lsp markdown hover #424
Comments
It seems like something like this could work for the escape character: diff --git a/lua/noice/text/markdown.lua b/lua/noice/text/markdown.lua
index cef6b13..bb84214 100644
--- a/lua/noice/text/markdown.lua
+++ b/lua/noice/text/markdown.lua
@@ -63,7 +63,7 @@ end
function M.parse(text, opts)
opts = opts or {}
---@type string
- text = text:gsub("</?pre>", "```"):gsub("\r", "")
+ text = text:gsub("</?pre>", "```"):gsub("\r", ""):gsub("(\\)(%p)", "%2")
text = M.html_entities(text)
---@type Markdown However, I am not too sure about how we should deal with the |
@folke that won't work correctly, because now the links will not be concealed properly: |
Something like this seems to work good: diff --git a/lua/noice/text/markdown.lua b/lua/noice/text/markdown.lua
index b14a2c0..1078679 100644
--- a/lua/noice/text/markdown.lua
+++ b/lua/noice/text/markdown.lua
@@ -64,7 +64,7 @@ end
function M.parse(text, opts)
opts = opts or {}
---@type string
- text = text:gsub("</?pre>", "```"):gsub("\r", ""):gsub("</?code>", "`")
+ text = text:gsub("</?pre>", "```"):gsub("\r", ""):gsub("</?code>", ""):gsub("(\\)(%p)", "%2")
text = M.html_entities(text)
---@type Markdown |
I've reverted my changes. This should be fixed in the treesitter markdown parser. |
Your suggested changes may work for rust, but will very likley break a lot of other markdown code |
I don't think it will very likely break a lot of other markdown code. This fix has been suggested to upstream as well: neovim/neovim#13803 It looks like the reason they didn't go this route is because they wanted users to have more general control over syntax rules: neovim/neovim#14073 I agree with mjlbach on this: And by replacing |
Did you check docs and existing issues?
Neovim version (nvim -v)
0.9.0-dev-1324+ge30cc8be1
Operating system/version
MacOs 13.1
Describe the bug
It doesn't properly remove all html tags for the markdown render of lsp docs
Neovim:
VsCode:
Note the
<code>Option\<String\></code>
in the neovim popup. I would expect something like in vscode where the tags are not includedSteps To Reproduce
Use this Rust file:
Try to hover the docs on
map
and notice the tags being thereExpected Behavior
I would expect something like this where the `
is gone:
Note I just
set modifiable
and removed the tags to make it look like it ideally should.Repro
The text was updated successfully, but these errors were encountered: