[Bug]: Nested markdown spoilers are not properly converted to HTML.
Requirements
- [x] Is this a bug report? For questions or discussions use https://lemmy.ml/c/lemmy_support or the matrix chat.
- [x] Did you check to see if this issue already exists?
- [x] Is this only a single bug? Do not put multiple bugs in one issue.
- [x] Do you agree to follow the rules in our Code of Conduct?
- [x] Is this a backend issue? Use the lemmy-ui repo for UI / frontend issues.
Summary
If I nest spoilers (Example: https://lemm.ee/post/57070209 ) they render correctly on the frontend, but they are not properly converted to html in the post's content field in the ActivityPub object. There is one details element, but inside of that is the raw markdown of the rest of the spoilers.
This is shown when viewing it in wafrn (tumblr-like fediverse client): https://app.wafrn.net/fediverse/post/bfa9c369-0fb5-425c-bb48-8f1f67a17910
Steps to Reproduce
- Make a post with nested spoilers.
- Try to view it in another fediverse software with support for the
detailsHTML tag.
Technical Details
The AP object for the mentioned post is:
{
"@context": [
"https://join-lemmy.org/context.json",
"https://www.w3.org/ns/activitystreams"
],
"type": "Page",
"id": "https://lemm.ee/post/57070209",
"attributedTo": "https://lemm.ee/u/Irelephant",
"to": [
"https://lemm.ee/c/irelephant",
"https://www.w3.org/ns/activitystreams#Public"
],
"name": "spoiler test",
"cc": [],
"content": "<details><summary>1</summary><p>\n::: spoiler 2\n::: spoiler 3\n::: spoiler 4\n::: spoiler 5\n::: spoiler 6\n::: spoiler 7\n::: spoiler 8\n</p></details>\n<p>This could probably be used to make a choose your own adventure game, provided your client can handle it.</p>\n",
"mediaType": "text/html",
"source": {
"content": "\n::: spoiler 1\n\n\n::: spoiler 2\n::: spoiler 3\n::: spoiler 4\n::: spoiler 5\n::: spoiler 6\n::: spoiler 7\n::: spoiler 8\n\n:::\n\n\nThis could probably be used to make a choose your own adventure game, provided your client can handle it.\n\n",
"mediaType": "text/markdown"
},
"attachment": [],
"sensitive": false,
"published": "2025-03-02T16:24:09.435762Z",
"language": {
"identifier": "en",
"name": "English"
},
"audience": "https://lemm.ee/c/irelephant",
"tag": [
{
"href": "https://lemm.ee/post/57070209",
"name": "#irelephant",
"type": "Hashtag"
}
]
}
The content field still contains some of the markdown formatting, which fediverse clients may not handle properly.
Version
BE: 0.19.11
Lemmy Instance URL
lemm.ee, lemmy.dbzer0.com
Sounds like a bug in markdown-it-block-spoiler.
cc @SleeplessOne1917
I'll test it in my markdown-it library and release a new version once fixed.