Is it possible to insert HTML code in Markdown content?

Does Hugo’s markdown engine support this feature? I haven’t got any clue on its documentation site. Any workarounds will be appreciated.

You can add html inside markdown files in /content. However your indented code will follow markdown formatting. You could also save your content files as .html but then you’ll have to write everything in html.

You can typically use HTML in Markdown. Hugo’s Markdown processor, Blackfriday merely adds a superset of functionality on top of Markdown. Hugo also has shortcodes that you can create (as well as some built-in) that might help too:

1 Like

@Billy_Herrington HTML can be part of markdown because HTML-inside-markdown is part of the spec. That said, remember that the spec disallows markdown nested inside of HTML. So if you create a div, just make sure everything inside that div is valid HTML. To echo @budparr, if you find yourself repeating blocks of HTML, it’s worth it to check out shortcodes.

1 Like

I inserted some HTML from Tableau Public into a post, and although I was eventually able to make it appear in the post, I noticed that the Recent Posts page shows the html as text. Is this expected?



@Ross_Larson yes. The layout file responsible is: themes/ananke/layouts/post/summary.html

{{ .Summary }} strips all HTML tags.


Create your own layouts/post/summary.html file to override the theme default.

I think this answers your question: