bowman2001 / perplex

A Hugo theme to publish technical content (docs, news, blog, articles)
https://perplex.desider.at
Apache License 2.0
27 stars 11 forks source link

Using p-first attribute results in invalid p inside a p #129

Closed danielfdickinson closed 9 months ago

danielfdickinson commented 9 months ago

First what you get:

<p><p class="p-first">Princes and Madmen is an open-source website built using an open-source theme
and software. There are no other mandatory software requirements, but the
site, theme, and the theme&rsquos documentation ship with external software and
content.</p>
</p>

and the source markdown:

Princes and Madmen is an open-source website built using an open-source theme
and software. There are no other mandatory software requirements, but the
site, theme, and the theme's documentation ship with external software and
content.
{.p-first} <!--more-->

Moving the <!--more--> onto its own line does not help.

Shifting the {.p-first} onto the same line as the last line of the paragraph resolves the issue.

It may be relevant that I have hard breaks sets to false (your default for the documentation site is true).

danielfdickinson commented 9 months ago

Doh! My workaround just means the attribute is displayed as text with the paragraph instead of attached to a paragraph.

My WIP site which exhibits the error is here: https://gitlab.com/danielfdickinson/pp-princesandmadmen

danielfdickinson commented 9 months ago

Ok, I've figured that this occurs for the 'cards' which are created for things like the 'tags' taxonomy page and the list of 'recent contributions' on the author page.

danielfdickinson commented 9 months ago

Found the root cause. In https://github.com/bowman2001/perplex/blob/2de96ee032c4e58ad2ad248b6b1280f4d279b21a/layouts/partials/wrap-p.html#L1 you search for <p> but with a .p-first attribute one has <p class="p-first"> which fails the check.

I think it ought to be possible and simply check for </p> instead. If that works even when minifying, I will do up a fix. Otherwise need a findRE experession.