refactored [text] and [html] to reduce code duplication. (uses helper function instead)

Signed-off-by: Daniel Fagnan <dnfagnan@gmail.com>