-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nested shortcode with codeblock rendering issue #7848
Comments
Confirmed. The test content can be reduced to:
The key is to have a blank line in the code section. |
Thank you, much more concise! and yes we actually removed the spacing as a workaround to stop the issue. |
s1 := `{{< first >}}
# This is first markdown
{{< second >}}
# This is second markdown
`+"```"+`
# Comment 1
# Comment 2
`+"```"+`
{{< /second >}}
{{< /first >}}
` After inner # This is first markdown
<div><h1 id="this-is-second-markdown">This is second markdown</h1>
<pre><code># Comment 1
# Comment 2
</code></pre></div> According to commonmark, the above results in Although this is a little surprise, it might not be a bug. @davidejones builder.WithTemplatesAdded("layouts/shortcodes/first.html", `<div>{{- .Inner | markdownify -}}</div>`)
builder.WithTemplatesAdded("layouts/shortcodes/second.html", `<div>{{ .Inner }}</div>`) This is the easiest way to fix this, I think. |
What version of Hugo are you using (
hugo version
)?Does this issue reproduce with the latest release?
Yes
What is the issue?
Nesting a markdown shortcode within a markdown shortcode can in some cases cause a codefence to render some of its contents as markdown.
This doesn't appear to happen if there is just one shortcode surrounding the markdown. e.g removing
{{< first >}}
and{{< /first >}}
from the test example below.Appears to happen with both methods of specifying markdown:
{{% ... %}}
OR
{{< ... >}}
with.Inner | markdownify
Screenshot of issue
Test
Bit of a messy test but you get the point
I added this to
hugolib/shortcode_test.go
and the line saying# This declares a view into HAProxy statistics, on port 3833
gets rendered as a h1 even though its inside a code block.The text was updated successfully, but these errors were encountered: