render-link.html 402 B

123456789101112131415
  1. {{- $raw := or (hasPrefix .Text "<img") (hasPrefix .Text "<figure") -}}
  2. {{- $code := hasPrefix .Text "<code" -}}
  3. <a
  4. class="gdoc-markdown__link{{ if $raw -}}
  5. --raw
  6. {{- else if $code -}}
  7. --code
  8. {{- end }}"
  9. href="{{ .Destination | safeURL }}"
  10. {{- with .Title }}{{ printf "title=\"%s\"" . | safeHTMLAttr }}{{- end }}
  11. >
  12. {{- .Text | safeHTML -}}
  13. </a>
  14. {{- /* Drop trailing newlines */ -}}