Fold whitespace when getting the textContent of an element.

If definitions span lines, for example, the whitespace following
the newline is meaningful when generating definition IDs and etc.
We should fold multiple whitespace characters into a single space
when generating the text content of nodes to avoid this issue.

Closes #153.