Commit d6a82d7
committed
feat: support highlighting when nested in double equals
## Details
Adds support for Obsidian style inline highlights which are sections of
text that are surrounded by "==". When these are found the equals signs
on both ends are concealed and the inner portion of text is highlighted
using the configured highlight group. By default links to the same value
as inline code. Configuration is placed under `inline_highlight`. The
rendering logic is all contained in the inline_highlight renderer module.
Also includes a large refactor to how concealed text and inline offsets
are handled:
- Store ranges with a width for the concealed sections, that way any
nodes that overlap simply add the width rather than doing a per
character computation.
- Allow concealing added by this plugin to be treated in the exact same
way as concealing from highlights, including rules for different levels.
- Update context with offsets and concealed ranges based on the marks
being added rather than ad hoc logic while adding the marks. A mark
with conceal is treated as a conceal highlight. A mark with inline
virtual text is treated as an offset. Having both also works, some
values will end up cancelling out as a result. This should capture any
new features automatically, like the one for inline highlights, nice!
- Move all the conceal handling into its own module which will be pulled
from the context where it's needed.
Other small changes:
- Add a convenience `add_over` method to list module which populates
start & end, row & col, from a provided node. Useful in many instances
where we add some style directly inline with or over an existing node.
- Remove `hidden` method from context and instead use `width == 0`.
- Use `width` when computing amount of space for the heading icon
- Remove custom handler test which had a version of this logic.
- Update table spec to test behavior of inline highlighting
- Update default table format level for luassert.1 parent 430a671 commit d6a82d7
File tree
29 files changed
+584
-513
lines changed- doc
- lua/render-markdown
- core
- handler
- lib
- render
- tests
- data
29 files changed
+584
-513
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
532 | 532 | | |
533 | 533 | | |
534 | 534 | | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
535 | 543 | | |
536 | 544 | | |
537 | 545 | | |
| |||
1117 | 1125 | | |
1118 | 1126 | | |
1119 | 1127 | | |
1120 | | - | |
1121 | | - | |
1122 | | - | |
1123 | | - | |
1124 | | - | |
1125 | | - | |
1126 | | - | |
1127 | | - | |
1128 | | - | |
1129 | | - | |
1130 | | - | |
1131 | | - | |
1132 | | - | |
1133 | | - | |
1134 | | - | |
1135 | | - | |
1136 | | - | |
1137 | | - | |
1138 | | - | |
1139 | | - | |
1140 | | - | |
1141 | | - | |
1142 | | - | |
1143 | | - | |
1144 | | - | |
1145 | | - | |
1146 | | - | |
1147 | | - | |
1148 | | - | |
1149 | | - | |
1150 | | - | |
1151 | | - | |
1152 | | - | |
1153 | | - | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
1154 | 1163 | | |
1155 | 1164 | | |
1156 | 1165 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
579 | 579 | | |
580 | 580 | | |
581 | 581 | | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
582 | 590 | | |
583 | 591 | | |
584 | 592 | | |
| |||
1140 | 1148 | | |
1141 | 1149 | | |
1142 | 1150 | | |
1143 | | - | |
1144 | | - | |
1145 | | - | |
1146 | | - | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
1147 | 1157 | | |
1148 | | - | |
| 1158 | + | |
1149 | 1159 | | |
1150 | | - | |
| 1160 | + | |
1151 | 1161 | | |
1152 | | - | |
| 1162 | + | |
1153 | 1163 | | |
1154 | | - | |
| 1164 | + | |
1155 | 1165 | | |
1156 | | - | |
| 1166 | + | |
1157 | 1167 | | |
1158 | | - | |
| 1168 | + | |
1159 | 1169 | | |
1160 | | - | |
| 1170 | + | |
1161 | 1171 | | |
1162 | | - | |
| 1172 | + | |
1163 | 1173 | | |
1164 | | - | |
| 1174 | + | |
1165 | 1175 | | |
1166 | | - | |
| 1176 | + | |
1167 | 1177 | | |
1168 | | - | |
| 1178 | + | |
| 1179 | + | |
1169 | 1180 | | |
1170 | | - | |
| 1181 | + | |
| 1182 | + | |
1171 | 1183 | | |
1172 | | - | |
1173 | | - | |
| 1184 | + | |
| 1185 | + | |
1174 | 1186 | | |
1175 | | - | |
1176 | | - | |
| 1187 | + | |
| 1188 | + | |
1177 | 1189 | | |
1178 | | - | |
| 1190 | + | |
1179 | 1191 | | |
1180 | | - | |
| 1192 | + | |
1181 | 1193 | | |
1182 | | - | |
1183 | | - | |
| 1194 | + | |
| 1195 | + | |
1184 | 1196 | | |
1185 | | - | |
| 1197 | + | |
1186 | 1198 | | |
1187 | | - | |
1188 | | - | |
| 1199 | + | |
| 1200 | + | |
1189 | 1201 | | |
1190 | | - | |
| 1202 | + | |
1191 | 1203 | | |
1192 | | - | |
| 1204 | + | |
1193 | 1205 | | |
1194 | | - | |
| 1206 | + | |
1195 | 1207 | | |
1196 | | - | |
| 1208 | + | |
1197 | 1209 | | |
1198 | | - | |
1199 | | - | |
| 1210 | + | |
| 1211 | + | |
1200 | 1212 | | |
1201 | | - | |
| 1213 | + | |
1202 | 1214 | | |
1203 | | - | |
1204 | | - | |
| 1215 | + | |
| 1216 | + | |
1205 | 1217 | | |
1206 | | - | |
1207 | | - | |
| 1218 | + | |
| 1219 | + | |
1208 | 1220 | | |
1209 | | - | |
| 1221 | + | |
| 1222 | + | |
1210 | 1223 | | |
1211 | | - | |
| 1224 | + | |
| 1225 | + | |
1212 | 1226 | | |
1213 | | - | |
1214 | | - | |
| 1227 | + | |
| 1228 | + | |
1215 | 1229 | | |
1216 | | - | |
1217 | | - | |
1218 | | - | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
1219 | 1233 | | |
1220 | 1234 | | |
1221 | 1235 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
32 | 32 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
40 | 41 | | |
41 | | - | |
42 | | - | |
| 42 | + | |
| 43 | + | |
43 | 44 | | |
44 | | - | |
45 | | - | |
46 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
47 | 48 | | |
48 | | - | |
49 | | - | |
50 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
51 | 52 | | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| |||
0 commit comments