Skip to content

Commit 493c054

Browse files
committed
fix: Fixed callouts rendering
1 parent be23327 commit 493c054

File tree

3 files changed

+29
-29
lines changed

3 files changed

+29
-29
lines changed

lua/markview.lua

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ markview.configuration = {
132132
hl = "MarkviewBlockQuoteNote",
133133

134134
title = true,
135-
icon = "󱉫 ",
135+
icon = "󱉫",
136136

137137
border = ""
138138
},
@@ -142,7 +142,7 @@ markview.configuration = {
142142
preview = "󱉫 Summary",
143143

144144
title = true,
145-
icon = "󱉫 ",
145+
icon = "󱉫",
146146

147147
border = ""
148148
},
@@ -152,7 +152,7 @@ markview.configuration = {
152152
preview = "󱉫 Tldr",
153153

154154
title = true,
155-
icon = "󱉫 ",
155+
icon = "󱉫",
156156

157157
border = ""
158158
},
@@ -162,7 +162,7 @@ markview.configuration = {
162162
preview = " Todo",
163163

164164
title = true,
165-
icon = " ",
165+
icon = "",
166166

167167
border = ""
168168
},
@@ -172,7 +172,7 @@ markview.configuration = {
172172
preview = " Info",
173173

174174
custom_title = true,
175-
icon = " ",
175+
icon = "",
176176

177177
border = ""
178178
},
@@ -182,7 +182,7 @@ markview.configuration = {
182182
preview = "󰗠 Success",
183183

184184
title = true,
185-
icon = "󰗠 ",
185+
icon = "󰗠",
186186

187187
border = ""
188188
},
@@ -192,7 +192,7 @@ markview.configuration = {
192192
preview = "󰗠 Check",
193193

194194
title = true,
195-
icon = "󰗠 ",
195+
icon = "󰗠",
196196

197197
border = ""
198198
},
@@ -202,7 +202,7 @@ markview.configuration = {
202202
preview = "󰗠 Done",
203203

204204
title = true,
205-
icon = "󰗠 ",
205+
icon = "󰗠",
206206

207207
border = ""
208208
},
@@ -212,7 +212,7 @@ markview.configuration = {
212212
preview = "󰋗 Question",
213213

214214
title = true,
215-
icon = "󰋗 ",
215+
icon = "󰋗",
216216

217217
border = ""
218218
},
@@ -222,7 +222,7 @@ markview.configuration = {
222222
preview = "󰋗 Help",
223223

224224
title = true,
225-
icon = "󰋗 ",
225+
icon = "󰋗",
226226

227227
border = ""
228228
},
@@ -231,8 +231,8 @@ markview.configuration = {
231231
hl = "MarkviewBlockQuoteWarn",
232232
preview = "󰋗 Faq",
233233

234-
custom_title = true,
235-
custom_icon = "󰋗 ",
234+
title = true,
235+
icon = "󰋗",
236236

237237
border = ""
238238
},
@@ -242,7 +242,7 @@ markview.configuration = {
242242
preview = "󰅙 Failure",
243243

244244
title = true,
245-
icon = "󰅙 ",
245+
icon = "󰅙",
246246

247247
border = ""
248248
},
@@ -252,7 +252,7 @@ markview.configuration = {
252252
preview = "󰅙 Fail",
253253

254254
title = true,
255-
icon = "󰅙 ",
255+
icon = "󰅙",
256256

257257
border = ""
258258
},
@@ -262,7 +262,7 @@ markview.configuration = {
262262
preview = "󰅙 Missing",
263263

264264
title = true,
265-
icon = "󰅙 ",
265+
icon = "󰅙",
266266

267267
border = ""
268268
},
@@ -272,7 +272,7 @@ markview.configuration = {
272272
preview = " Danger",
273273

274274
title = true,
275-
icon = "",
275+
icon = "",
276276

277277
border = ""
278278
},
@@ -282,7 +282,7 @@ markview.configuration = {
282282
preview = " Error",
283283

284284
title = true,
285-
icon = "",
285+
icon = "",
286286

287287
border = ""
288288
},
@@ -292,7 +292,7 @@ markview.configuration = {
292292
preview = " Bug",
293293

294294
title = true,
295-
icon = "",
295+
icon = "",
296296

297297
border = ""
298298
},
@@ -302,7 +302,7 @@ markview.configuration = {
302302
preview = "󱖫 Example",
303303

304304
title = true,
305-
icon = " 󱖫 ",
305+
icon = "󱖫",
306306

307307
border = ""
308308
},
@@ -312,7 +312,7 @@ markview.configuration = {
312312
preview = " Quote",
313313

314314
title = true,
315-
icon = "",
315+
icon = "",
316316

317317
border = ""
318318
},
@@ -322,7 +322,7 @@ markview.configuration = {
322322
preview = " Cite",
323323

324324
title = true,
325-
icon = "",
325+
icon = "",
326326

327327
border = ""
328328
},
@@ -332,7 +332,7 @@ markview.configuration = {
332332
preview = " Hint",
333333

334334
title = true,
335-
icon = "",
335+
icon = "",
336336

337337
border = ""
338338
},
@@ -342,7 +342,7 @@ markview.configuration = {
342342
preview = " Attention",
343343

344344
title = true,
345-
icon = "",
345+
icon = "",
346346

347347
border = ""
348348
},
@@ -392,7 +392,7 @@ markview.configuration = {
392392
preview = "󰠳 Custom",
393393

394394
custom_title = true,
395-
custom_icon = " 󰠳 ",
395+
custom_icon = "󰠳",
396396

397397
border = ""
398398
}

lua/markview/parser.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -842,15 +842,15 @@ parser.md_inline = function (buffer, TStree, from, to)
842842
col_start = col_start,
843843
col_end = col_end,
844844
});
845-
elseif before:match("%>$") then
846-
local title = string.match(line or "", "%b[](.*)$")
845+
elseif before:match("%> ?$") then
846+
local title = string.match(line or "", "%](.*)$")
847847

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

856856
extmark.line_width = vim.fn.strchars(line);

lua/markview/renderer.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1569,7 +1569,7 @@ renderer.render_block_quotes = function (buffer, content, config_table)
15691569
{ 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) },
15701570
},
15711571

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

0 commit comments

Comments
 (0)