How to best handle imported spoilers with blank lines?

סיכום מבוסס בינה מלאכותית

In a discussion about handling imported spoilers with blank lines during a phpBB3-to-Discourse migration, Dannii reports that the discourse-spoiler-alert plugin fails to detect multi-line spoilers containing blank lines. They consider converting [spoiler] tags to [details="Spoiler"] or using the “ruby-bbcode-to-md” import option, though the latter doesn’t support [spoiler]. zogstrip initially notes that multi-line spoilers work, but Dannii clarifies the issue specifically involves blank lines within the spoiler block. gerhard explains that blank lines inside [spoiler] tags are supported only if the [spoiler] and [/spoiler] tags each occupy their own line — demonstrated with a working example. Dannii confirms understanding and notes that similar formatting rules apply to [code] tags, meaning both will require rewriting to comply with Discourse’s parsing rules. The thread highlights a formatting nuance in Discourse’s BBCode handling: tags must be isolated on their own lines to properly parse content with internal blank lines.

I’m migrating a phpBB3 forum, and have a lot of posts using [spoiler] tags. I’ve tired the discourse-spoiler-alert plugin, but it doesn’t detect multi-line spoilers with blank lines. Is there a way to make it do that, or is there a way to transform [spoiler] into [details="Spoiler"]?

I haven’t tried the “ruby-bbcode-to-md” import option yet. I might try that when I test the migration again. Actually, looks like it doesn’t support [spoiler] anyway.

Do you have specific examples? Because [spoiler] works with multilines

And they lived [spoiler] happilly
ever after
[/spoiler] :heart:

And they lived happilly
ever after
:heart:

Sorry, it’s multi-line with blank lines. Here’s an example of a post with working and non-working spoiler tags:

http://leaflet.iftechfoundation.org/t/cragne-manor-complete-guide-and-walkthrough/14020/22 (test server, won’t last forever)

Blank lines inside the spoiler tag work as long as you make sure that the BBCode tags are on new lines.

[spoiler]
foo

bar
[/spoiler]

foo

bar

Ah, okay, thanks for clearing that up. I’ve noticed that [code] also won’t work if it isn’t on a line by itself, so I’ll have to rewrite both.