Files
website/content/notes/html-in-markdown-recommendation.md
T
Andrew StrykerandClaude Opus 4.6 403da45ff1 Merge infrastructure changes from post/autogolpe into main
Brings in renv, archetypes, layout partials, shortcodes, gitignore,
and hugo config changes that were committed on the post branch.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 21:33:44 -07:00

3.3 KiB
Raw Blame History

title, date, draft, tags
title date draft tags
Using HTML in Markdown 2025-02-25T21:21:21-08:00 false
Writing
Markdown
HTML
Hugo

Markdown uses punctuation-based syntax to format text, drawing inspiration from plain text email conventions. The goal is for Markdown documents to be easy to read. For concerns that the specification does not cover, users are free to use HTML. However, the HTML tags that rendering engines support vary considerably. Further, some rendering engines have their own approach to extensions, like shortcodes in Hugo. Generally, best practice is to avoid mixing Markdown and HTML, as doing so can detract from Markdowns intended simplicity and readability.

The following items are exceptions to this rule—cases where HTML provides functionality or control that Markdown does not.

HTML Tag(s) Description Notes
<details> and <summary> Create collapsible sections for hiding and revealing content. 1
<kbd> Represent keyboard inputs or shortcuts.
<abbr> Add tooltips to abbreviations for clarity. 2
<sup> and <sub> Format text as superscript or subscript.
<mark> Highlight text with a background color. 1
<!-- ... --> (HTML Comments) Insert comments that wont appear in the rendered output. 1
<img> Embed images with enhanced control over attributes like class, style, width, and height.
<div> Apply specific styles elements, such as centering an image, to a section of text
<var> Represent variables, parameters, or mathematical symbols to add semantic clarity in technical documentation. 3
<samp> Denote sample output from programs or command-line operations, helping readers distinguish between code input and output. 3

  1. Supported in Hugo, but may depend on the theme. ↩︎

  2. Not supported in Hugo. ↩︎

  3. Not supported in GitHub ↩︎