Highlighter extension

This is the second (and final) batch of the work done during the hackathon, plus some internal refactoring, plus some cleanup.

See the commit messages for details.

(This PR is a new version of #57. I had to re-open this, because I pushed a bugfix on typed-packaging.)