-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
0.60.0 goldmark: <html> indentation in partial/shortcode wrapped in <pre><code>
#6553
Comments
Yes, I can understand that indenting with 4 spaces means a code block. No problem. But I was not expecting that pure HTML/Go-template would be treated like this (it was not with blackFriday). So, If i read between lines :-) this means that goldmark will treat every 4 spaces as a code block, even for HTML. So a good prevention measure would be to change "tab->number of space" default in my editor (VSCode) to 3 (at least not 4). Will look if it changes things. Thanks. |
Done some testing with 3 spaces.
So I guess that at the moment any HTML code with several indentations (not equal to 3 exactly) will have a problem. |
So, after testing a bit I can confirm that :
I understand that Bep was not surprised by this behaviour, which is fine by me if it is expected behaviour. Workaround is to flat your HTML code if it could be called by shortcode. Not read friendly but efficient. cc @onedrawingperday who helped me a lot on this diagnostic. |
OK, that seems to be a bug in Goldmark. I will create a bug report over there.
I didn't say I wasnt surprised, I just pointed to a possible explanation. |
OK; I had a look at this and I don't understand it. The example shows an inline shortcode using |
Later today, I'll provide access to the repo and prepare 3 pages with 3 different shortcodes/partials with this problem. Stay tuned. |
Bep & MooreReason, I invited you to the repo.
First : thanks for your help, and let me know if I can do/test other things. You can see the 3 post with exactly same code except HTML indentation on the 3 last post here : https://migration-en-goldmark--lagouille.netlify.com/dernieres-nouveautes/ |
And test1/test2.html have 3 space indentation, and still get the problem. Mmmmmmmm |
@divinerites, |
Ahhhh. Yes makes sense. Thanks a lot. I Will take this in account. So as the behaviour was different with use of blackFriday in 0.59.x, will look forward to see if this is expected behaviour or not and then change my code accordingly to the right practice. |
I think this is the issue I'm hitting in Bootstrap too after updating Hugo. This worked fine before but now renders invalid HTML: <div class="bd-example">
<table class="table">
<thead>
<tr>
<th scope="col">Class</th>
<th scope="col">Heading</th>
<th scope="col">Heading</th>
</tr>
</thead>
<tbody>
<tr class="table-active">
<th scope="row">Active</th>
<td>Cell</td>
<td>Cell</td>
</tr>
<tr>
<th scope="row">Default</th>
<td>Cell</td>
<td>Cell</td>
</tr>
{{< table.inline >}}
{{- range (index $.Site.Data "theme-colors") }}
<tr class="table-{{ .name }}">
<th scope="row">{{ .name | title }}</th>
<td>Cell</td>
<td>Cell</td>
</tr>
{{- end -}}
{{< /table.inline >}}
</tbody>
</table>
</div> |
Also hitting this after updating to v0.60.0. If you use For example,
Usage:
Generated HTML Output:
|
@XhmikosR, how does that render? @ahmetb, are you enabling |
@moorereason |
First time I'm hearing about Goldmark and the I don't have |
...to add to my previous comment: I did not realize Blackfriday was replaced with Goldmark. My Blackfriday config also did not have any relevant keys with respect to unsafe html. |
* Fix commonmark syntax related gohugoio/hugo#6553 * Fix indentation Co-authored-by: XhmikosR <xhmikosr@gmail.com>
* Fix commonmark syntax related gohugoio/hugo#6553 * Fix indentation Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Closing. The only way to reproduce the original problem is by erroneously piping Simplified test site: git clone --single-branch -b hugo-github-issue-6553 https://github.com/jmooring/hugo-testing hugo-github-issue-6553
cd hugo-github-issue-6553
hugo server |
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. |
What version of Hugo are you using (
hugo version
)?Does this issue reproduce with the latest release?
Yes. In lates 0.60.0 using goldmark
[markup.goldmark.renderer] unsafe = true
has no effect.The text was updated successfully, but these errors were encountered: