@@ -77,6 +77,133 @@ asciidoc.admonition = function (buffer, item)
7777 --- | fE
7878end
7979
80+ --- @param buffer integer
81+ --- @param item markview.parsed.asciidoc.admonition_blocks
82+ asciidoc .admonition_block = function (buffer , item )
83+ --- | fS
84+
85+ --- @type markview.config.asciidoc.delimited_blocks ?
86+ local config = spec .get ({ " asciidoc" , " delimited_blocks" }, { fallback = nil });
87+
88+ if not config then
89+ return ;
90+ end
91+
92+ --- @type markview.config.asciidoc.admonitions ?
93+ local admonition_config = spec .get ({ " asciidoc" , " admonitions" }, { fallback = nil });
94+ --- @type markview.config.asciidoc.admonitions.opts ?
95+ local ad_config ;
96+
97+ if admonition_config then
98+ ad_config = utils .match (admonition_config , item .kind , {
99+ case_insensitive = true ,
100+
101+ ignore_keys = { " enable" },
102+ eval_args = { buffer , item }
103+ });
104+ end
105+
106+ local range = item .range ;
107+
108+ local row_end = range .kind [3 ];
109+ local col_end = range .kind [4 ];
110+
111+ if ad_config then
112+ utils .set_extmark (buffer , asciidoc .ns , range .row_start , range .col_start , {
113+ end_col = range .kind [2 ],
114+ conceal = " " ,
115+
116+ virt_text_pos = " inline" ,
117+ virt_text = {
118+ { ad_config .corner_left or " " , utils .set_hl (ad_config .corner_left_hl or ad_config .hl ) },
119+ { ad_config .padding_left or " " , utils .set_hl (ad_config .padding_left_hl or ad_config .hl ) },
120+
121+ { ad_config .icon or " " , utils .set_hl (ad_config .icon_hl or ad_config .hl ) }
122+ },
123+
124+ hl_mode = " combine"
125+ });
126+
127+ utils .set_extmark (buffer , asciidoc .ns , range .kind [1 ], range .kind [2 ], {
128+ end_row = row_end ,
129+ end_col = col_end ,
130+
131+ hl_group = utils .set_hl (ad_config .hl )
132+ });
133+
134+ utils .set_extmark (buffer , asciidoc .ns , range .kind [3 ], range .kind [4 ], {
135+ end_col = range .kind [4 ] + 1 ,
136+ conceal = " " ,
137+
138+ virt_text_pos = " inline" ,
139+ virt_text = {
140+ { ad_config .padding_right or " " , utils .set_hl (ad_config .padding_right_hl or ad_config .hl ) },
141+ { ad_config .corner_right or " " , utils .set_hl (ad_config .corner_right_hl or ad_config .hl ) }
142+ },
143+
144+ hl_mode = " combine"
145+ });
146+
147+ utils .set_extmark (buffer , asciidoc .ns , range .row_start + 1 , range .col_start , {
148+ end_row = row_end + 1 ,
149+ conceal_lines = " " ,
150+ });
151+ else
152+ utils .set_extmark (buffer , asciidoc .ns , range .row_start , range .col_start , {
153+ end_row = row_end + 1 ,
154+ conceal_lines = " " ,
155+ });
156+ end
157+
158+ if (ad_config and ad_config .desc_hl ) or config .hl then
159+ utils .set_extmark (buffer , asciidoc .ns , range .row_start + 1 , range .col_start , {
160+ end_row = range .row_end - 1 ,
161+
162+ --- @diagnostic disable-next-line : param-type-mismatch
163+ line_hl_group = utils .set_hl (ad_config and ad_config .desc_hl or config .hl )
164+ });
165+ end
166+
167+ utils .set_extmark (buffer , asciidoc .ns , range .row_end , 0 , {
168+ end_row = range .row_end ,
169+ conceal_lines = " " ,
170+ });
171+
172+ --- | fE
173+ end
174+
175+ --- @param buffer integer
176+ --- @param item markview.parsed.asciidoc.delimited_blocks
177+ asciidoc .delimited_block = function (buffer , item )
178+ --- | fS
179+
180+ --- @type markview.config.asciidoc.delimited_blocks ?
181+ local config = spec .get ({ " asciidoc" , " delimited_blocks" }, { fallback = nil });
182+
183+ if not config then
184+ return ;
185+ end
186+
187+ local range = item .range ;
188+
189+ utils .set_extmark (buffer , asciidoc .ns , range .row_start , range .col_start , {
190+ end_row = range .row_start ,
191+ conceal_lines = " " ,
192+ });
193+
194+ utils .set_extmark (buffer , asciidoc .ns , range .row_start , range .col_start , {
195+ end_row = range .row_end - 1 ,
196+ line_hl_group = utils .set_hl (config .hl )
197+ });
198+
199+ utils .set_extmark (buffer , asciidoc .ns , range .row_end , 0 , {
200+ end_row = range .row_end ,
201+ conceal_lines = " " ,
202+ });
203+
204+ --- | fE
205+ end
206+
80207--- @param buffer integer
81208--- @param item markview.parsed.asciidoc.document_titles
82209asciidoc .document_attribute = function (buffer , item )
0 commit comments