First, thanks @acanalis for hinting in the right directions. I think it would be correct and useful for anybody coming here to summarize:
-
The assumption that
{{% %}}
method of calling triggers markdown rendering before passing to shortcode as.Inner
is wrong, see post #6 above. In short,-
.Inner
is available as verbose content, no rendering happens when calling the shortcode - if one calls
markdownify
from the context of the shortcode, this can render such things as footnotes wrongly - after returning from the shortcode into the calling document, the content is rendered again using the rendering context of the calling document
-
-
Spurios rendering of the code snippet which I started this topic with is actually as expected, and as @acanalis put it “difficult to understand but easy to see”. Reason is double-rendering once inside the shortcode and second time outside when returning, and the fact that by coincidence, the comment line of go code is 4-space indented. See updated repo https://github.com/agronskiy/hugo-experimentation/tree/main/shortcode-rendering-order and here’s the screenshot:
Not that if I remove “xxx”, this problem disappears, so this is exactly “difficult to understand” part of the interplay between the renderer and paragraphs preceding the problematic point.
I think this is more or less what we can track here, and I think I’m satisfied by the current understanding.