in-dexter icon indicating copy to clipboard operation
in-dexter copied to clipboard

Support arbitrary content for entries

Open lukasjuhrich opened this issue 9 months ago • 3 comments

First up, thanks to the maintainers for providing something as useful as an indexing library. I currently use it for my master's thesis.

Upshot: I cannot do something like #index[$cal(T)_n$-set].

Currently, the index normalizes every entry to text using the as-text function (and as far as I can see, uses this to display things, instead of the original content). That unnecessarily restricts the use of this index, because the only reason to demand a string is sorting of entries and grouping of references.

I suggest an entry should be a dictionary (display: …, key: …) with the following implicit conversions:

  • strings will be converted via s => (display: s, key: s)
  • content will be converted via c => (display: c, key: as-text(c))
  • duples will be converted via (d, k) => (display: d, key: k)
  • dicts will be passed as-is.

This would allow for something like

#index([main entry], ($cal(T)_n$-set, "Tn-set"))

or even to arbitrarily manipulate the sort order inside an initial.

When that exists, it might be a good idea to make the panic in as-text refer to this explicit option as a workaround.

While it would also be valuable to make as-text handle more cases on its own, in my opinion this is an orthogonal issue.

lukasjuhrich avatar May 23 '24 11:05 lukasjuhrich