Skip to content
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

Hugo produces Unexpected Goldmark (CommonMark) Behavior #7619

Closed
HenrySkup opened this issue Sep 3, 2020 · 6 comments
Closed

Hugo produces Unexpected Goldmark (CommonMark) Behavior #7619

HenrySkup opened this issue Sep 3, 2020 · 6 comments
Labels

Comments

@HenrySkup
Copy link

v0.74.3/extended darwin/amd64

Hi, This is in reference to this thread.

Basically: Hugo is introducing a bug into Goldmark's HTML rendering when it encounters custom HTML elements (e.x. <custom-element>...</custom-element>) within markdown -- especially multi-line instances.


When my markdown is:

# Title 

<custom-element>
    <div>This will be "slotted" into the custom element.</div>
</custom-element>

the resulting HTML is :

<h1>Title</h1>
<p><custom-element></p>
  <div>This will be "slotted" into the custom element.</div>
</custom-element>

As per the spec, the expected behavior should be :

<custom-element>
  <div>This will be "slotted" into the custom element.</div>
</custom-element>

Note the lack of any <p> tags.

N.B.
As per the spec, if the MD was <custom-element></custom-element> (one line) the resulting HTML should be wrapped in <p> tags.

@bep
Copy link
Member

bep commented Sep 3, 2020

Hugo is introducing a bug into Goldmark's HTML rendering

Why is this a Hugo and not a Goldmark problem?

@jmooring
Copy link
Member

jmooring commented Sep 3, 2020

I tested with direct usage of Goldmark, and it produced the expected results.

@jmooring
Copy link
Member

jmooring commented Sep 3, 2020

Interesting find. Removing the hyphen from the custom element name resolves the problem. For example, this works:

<customelement>
Foo
</customelement>

while this does not:

<custom-element>
Foo
</custom-element>

Per the HTML spec, custom elements must contain a hyphen in the name.

bep added a commit that referenced this issue Sep 4, 2020
@schindld
Copy link

I just updated to hugo v0.80.0, and it's fixed!

@jmooring
Copy link
Member

Confirmed that this is fixed. @HenrySkup, please close this issue.

@bep bep closed this as completed Feb 20, 2021
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants