Correctly process whitespace.

See https://github.com/peerlibrary/peerlibrary/issues/666 and https://github.com/hypothesis/dom-text-mapper/issues/12