I was wondering if there was any way of having a blockquote in the middle of a paragraph?
Sort of like this:
This is the beginning of a sentence, saying things—
> this is a blockquote
—this is then that sentence continued with a dash, then ended.
But it would always get rendered like this:
This is the beginning of a sentence, saying things—
> this is a blockquote
> —but the second part of that sentence unfortunately gets put inside the blockquote!
Unfortunately I don’t want the behaviour that putting in a new line does neither:
This is another sentence:
> this is another blockquote, which ends this paragraph.
This on the other hand is a new paragraph.
Is there any syntax that would allow me to have the second part of the sentence treated as a linebreak – which exits the blockquote – and not just as a linebreak in the blockquote?
If there isn’t, I also use Obsidian, so if someone could point me towards a plugin to do this that would be great too.
This is not possible. As a reminder, Markdown is a subset of HTML and is rendered as HTML. In fact, a look at the HTML spec shows that a blockquote is not allowed inside a paragraph element. In fact, the spec specifically states that the opening tag of a blockquote will automatically close the paragraph preceding it.
A
p
element's end tag can be omitted if thep
element is immediately followed by an...blockquote
... element...
Therefore, if Markdown would parse you source text as you desire, it would render the following (invalid) HTML:
<p>This is the beginning of a sentence, saying things—
<blockquote> this is a blockquote</blockquote>
—this is then that sentence continued with a dash, then ended.</p>
However, a browser/webview would parse and interpret that as this HTML (more or less):
<p>This is the beginning of a sentence, saying things—</p>
<blockquote> this is a blockquote</blockquote>
—this is then that sentence continued with a dash, then ended.<p></p>
Notice that the closing </p>
tag was inserted at the end of the first line. This is required behavior by the spec, as quoted above. Therefore, Markdown does not allow this behavior and always assumes that a blockquote ends the preceding paragraph.
Interestingly, the spec comments on this behavior in a Note (referencing lists not blockquotes, but the logic is the same). I have quoted the note below (without the examples).
List elements (in particular,
ol
andul
elements) cannot be children ofp
elements. When a sentence contains a bulleted list, therefore, one might wonder how it should be marked up.The solution is to realize that a paragraph, in HTML terms, is not a logical concept, but a structural one. In the fantastic example above, there are actually five paragraphs as defined by this specification: one before the list, one for each bullet, and one after the list.
Authors wishing to conveniently style such "logical" paragraphs consisting of multiple "structural" paragraphs can use the
div
element instead of thep
element.
While using a div
certainly works for HTML, there is not specific support for it in Markdown. Although, one could use raw HTML in their Markdown. But, that is not going to alter how the elements are rendered in a browser/webview and doesn't resolve the issue raised here. That is unless some custom CSS was also included. Maybe Obsidian have a mechanism/plugin for defining custom CSS?