This seems like the key post talking about this issue:
I think I agree with that for [quote], because [quote] affects the entire block of text; it’s nonsensical to start a quote in the middle of a non-quote line.
But there’s nothing terrible about that for [spoiler]. An exception should be made for inline multi-line spoilers.
There already appears to be some special case code. Consider these examples:
I’ve filed a separate bug about the preview. The editor and the post result should never differ in that way, right?
“Broken HTML” is a rather philosophical idea. The HTML5 parsing spec explains in detail how user agents are supposed to render unbalanced tags like this: <b>bold <i>bold italic</b> italic</i>
It’s supposed to render like this: bold bold italic italic. “Normalizing” the HTML by ending the </b> without reopening the <i> is not correct behavior for HTML. I claim that it’s not what HTML users would expect it to do, nor is it desirable.
The validator will tell me that it’s invalid, and the spec makes it clear how it should render: the second paragraph should be bolded. This is what it means to be HTML; it’s specified behavior in response to invalid HTML.
More generally, the HTML parsing spec makes it clear that invalid HTML isn’t “broken.” It’s “invalid,” but it has a specified rendering output, and Discourse is not following it for <b> tags. Despite that, Discourse should follow that for <b> tags, and it should use the same behavior for BBCode.
For comparison, consider XML. XML’s specified behavior is to render nothing when the document contains unbalanced tags. Unbalanced XML tags are broken.
Unbalanced HTML tags render exactly the same way in all browsers. Unbalanced HTML tags are “invalid” but not broken.
P.S. I’ve discovered that I can use <blockquote> instead of [quote] and get back great-looking one-line quotations.
[quote]this is broken[/quote]
<blockquote>but this works great</blockquote>
but this works great
But I still don’t really care about [quote]. I care about spoilers.