Craft or Twig converting html tags to alt characters
You need to make sure that you're returning the raw version of the HTML.

In Craft 2, it looks like this...



return TemplateHelper::getRaw($result);


In Craft 3, it looks like this...

return Template::raw($result);


If you're doing this in Craft 3, you need to also be sure that you are loading the Template helper class at the top:

use craft\helpers\Template;