You can add a variable which contains the HTML in Magento 2 email templates. But you have to follow some format to allow HTML data in variables.
You just have to write |raw at the end of the variable in the email template.
Here are few examples.
{{ var payment_html|raw }}
{{ var order.shipping_description|raw }}
So here raw is responsible for allowing HTML in the email templates in the Adobe Commerce website.