Closed iu4u57k3 closed 4 years ago
This is the correct behavior for CommonMark.
So what's the fix?
Read https://spec.commonmark.org/0.29/#html-blocks (esp. start condition 6).
Don't indent the first line of embedded HTML blocks. End the HTML block with a blank line.
Ok, thanks!
Can these optimizations be done by hugo itself for html and gohtml files and these files being treated differently?
@bep, Am I correct here?
When a content file contains a shortcode, does Hugo insert the rendered shortcode output into the main markdown content and then render the combined content (essentially re-rendering the shortcode output)? Did the rendering pipeline/workflow change with the addition of goldmark?
I'm assuming the rendering pipeline is essentially that same and that blackfriday allowed indented HTML whereas goldmark follows the CommonMark spec.
I think this is the intentional behaviour .
According to https://gohugo.io/content-management/shortcodes/#shortcodes-with-markdown ,
In @iu4u57k3 7k3 's case, it is proper to use
not {{% info title="Some product name"%}}
but {{< info title="Some product name">}}
.
They are different.
The former is handled as texts to be processed further so it is converted into code blocks. The latter is treated as raw (=ready to use) html by hugo. I checked it works at least with v0.65.2.
Honestly speaking, I did not know this tip until now!
I have been and am using {{< xxx >}}
without intension
This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master
branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Lets say you created a shortcode named
info.html
orinfo.gohtml
in idea community edition editor with gohtml plugin installed.You opened it in code editor and pressed
Ctrl + Alt + L
to beautify it for the nice formatting.Then it looks something like this:
Then you added this shortcode to a post using:
However, they are being treated as markdown code blocks and not .gohtml or .html files:
Once the first indent is removed, then code starts to get rendered correctly.
.gohtml
,.html
and.md
shortcodes must be treated differently by hugo,.This issue is somewhat similar to: https://github.com/gohugoio/hugo/issues/6553