StackExchange / StackExchange/Stacks-Editor

Code block within spoiler gives different result than shown in preview

Open
#222 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
437
Forks
61
Avg merge
16h 2m
Merged PRs (30d)
8

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the markdown in the answer editor and compare the live preview with the result after posting or saving. Trace the answer editor's spoiler and code-block rendering paths; done when a code block inside a spoiler renders the same way in preview and in the saved answer.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.