Skip to content

Commit

Permalink
fix: Fixed callouts rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
OXY2DEV committed Oct 7, 2024
1 parent be23327 commit 493c054
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
48 changes: 24 additions & 24 deletions lua/markview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ markview.configuration = {
hl = "MarkviewBlockQuoteNote",

title = true,
icon = "󱉫 ",
icon = "󱉫",

border = ""
},
Expand All @@ -142,7 +142,7 @@ markview.configuration = {
preview = "󱉫 Summary",

title = true,
icon = "󱉫 ",
icon = "󱉫",

border = ""
},
Expand All @@ -152,7 +152,7 @@ markview.configuration = {
preview = "󱉫 Tldr",

title = true,
icon = "󱉫 ",
icon = "󱉫",

border = ""
},
Expand All @@ -162,7 +162,7 @@ markview.configuration = {
preview = " Todo",

title = true,
icon = " ",
icon = "",

border = ""
},
Expand All @@ -172,7 +172,7 @@ markview.configuration = {
preview = " Info",

custom_title = true,
icon = " ",
icon = "",

border = ""
},
Expand All @@ -182,7 +182,7 @@ markview.configuration = {
preview = "󰗠 Success",

title = true,
icon = "󰗠 ",
icon = "󰗠",

border = ""
},
Expand All @@ -192,7 +192,7 @@ markview.configuration = {
preview = "󰗠 Check",

title = true,
icon = "󰗠 ",
icon = "󰗠",

border = ""
},
Expand All @@ -202,7 +202,7 @@ markview.configuration = {
preview = "󰗠 Done",

title = true,
icon = "󰗠 ",
icon = "󰗠",

border = ""
},
Expand All @@ -212,7 +212,7 @@ markview.configuration = {
preview = "󰋗 Question",

title = true,
icon = "󰋗 ",
icon = "󰋗",

border = ""
},
Expand All @@ -222,7 +222,7 @@ markview.configuration = {
preview = "󰋗 Help",

title = true,
icon = "󰋗 ",
icon = "󰋗",

border = ""
},
Expand All @@ -231,8 +231,8 @@ markview.configuration = {
hl = "MarkviewBlockQuoteWarn",
preview = "󰋗 Faq",

custom_title = true,
custom_icon = "󰋗 ",
title = true,
icon = "󰋗",

border = ""
},
Expand All @@ -242,7 +242,7 @@ markview.configuration = {
preview = "󰅙 Failure",

title = true,
icon = "󰅙 ",
icon = "󰅙",

border = ""
},
Expand All @@ -252,7 +252,7 @@ markview.configuration = {
preview = "󰅙 Fail",

title = true,
icon = "󰅙 ",
icon = "󰅙",

border = ""
},
Expand All @@ -262,7 +262,7 @@ markview.configuration = {
preview = "󰅙 Missing",

title = true,
icon = "󰅙 ",
icon = "󰅙",

border = ""
},
Expand All @@ -272,7 +272,7 @@ markview.configuration = {
preview = " Danger",

title = true,
icon = "",
icon = "",

border = ""
},
Expand All @@ -282,7 +282,7 @@ markview.configuration = {
preview = " Error",

title = true,
icon = "",
icon = "",

border = ""
},
Expand All @@ -292,7 +292,7 @@ markview.configuration = {
preview = " Bug",

title = true,
icon = "",
icon = "",

border = ""
},
Expand All @@ -302,7 +302,7 @@ markview.configuration = {
preview = "󱖫 Example",

title = true,
icon = " 󱖫 ",
icon = "󱖫",

border = ""
},
Expand All @@ -312,7 +312,7 @@ markview.configuration = {
preview = " Quote",

title = true,
icon = "",
icon = "",

border = ""
},
Expand All @@ -322,7 +322,7 @@ markview.configuration = {
preview = " Cite",

title = true,
icon = "",
icon = "",

border = ""
},
Expand All @@ -332,7 +332,7 @@ markview.configuration = {
preview = " Hint",

title = true,
icon = "",
icon = "",

border = ""
},
Expand All @@ -342,7 +342,7 @@ markview.configuration = {
preview = " Attention",

title = true,
icon = "",
icon = "",

border = ""
},
Expand Down Expand Up @@ -392,7 +392,7 @@ markview.configuration = {
preview = "󰠳 Custom",

custom_title = true,
custom_icon = " 󰠳 ",
custom_icon = "󰠳",

border = ""
}
Expand Down
8 changes: 4 additions & 4 deletions lua/markview/parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -842,15 +842,15 @@ parser.md_inline = function (buffer, TStree, from, to)
col_start = col_start,
col_end = col_end,
});
elseif before:match("%>$") then
local title = string.match(line or "", "%b[](.*)$")
elseif before:match("%> ?$") then
local title = string.match(line or "", "%](.*)$")

for _, extmark in ipairs(parser.parsed_content) do
if extmark.type == "block_quote"
and extmark.row_start == row_start
and extmark.col_start == col_start - 1
and extmark.col_start == col_start - before:match("(%> ?)$"):len()
then
extmark.callout = string.match(capture_text, "%[!([^%]]+)%]");
extmark.callout = string.match(capture_text, "%[!(.-)%]");
extmark.title = title;

extmark.line_width = vim.fn.strchars(line);
Expand Down
2 changes: 1 addition & 1 deletion lua/markview/renderer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1569,7 +1569,7 @@ renderer.render_block_quotes = function (buffer, content, config_table)
{ qt_config.icon or qt_config.custom_icon, list_clamp(qt_config.preview_hl or qt_config.callout_preview_hl or qt_config.hl, 1) },
},

end_col = content.col_start + vim.fn.strdisplaywidth(">[!" .. content.callout .. "]" .. (content.title:match("^(%s)") or "")),
end_col = content.col_start + vim.fn.strdisplaywidth(">[!" .. content.callout .. "]"),
conceal = ""
});

Expand Down

0 comments on commit 493c054

Please sign in to comment.