Skip to content

Commit

Permalink
fix: Fixed escaling of characters
Browse files Browse the repository at this point in the history
This fixes width calculation issues of escaped characters inside of $$.

Ref: #177
  • Loading branch information
OXY2DEV committed Nov 6, 2024
1 parent e7f9de4 commit a94abd8
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions lua/markview/renderers/markdown.lua
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,17 @@ markdown.output = function (str)
local esc = config("escapes");
local ent = config("entities");

for escaped in str:gmatch("\\(%$)") do
if not esc then
break;
end

str = str:gsub(concat({
"\\",
escaped
}), " ");
end

for latex in str:gmatch("%$([^%$]*)%$") do
---+${custom, Handle LaTeX blocks}
str = str:gsub(concat({
Expand All @@ -108,9 +119,7 @@ markdown.output = function (str)
str = str:gsub(concat({
"\\",
escaped
}), concat({
escaped
}));
}), " ");
end

for inline_code in str:gmatch("`(.-)`") do
Expand Down

0 comments on commit a94abd8

Please sign in to comment.