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

Extraneous p-tag around shortcodes #7339

Closed
didenko opened this issue May 31, 2020 · 3 comments
Closed

Extraneous p-tag around shortcodes #7339

didenko opened this issue May 31, 2020 · 3 comments
Labels

Comments

@didenko
Copy link

didenko commented May 31, 2020

What version of Hugo are you using (hugo version)?

$ hugo version
Hugo Static Site Generator v0.71.1 linux/amd64 BuildDate: unknown

Does this issue reproduce with the latest release?

Yes

Setup

A single page is calling a sequence of shortcodes

The plugin structure has the baseof file which wraps ul-tags around the content. The content is a series of shortcodes resulting in series of li-tags.

Expected resulting code:

<!DOCTYPE HTML>
<html>
<body><ul id="main"><li>Item1</li>

<li>Item2</li>
</ul></body>
</html>

Actual resulting code:

<!DOCTYPE HTML>
<html>
<body><ul id="main"><p><li>Item1</li>

<li>Item2</li>
</p>
</ul></body>
</html>

Full test case

For whatever reason GitHub refused to upload either .gz or .zip, so the test case is uploaded to the repository https://github.com/didenko/hugo_test_case_extra_p

@jmooring
Copy link
Member

jmooring commented Jun 5, 2020

The combined output will be wrapped in a <p> tag if you do this:

{{< item text="Item1" >}}
{{< item text="Item2" >}}

Neither the combined output nor the individual ouput will be wrapped in a <p> tag if you do this:

{{< item text="Item1" >}}

{{< item text="Item2" >}}

I've run into this before. The fact that you are wrapping <li> tags with a <ul> tag is irrelevant. You can reproduce the behavior with shortcodes that render text only.

Is this a bug or a feature? In some cases I have taken advantage of the behavior, in others I have had to add a blank line between the calls in order to achieve the desired output.

The question has come up before:
#1642
https://discourse.gohugo.io/t/5559

@didenko
Copy link
Author

didenko commented Jun 5, 2020

Thank you, I see the behavior - really appreciate the pointer.

Useful of not, feels very counterintuitive.

@didenko didenko closed this as completed Jun 5, 2020
@github-actions
Copy link

github-actions bot commented Feb 2, 2022

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 Feb 2, 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

2 participants