zwbetz-gh / cupper-hugo-theme

An accessibility-friendly Hugo theme, ported from the original Cupper project.
https://cupper-hugo-theme.netlify.app/
MIT License
301 stars 190 forks source link

Multiple expandable shortcodes do not work if they have the same inner text #36

Closed zwbetz-gh closed 4 years ago

zwbetz-gh commented 4 years ago

Received the following email from a user. Making this into an issue because it is indeed an issue.

Hello again.

I hope you are doing well. (cannot be taken for granted in these times)

I think there MIGHT be a little bug in Cupper

Using 2 or more expandables in one markdown document will result in chaos.
click on  the second one will open the first one and whatnot...

{{< expandable label="A section of dummy text" level="1" >}}
Here is some markdown including [a link](https://twitter.com/heydonworks). Donec erat est, feugiat a est sed, aliquet pharetra ipsum. Vivamus in arcu leo. Praesent feugiat, purus a molestie ultrices, libero massa iaculis ante, sit amet accumsan leo eros vel ligula.
{{< /expandable >}}

{{< expandable label="A second section of dummy text" level="2" >}}
Here is some markdown including [a link](https://twitter.com/heydonworks). Donec erat est, feugiat a est sed, aliquet pharetra ipsum. Vivamus in arcu leo. Praesent feugiat, purus a molestie ultrices, libero massa iaculis ante, sit amet accumsan leo eros vel ligula.
{{< /expandable >}}

Or is it me, who has a misunderstanding?

greetings from way to hot Germany!
Elmar
zwbetz-gh commented 4 years ago

fixed in https://github.com/zwbetz-gh/cupper-hugo-theme/commit/10ae1fcf36919371eabf9a458015c5c25aba602a

zwbetz-gh commented 4 years ago

Sample post to test the bug fix https://cupper-hugo-theme.netlify.app/multiple-expandable-test/