Quote tags not on their own line -> breaks quote

I’ve noticed this when quoting others and I now I see it also happened to a fellow poster here:

For some reason, as soon as the “[quote]” tags are not on a line of their own, the quote breaks. Is this desired behavior or a bug?

I wouldn’t call it “desired behavior” but I think the formatting has to be that way so Discourse knows that it’s the beginning and end of a quote. Marc made a mistake by removing the line break before the closing tag (unless the WYSIWYG editor did that which would be a bug). Otherwise, a discussion like this about [quote] tags could have a different set of errors.

I don’t understand. I would have thought the “[/quote]” defines the end. Why should an additional CR be required?

I agree. I’m not sure what I did on that first one that messed it up, but I just replied to another post and I removed the CR (a habit from wanting my tags even) and it worked fine. The earlier message I’d replied to on my iPhone and the web page was a bit weird (i.e. hard to tell what I was editing). The second one I did on my Mac, so that could make a difference.

If “[/quote]” alone defined the end, then what I just wrote would have to be interpreted as the end of a quote containing “If.” It’s common for strings to be parsed line-by-line and for characters or particular strings to be treated differently when they’re preceded by a line break. For example, you can have text be styled as a quote by starting a new line with the greater-than character (>).

If there wasn’t a line break before the greater-than character I typed, this text wouldn’t be formatted as a quote.

Also, Discourse accepts posts by email and some email clients add line breaks. By requiring the square brackets of a quote tag to be preceded by and followed by a line break, it virtually eliminates the possibility that the author meant the string to be interpreted as anything other than a quote tag.

Well not really because that “quote” was never opened by the “[quote]” tag. But I see what you’re saying. I guess I’m just surprised since I know other forum software does not parse in this strict way. At least Discourse is consistent. It requires both the opening and the closing tag to be on their own lines. If either isn’t the whole quote breaks.

I did a little searching in the Discourse forum on this, and while I didn’t see anything specific, the discussions I found point to the fact that parsing in multiple formats and with direct entry text and email imports is just really squirrelly, so it’s best to keep things return-delimited when possible.

It was super easy for me (or you, if you noticed in time) to edit the post and add that CR back in to fix the quotes.

Thanks, Adam.