Skip to content

Use Hugo's native support for processing HTML & markdown, not file extension testing #906

@chalin

Description

@chalin

Originally posted by @deining in #526 (comment) :

I just realized that shortcode lead treats its .Inner content 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 feature in 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):

Related:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions