7070--- @param start_row integer
7171--- @param start_col integer
7272--- @param opts vim.api.keyset.set_extmark
73+ --- @return boolean
7374function Handler :add (conceal , start_row , start_col , opts )
75+ -- Inline extmarks require neovim >= 0.10.0
76+ if opts .virt_text_pos == ' inline' and not util .has_10 then
77+ return false
78+ end
7479 --- @type render.md.Mark
7580 local mark = {
7681 conceal = conceal ,
@@ -80,6 +85,7 @@ function Handler:add(conceal, start_row, start_col, opts)
8085 }
8186 logger .debug (' mark' , mark )
8287 table.insert (self .marks , mark )
88+ return true
8389end
8490
8591--- @private
@@ -114,16 +120,13 @@ function Handler:heading(info)
114120 -- and concealed text is subtracted since that space is not usable
115121 local padding = level + 1 - ts .concealed (self .buf , info ) - str .width (icon )
116122 if heading .position == ' inline' or padding < 0 then
117- -- Requires inline extmarks to place when there is not enough space available
118- if util .has_10 then
119- self :add (true , info .start_row , info .start_col , {
120- end_row = info .end_row ,
121- end_col = info .end_col ,
122- virt_text = { { icon , { foreground , background } } },
123- virt_text_pos = ' inline' ,
124- conceal = ' ' ,
125- })
126- end
123+ self :add (true , info .start_row , info .start_col , {
124+ end_row = info .end_row ,
125+ end_col = info .end_col ,
126+ virt_text = { { icon , { foreground , background } } },
127+ virt_text_pos = ' inline' ,
128+ conceal = ' ' ,
129+ })
127130 else
128131 self :add (true , info .start_row , info .start_col , {
129132 end_row = info .end_row ,
@@ -202,31 +205,28 @@ function Handler:language(code_block, add_background)
202205 if add_background then
203206 table.insert (highlight , code .highlight )
204207 end
205- -- Requires inline extmarks
206- if code .position == ' left' and util .has_10 then
208+ if code .position == ' left' then
207209 local icon_text = icon .. ' '
208210 if ts .hidden (self .buf , info ) then
209211 -- Code blocks will pick up varying amounts of leading white space depending on the
210212 -- context they are in. This gets lumped into the delimiter node and as a result,
211213 -- after concealing, the extmark will be left shifted. Logic below accounts for this.
212214 icon_text = str .pad (code_block .leading_spaces , icon_text .. info .text )
213215 end
214- self :add (true , info .start_row , info .start_col , {
216+ return self :add (true , info .start_row , info .start_col , {
215217 virt_text = { { icon_text , highlight } },
216218 virt_text_pos = ' inline' ,
217219 })
218- return true
219220 elseif code .position == ' right' then
220221 local icon_text = icon .. ' ' .. info .text
221222 local win_col = code_block .longest_line
222223 if code .width == ' block' then
223224 win_col = win_col - str .width (icon_text )
224225 end
225- self :add (true , info .start_row , 0 , {
226+ return self :add (true , info .start_row , 0 , {
226227 virt_text = { { icon_text , highlight } },
227228 virt_text_win_col = win_col ,
228229 })
229- return true
230230 else
231231 return false
232232 end
285285--- @param add_background boolean
286286function Handler :code_left_pad (code_block , add_background )
287287 local code = self .config .code
288- -- Requires inline extmarks
289- if not util .has_10 or code .left_pad <= 0 then
288+ if code .left_pad <= 0 then
290289 return
291290 end
292291 local padding = str .pad (code .left_pad )
@@ -354,8 +353,14 @@ function Handler:list_marker(info)
354353 virt_text = { { str .pad (leading_spaces , icon ), bullet .highlight } },
355354 virt_text_pos = ' overlay' ,
356355 })
357- -- Requires inline extmarks
358- if util .has_10 and bullet .right_pad > 0 then
356+ if bullet .left_pad > 0 then
357+ self :add (false , info .start_row , 0 , {
358+ priority = 0 ,
359+ virt_text = { { str .pad (bullet .left_pad ), ' Normal' } },
360+ virt_text_pos = ' inline' ,
361+ })
362+ end
363+ if bullet .right_pad > 0 then
359364 self :add (true , info .start_row , info .end_col - 1 , {
360365 virt_text = { { str .pad (bullet .right_pad ), ' Normal' } },
361366 virt_text_pos = ' inline' ,
@@ -495,8 +500,7 @@ function Handler:table_row(row, highlight)
495500 virt_text_pos = ' overlay' ,
496501 })
497502 elseif cell .type == ' pipe_table_cell' then
498- -- Requires inline extmarks
499- if pipe_table .cell == ' padded' and util .has_10 then
503+ if pipe_table .cell == ' padded' then
500504 local offset = self :table_visual_offset (cell )
501505 if offset > 0 then
502506 self :add (true , cell .start_row , cell .end_col - 1 , {
0 commit comments