The following syntaxes work as expected (they create one spoiler tag).

The general rule here is that we allow 0-3 whitespaces before the starting colon, 3 or more colons, any number of optional whitespaces, and the “spoiler” keyword with any non-whitespace character after it.

Normal

::: spoiler spoiler
Hello!
:::
spoiler

Hello!


No whitespace

:::spoiler spoiler with no whitespace
Hello!
:::

spoiler with no whitespace

Hello!


Leading whitespace

   ::: spoiler title
Hello!
:::

title

Hello!


Any number of whitespaces between : and “spoiler”

:::              spoiler title
Hello!
:::

title

Hello!


Any number of whitespaces between “spoiler” and the first non-whitespace character

::: spoiler                 title
Hello!
:::

title

Hello!


Three or more colons

::::::::::::::::::::::::              spoiler title
Hello!
::::::::::::::::::::::::

title

Hello!



Here’s where we run into some weird edge cases:

If there is an ending :::, Lemmy will consume the first instance of ::: only if ::: is on a new line with no other text (and up to 3 white spaces)

::: spoiler a
text (no whitespaces before :::)
:::
a

text (no whitespaces before :::)


::: spoiler a
text (1 whitespaces before :::)
 :::
a

text (1 whitespaces before :::)


::: spoiler a
text (2 whitespaces before :::)
  :::
a

text (2 whitespaces before :::)


::: spoiler a
text (3 whitespaces before :::)
   :::
a

text (3 whitespaces before :::)


::: spoiler a
text (4 whitespaces before :::)
    :::
a

text (4 whitespaces before :::) :::



Lemmy doesn’t need an ::: ending in order to display the spoiler. If ::: is not present, it will assume the spoiler continues until the end:

::: spoiler a
::: spoiler a
text


Lemmy will create nested spoilers if it cannot find ::: before another ::: spoiler:

::: spoiler a
text
::: spoiler b
more text
a

text

b

more text



The following examples will show the ::: within the spoiler, and will make the spoilers nested

::: spoiler a
text (4 whitespaces before :::)
    :::
a

text (4 whitespaces before :::) :::


::: spoiler a
text:::
a

text:::


::: spoiler a
text :::
a

text :::


::: spoiler a
text
a:::
a

text a:::

  • darklightxiOPM
    link
    fedilink
    arrow-up
    1
    ·
    10 months ago

    Testing reply from inbox replies page using swipe gesture