alups
December 1, 2019, 3:47am
1
Hi, all
I have a shortcodes in layouts/shortcodes/important.html
<div class=“center” >
<div class=“important”>
{{ .Inner | markdownify }}
</div>
</div>
in markdown the following code
{{% important %}}
abc
{{% /important %}}
show
acc
</div>
I dont know why the extra </div> show up while setting markup = glodmark in front matter, if I set markup to blackfriday or mmark , it works well.
wdehoog
December 3, 2019, 11:23am
2
I am experiencing problems as well.
part of my shortcode is:
<div class="col-md-4">
<div class="image pull-left">
{{ if isset .Params "url" }}
<a href="{{ .Params.url | relLangURL }}">
<img src="{{.Site.BaseURL}}{{.Params.img}}" class="img-responsive" alt="">
</a>
{{ else }}
<img src="{{.Site.BaseURL}}{{.Params.img}}" class="img-responsive" alt="">
{{ end }}
</div>
</div>
The divs are rendered ok but the links (<a…) are rendered wrong. Wrapped in pre/code and html escaped:
<div class="col-md-4">
<div class="image pull-left">
<pre><code> <a href="/products/x62t">
<img src="//localhost:1313//img/X62T.png" class="img-responsive" alt="">
</a>
<p></div>
I did set unsafe to true in the markup.goldmark config. With ‘defaultMarkdownHandler = “blackfriday”’ everything is fine.
wdehoog
December 3, 2019, 12:16pm
4
You link does not work for me but I saw the issue on github.
You are right. Flattening makes it work. However indenting helps me a lot so I hope there will be another solution in the future. For now I’ll stick with blackfriday.
alups
December 15, 2019, 11:05am
5
Yes, flat code is one solution, also,
in config.toml
[markup]
[markup.goldmark]
[markup.goldmark.renderer]
unsafe = true
and use "< " instead of “%” in markdown also works for goldmark. For example:
{{< myshortcode >}}
something .
{{< /myshorcode >}}
jswtch
April 27, 2020, 7:46pm
6
I am having the same issue. Flattening my {{% shortcode %}} ... {{% /shortcode % }}
works but it is not the greatest experience.