{excerpt $body, words=24} writes the first 24 words of the text and an ellipsis where it goes on - always whole words, never a word cut in half. A text no longer than words stays whole, without an ellipsis.

With highlight= it is a search result: the query is split into words at everything that is no letter or digit, a word matches at the start of a word whatever its case - templ finds Templates - and the whole matched word is put in a <mark>. The window of words words is centred on the first match and moved in where it would run past either end, with an ellipsis on each side that was cut.

Everything of the text is escaped piece by piece; the only markup that comes out is the <mark> around a match. For a text that is HTML - a post body, a rendered page - the html option drops its tags and reads its entities first, so the words counted are the words a reader sees.

The mark colours are --pad-excerpt-mark and --pad-excerpt-marked on .pad-excerpt, with light-dark() defaults written once a page. A words that is no number of 1 or more is a strict error.