I’ve used debugprint.html myself - very handy.
I’m using a partial as a function here:
Which calls (not the most elegant) a template which chains several replaceRE calls to strip script tags from content that may be problematic in an Atom or RSS feed:
<!-- filter-html.html
Intended to be used for filtering content to be included in RSS and Atom feeds.
It'd be nice if Hugo grew attributes (a slice of attributes) that safeHTML would drop.
Filter HTML content to remove:
- script tags
- extra \n<p></p> at end of summary, produced by Summary
- style attributes
-->
{{- $noscript := replaceRE `<script.*?>(.|\n)*?</script>` "" . }}
{{- $noscript := replaceRE `(<.*?) (style=".*?")` "$1 " $noscript }}
{{- $noscript := replaceRE `\n<p></p>$` "" $noscript }}
{{ $noscript | safeHTML }}