Automatically add id attribute to dt element

If you’re willing to be a bit unconventional…

markdown

[term](@)
: definition

layouts/_default/_markup/render-link.html

{{- if eq .Destination "@" -}}
  <span id="{{ .PlainText | anchorize }}">{{ .Text | safeHTML }}</span>
{{- else -}}
  ...
{{- end -}}

renders to:

<dl>
  <dt><span id="term">term</span></dt>
  <dd>definition</dd>
</dl>
3 Likes