Quotes containing code block must start with newline

AI-generated summary

The discussion revolves around a bug where code blocks within quotes do not render correctly unless the quote starts with an extra newline. anon25879736 demonstrates that adding a blank line at the start of the quote resolves the issue. TechnoBear notes that even with an extra line, a single backtick before the code block can fix the formatting. cipher1 confirms the issue persists. gwwar identifies it as a core markdown parser bug and shares a PR. simon reports a regression, and riking and riking contribute further fixes, including a PR that addresses the issue after debugging a jQuery-related problem.

When including a quote with a code block, it will not render correctly unless the quote starts with an extra newline character. For example, the following will display correctly:

[quote="abarker"]
Sample quote 1, without any code.
[/quote]

However, insert a code block into the quote, and things will become problemeatic.

[quote="abarker"]
Sample quote 2, with a small code block.
```
n = 2;
```
This will not work
[/quote]

Then again, if you add an extra line break to the beginning of the quote, it starts working again:

[quote="abarker"]

Sample quote 3, with a small code block.
```
n = 2;
```
This will work
[/quote]
5 „Gefällt mir“

If the quote only consists of code, I’ve found adding an extra line has no effect to fix formatting. But inserting two backticks before the code block, and none after it, works.

A single backtick will fix the #, but shows up in the code.

Becomes

Testing fail condition for current status:

Appears to still be an issue.

1 „Gefällt mir“

Status check:

<hidden comment to get around the absurdly long 20 character limit that meta.d imposes.

This one was a pain to debug. I’ve included a workaround, but this is a core markdown parser bug and it should be revisited.

PR is ready here:
https://github.com/discourse/discourse/pull/3715

3 „Gefällt mir“

Dies scheint zurückgegangen zu sein. Wenn ein Code-Block zusammen mit einer Zeile Nicht-Code-Text zitiert wird, bleibt die Formatierung des Code-Blocks erhalten. Wird ein Code-Block allein zitiert, wird die Formatierung nicht beibehalten.

Ich habe ein Beispiel für das Problem hier gepostet: https://try.discourse.org/t/testing-issue-with-quoted-code-blocks/1401/2.

2 „Gefällt mir“

Klar, kannst du das @eviltrout zuweisen?

Es hat ein bisschen gedauert, den richtigen Ort für die Korrektur zu finden, aber hier geht’s los!

6 „Gefällt mir“

Etwas stimmt hier nicht, das Verhalten auf Meta entspricht nicht dem, was ich während der Entwicklung gesehen habe.

1 „Gefällt mir“

Habe es herausgefunden, jQuery hat mich reingelegt.

6 „Gefällt mir“