Use Hugo's native support for processing HTML & markdown, not file extension testing
Originally posted by @deining in https://github.com/google/docsy/issues/526#issuecomment-823577659 :
I just realized that shortcode
leadtreats its.Innercontent either as markdown or as HTML, depending on the extension of the page that makes use of the the shortcode:{{ if eq .Page.File.Ext "md" }} {{ .Inner | markdownify }} {{ else }} {{ .Inner | htmlUnescape | safeHTML }} {{ end }}Does it make sense to implement this for shortcode
featurein a similar way?
IMHO, that is the wrong way to do it. When using a shortcode, one needs to use either {{< >}} or {{% %}} instead, depending on the content of the shortcode (HTML and markdown, respectively).
If we all agree that this is the way to go, then a number of files will need to be changed (which mostly were introduced by #378 I believe):
- [x] #727
- [x]
layouts/shortcodes/alert.html- #941 - [x]
layouts/shortcodes/card.html- #1376 - [ ]
layouts/shortcodes/blocks/cover.html- #1400 - [x]
layouts/shortcodes/imgproc.html- #1522 - [x]
layouts/shortcodes/blocks/lead.html- #1398 - [x]
layouts/shortcodes/blocks/section.html- #1472 - [ ] And other shortcodes, see the output of the GH search for .Page.File.Ext "md"
Related:
- #939
Hey @trombonehero - this issue is a proposal to revert #378, which you submitted a little while back. Might you be willing to give some more details concerning your use case, possibly illustrating why docsy -- prior to #378 -- didn't seem to address your needs? Thanks!