stxt2html: restructure with State monad