Refactor fidohtml.js

This pull request aims to increase readability and maintainability of the code base.

Escaping through `afterURL` became a little more customizable and I think that `fromText` is easier to read now too.