How to stop twig debug from breaking HTML when inside tags?
You can apply |render|striptags|trim twig filters:

&lt;a href="{{ fields.path.content|render|striptags|trim }}" class="menu-item"&gt;{{ fields.title.content }}&lt;span data-background-image="{{ fields.field_image.content|render|striptags|trim }}"&gt;&lt;/span&gt;&lt;/a&gt;



  If you want to save (not delete) for example div or img tags you can also write:
  
  {{ fields.field_image.content|render|striptags('&lt;div&gt;, &lt;img&gt;')|trim }}


Seen here https://www.drupal.org/node/2672656#comment-11821896