Make the snippet length of a search hit configurable
Currently, the length of the snippet for a search hit is fixed at 15 characters. This provides little more context than the query itself. For example:
...ces. With this extension, you can add an...
Allow the user to configure this length using a configuration key. The value of this key will then be passed to the search script via a data attribute and used when creating the snippet for a search hit.
I propose the following configuration key:
antora:
extensions:
- require: '@antora/lunr-extension'
max_snippet_length: 80
I'd also like to propose increasing the default from 15 to 120 to give a better experience out of the box.
We could also consider counting the length by words instead of characters. However, since words vary a lot in length, that can cause the results to be very irregular.