Refactor html->plaintext conversion into separate library