jgm/djot.lua

Improve source position in parsing warnings

Omikhleia opened this issue · 1 comments

A mere space error:

...
... some text {.class}

Yields a warning:

{
  message = "Ignoring unattached attribute",
  pos = 30
}

Where pos is the byte position.
When the sourcepos map is enabled, it would be handy to have the usual line:col:charpos in warnings, as we can have on nodes, for easier investigation by the typist.

Conversely having the bytepos kept in nodes could be useful to extract the offending substring.
Oh wait is has the UTF charpos, so it's sufficient.