Background: I'm using the opt-in beta for the new editor.

When using the following markdown in the answer editor:

>! ```python
>! if True:
>!     print "Hello World"
>! ```

It shows this result when viewing the preview during editing (with the multi-line code):

Screenshot showing markdown and result when editing an answer

The screenshot is of this answer (it's currently deleted, because it's not yet working as expected), as it actually shows up all on one line, like this:

python ! if True: ! print "Hello World" !

Note: The markdown only shows as shown in the screenshot when editing an answer and viewing the live markdown preview/result (WYSIWYG), not when editing a question.

Related question: Formatted code block within spoiler tag?

I submitted a GitHub issue

  • Spoilers don't support block Markdown formatting. This is, strictly speaking, a bug with the editor, since it shows the block correctly when it's not supported. As a temporary workaround, you can use HTML <pre><code> blocks. Sep 14, 2022 at 3:25
  • 1
    No, this is a bug in spoilers. Sep 14, 2022 at 5:08
  • @SonictheAnonymousHedgehog That link is related to the old editor. The new markdown editor shouldn't require hacky workarounds or HTML.
    – mbomb007
    Sep 14, 2022 at 13:49
  • The same server-side renderer is used regardless of the editor you're using. Both send the raw Markdown to the server, which then renders the post. The issue here, technically speaking, is that the client-side renderer in the new editor is correctly rendering block formatting in spoilers, even though the server-side renderer doesn't support it. Even the old editor has some other bugs where the client preview is different from the actual post as rendered server-side. Sep 14, 2022 at 20:23


You must log in to answer this question.

Browse other questions tagged .