Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code block within spoiler gives different result than shown in preview #222

Open
mbomb007 opened this issue Sep 13, 2022 · 2 comments
Open
Labels
bug Something isn't working

Comments

@mbomb007
Copy link

Describe the bug
A code block within a spoiler block gives a different result than shown when looking at the Markdown preview before posting/saving an answer.

To Reproduce

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

Screenshot is of this answer (it's currently deleted, because it's not yet working as expected)

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

Expected behavior

I would expect the result to look like the preview after posting/saving. I also think that being able to post a code block within a spoiler is useful on https://codegolf.stackexchange.com

Desktop (please complete the following information):

  • OS: Windows 10, 21H2
  • Browser: Chromium 105
@mbomb007 mbomb007 added the bug Something isn't working label Sep 13, 2022
@gparyani
Copy link

This isn't exactly a bug in the editor, but rather the fact that the server-side Markdown renderer doesn't support any type of block Markdown formatting in spoilers. The real fix here is to fix the server-side renderer so it supports block formatting in spoilers. In my view, that's unlikely to happen, as that issue has been reported for many years and never gotten any response from Stack Exchange indicating any intent to fix it, even as many duplicates of that issue have been posted over the years, some of which have been closed by Stack Exchange staff.

The only issue with the Stacks editor is that it incorrectly displays block Markdown formatting correctly, even though the server-side renderer doesn't support it. I do believe that there shouldn't be any discrepancy between the client-side preview and the server-side rendered post. Until such time as the server-side renderer supports block Markdown formatting, the Stacks editor shouldn't correctly display it since it won't be rendered on the server. Alternatively, it should use HTML formatting inside spoilers (since the server-side renderer does support HTML block formatting).

@mbomb007
Copy link
Author

Is it possible that spoilers could be made into a block element, like <spoiler></spoiler>?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants