I still think it makes more sense to put this HTML in the template, where no conversion is necessary (because it's HTML already, duh). Just switch on action there.