File tree Expand file tree Collapse file tree 5 files changed +15
-9
lines changed Expand file tree Collapse file tree 5 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ local state = require('render-markdown.state')
55local M = {}
66
77--- @private
8- M .version = ' 8.0.17 '
8+ M .version = ' 8.0.18 '
99
1010function M .check ()
1111 M .start (' version' )
Original file line number Diff line number Diff line change @@ -15,6 +15,10 @@ local M = {}
1515--- @field public extends ? boolean
1616--- @field public parse fun (ctx : render.md.HandlerContext ): render.md.Mark[]
1717
18+ --- @class render.md.Text
19+ --- @field [ 1] string text
20+ --- @field [ 2] string | string[] highlights
21+
1822--- @class (exact ) render.md.CallbackContext
1923--- @field public buf integer
2024
@@ -88,7 +92,7 @@ local M = {}
8892
8993--- @class (exact ) render.md.UserWikiLink
9094--- @field public icon ? string
91- --- @field public body ? fun ( ctx : render.md.LinkContext ): string ?
95+ --- @field public body ? fun ( ctx : render.md.LinkContext ): render.md.Text | string ?
9296--- @field public highlight ? string
9397
9498--- @class (exact ) render.md.UserFootnote
Original file line number Diff line number Diff line change @@ -2,11 +2,7 @@ local Iter = require('render-markdown.lib.iter')
22local Str = require (' render-markdown.lib.str' )
33local colors = require (' render-markdown.colors' )
44
5- --- @class render.md.line.Text
6- --- @field [ 1] string text
7- --- @field [ 2] string | string[] highlights
8-
9- --- @alias render.md.Line render.md.line.Text[]
5+ --- @alias render.md.Line render.md.Text[]
106
117--- @class render.md.Renderer
128--- @field protected marks render.md.Marks
Original file line number Diff line number Diff line change @@ -127,9 +127,15 @@ function Render:wiki_link()
127127 self :hide (ctx .start_col + 2 , # ctx .destination + 1 )
128128 end
129129 else
130+ local line = {}
131+ if type (body ) == ' string' then
132+ table.insert (line , { icon .. body , highlight })
133+ else
134+ table.insert (line , { icon .. body [1 ], body [2 ] })
135+ end
130136 -- Inline icon & body, hide original text
131137 self .marks :add_over (' link' , self .node , {
132- virt_text = { { icon .. body , highlight } } ,
138+ virt_text = line ,
133139 virt_text_pos = ' inline' ,
134140 conceal = ' ' ,
135141 }, { 0 , 1 , 0 , - 1 })
Original file line number Diff line number Diff line change 5454
5555--- @class (exact ) render.md.WikiLink
5656--- @field public icon string
57- --- @field public body fun (ctx : render.md.LinkContext ): string ?
57+ --- @field public body fun (ctx : render.md.LinkContext ): render.md.Text | string ?
5858--- @field public highlight string
5959
6060--- @class (exact ) render.md.Footnote
You can’t perform that action at this time.
0 commit comments