I am using Blogdown. In my post.Rmd
file I need to use a shortcode:
This is me calling a **shortcode**:
`r blogdown::shortcode("mysc", .content = "Find **more** about this shortcode in [here](https://www.wikipedia.com).")`
As you can see, .content
is Markdown, not plain text. Shortcode mysc.html
is:
<p class="sc">
{{ if .Inner }}
{{ .Inner }}
{{ end }}
</p>
As you can see, I am using blogdown::shortcode
because it is not possible to use shortcode syntax in Rmd files.
However the Markdown in .content
is not converted into HTML, I get this as output:
<p>
Find **more** about this shortcode in [here](https://www.wikipedia.com).
</p>
What am I doing wrong?
Note that specifying .type
does not help:
`r blogdown::shortcode("mysc", .content = "...", .type = "markdown")`
Also it should not be necessary as it defaults to "markdown"
. And it still renders the same exact output if I specify .type = "html"
. What the hell is going on here?
As I mentioned in the Github issue you referenced, Hugo changed the behavior of {{% %}}
. Personally I feel it is a breakage. Before it is fixed, I think your only options are
Lock your website project to a lower version of Hugo, e.g.
blogdown::install_hugo('0.54.0', force = TRUE)
If you installed Hugo via Homebrew previously, you'd better uninstall it: brew remove hugo
.
Or manually turn .Inner
to Markdown in your shortcode: {{ .Inner | markdownify }}
. Please note that this approach has a potential risk: if the Hugo author decides to revert the behavior of {{% %}}
shortcodes, you will have to remove markdownify
.