Refactor text, markdown, and html dpage classes.