Raw HTML disappears from markdown without saying anything
Goldmark discards raw HTML by default. No error, no warning, no trace in the output.
Put an iframe in a markdown file and it renders as nothing.
Evidence
- Not a broken element, not a comment, not a warning in the build log.
- The element simply isn’t in the HTML, as though I’d never typed it.
No error, no warning, no trace. The element simply is not there.
What was going on
-
Goldmark — Hugo’s markdown renderer — discards raw HTML unless you tell it otherwise:
[markup.goldmark.renderer] unsafe = true -
I’ll defend the name.
-
It’s site-wide and it re-enables all raw HTML in all markdown, which is a sensible thing to refuse when content might come from someone else, and a sensible thing to allow on a personal site where I wrote every file.
The second thing, learned more slowly
- Raw HTML wants a blank line before and after it.
- Without one Goldmark folds the block into the neighbouring paragraph, and the result is mangled in a way that looks nothing like a markdown problem.