Escaping html when importing yaml

I have managed to achieve this using the twig documentation on escaping as at https://twig.symfony.com/doc/2.x/api.html#escaper-extension

Using

{% autoescape 'html' %}
{{ page.header.imports.file1.x|yaml_emit }}
{% endautoescape %}

works for the most part, although I am having difficulty with the processor removing a >- block chomping indicator