jgm / djot

A light markup language
https://djot.net
MIT License
1.67k stars 43 forks source link

Inconsistent match positions between normal and reflinks #75

Closed matklad closed 1 year ago

matklad commented 1 year ago
[text](link)

+para 1-1
+linktext 1-1
str 2-5
-linktext 6-6
+destination 7-7
str 8-11
-destination 12-12
-para 13-13
[text][link]

+para 1-1
+linktext 1-1
str 2-5
-linktext 6-7
+reference 7-7
str 8-11
-reference 12-12
-para 13-13

The -linktext 6-7 in the second case looks suspicious. It is different from -linktext 6-6 in the first case.

Here's the relevant source code:

https://github.com/jgm/djot/blob/8b1082a06f4cfbbd2d6f6aebf33f9231a1c3ec90/djot/inline.lua#L258-L263

https://github.com/jgm/djot/blob/8b1082a06f4cfbbd2d6f6aebf33f9231a1c3ec90/djot/inline.lua#L324-L329

Note the diffrence between opener[4], opener[5] and opener[4], opener[4].