From 259f0d856353a1aeac23800820b4af23309595b7 Mon Sep 17 00:00:00 2001 From: Jonas Holst Damtoft Date: Mon, 1 May 2023 21:56:41 +0200 Subject: [PATCH] fix(html): add additional html entities Aligns with https://github.com/neovim/neovim/blob/26cc946226d96bf6b474d850b961e1060346c96f/runtime/lua/vim/lsp/util.lua#L1382 Fixes #447 --- lua/noice/text/markdown.lua | 2 +- tests/text/markdown_spec.lua | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lua/noice/text/markdown.lua b/lua/noice/text/markdown.lua index 132755ad..aa8293b9 100644 --- a/lua/noice/text/markdown.lua +++ b/lua/noice/text/markdown.lua @@ -26,7 +26,7 @@ end ---@param text string function M.html_entities(text) - local entities = { nbsp = "", lt = "<", gt = ">", amp = "&", quot = '"' } + local entities = { nbsp = "", lt = "<", gt = ">", amp = "&", quot = '"', apos = "'", ensp = " ", emsp = " " } for entity, char in pairs(entities) do text = text:gsub("&" .. entity .. ";", char) end diff --git a/tests/text/markdown_spec.lua b/tests/text/markdown_spec.lua index 409808ca..3cae523e 100644 --- a/tests/text/markdown_spec.lua +++ b/tests/text/markdown_spec.lua @@ -172,5 +172,14 @@ local b { code = { "local b" }, lang = "text" }, }, }, + { + input = [[ + +  foo bar + ]], + output = { + { line = " foo bar" }, + }, + }, } M.test()