@@ -1035,6 +1035,74 @@ inline.link_uri_autolink = function (buffer, item)
10351035 });
10361036end
10371037
1038+ --- Render ==tag==.
1039+ --- @param buffer integer
1040+ --- @param item markview.parsed.markdown_inline.tags
1041+ inline .tag = function (buffer , item )
1042+ --- @type markview.config.markdown_inline.tags ?
1043+ local main_config = spec .get ({ " markdown_inline" , " tags" }, { fallback = nil });
1044+ local range = item .range ;
1045+
1046+ if not main_config then
1047+ return ;
1048+ end
1049+
1050+ --- @type markview.config.__inline ?
1051+ local config = utils .match (
1052+ main_config ,
1053+ item .label ,
1054+ {
1055+ eval_args = { buffer , item }
1056+ }
1057+ );
1058+
1059+ if config == nil then
1060+ return ;
1061+ end
1062+
1063+ --[[
1064+ NOTE: `hl_mode` shouldn't be "combine".
1065+
1066+ As tags don't have delimiter surrounding it,
1067+ using "combine" prevents adding `paddings`/`margins`
1068+ to the right side.
1069+ ]]
1070+
1071+ vim .api .nvim_buf_set_extmark (buffer , inline .ns , range .row_start , range .col_start , {
1072+ undo_restore = false , invalidate = true ,
1073+ end_col = range .col_start + 1 ,
1074+ conceal = " " ,
1075+
1076+ virt_text_pos = " inline" ,
1077+ virt_text = {
1078+ { config .corner_left or " " , utils .set_hl (config .corner_left_hl or config .hl ) },
1079+ { config .padding_left or " " , utils .set_hl (config .padding_left_hl or config .hl ) },
1080+
1081+ { config .icon or " " , utils .set_hl (config .icon_hl or config .hl ) }
1082+ },
1083+
1084+ -- hl_mode = "combine"
1085+ });
1086+
1087+ vim .api .nvim_buf_set_extmark (buffer , inline .ns , range .row_start , range .col_start + 1 , {
1088+ undo_restore = false , invalidate = true ,
1089+ end_col = range .col_end ,
1090+ hl_group = utils .set_hl (config .hl )
1091+ });
1092+
1093+ vim .api .nvim_buf_set_extmark (buffer , inline .ns , range .row_start , range .col_end , {
1094+ undo_restore = false , invalidate = true ,
1095+
1096+ virt_text_pos = " inline" ,
1097+ virt_text = {
1098+ { config .corner_right or " " , utils .set_hl (config .corner_right_hl or config .hl ) },
1099+ { config .padding_right or " " , utils .set_hl (config .padding_right_hl or config .hl ) }
1100+ },
1101+
1102+ -- hl_mode = "combine"
1103+ });
1104+ end
1105+
10381106--- Renders inline markdown.
10391107--- @param buffer integer
10401108--- @param content markview.parsed.markdown_inline[]
0 commit comments