From 479b79f41cdb8fe3e28a455c70210ea93c43be85 Mon Sep 17 00:00:00 2001 From: Nelson Love Date: Fri, 14 Aug 2026 03:35:29 -0400 Subject: [PATCH] fix(view): don't collapse paragraphs in a block view field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A view field already tags itself `mb-view-inline` or `mb-view-block` from `renderChildType`, but styles.css never referenced either class: the inline rules applied unconditionally. So a block view rendering multi-paragraph markdown had its

elements forced to `display: inline-block` with zero margin inside an `inline` wrapper, and two paragraphs ran together on one line. Collapsing is right for an inline view — it sits inside a sentence and must not introduce block flow. It is wrong for a block view, which has a line of its own, and there it silently destroys the author's paragraph breaks. Note which element carries which class: ViewFieldMountable puts mb-view-block / mb-view-inline on `targetEl`, and mb-view-wrapper on the child div it creates inside it, which is also the element TextVF marks mb-view-markdown. The mode therefore has to be matched on the parent — a `.mb-view-wrapper.mb-view-block` selector matches nothing. Scoped `:not(.mb-view-block) > …` so the inline case is unchanged, a block view inherits Obsidian's own

styling rather than being counter-styled, and a wrapper with no mode class (JsViewFieldMountable) keeps what it had. Reproduce: a note property holding two paragraphs, rendered with `VIEW[{prop}][text(renderMarkdown)]` in a ```meta-bind block — the blank line between them disappears. --- packages/obsidian/src/styles.css | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/packages/obsidian/src/styles.css b/packages/obsidian/src/styles.css index 23c18248..5bf33bee 100644 --- a/packages/obsidian/src/styles.css +++ b/packages/obsidian/src/styles.css @@ -55,15 +55,32 @@ span.cm-inline-code.mb-inline-widget-rendered { margin: 0; } -div.mb-view-wrapper.mb-view-markdown > p { +/* An inline view sits inside a sentence, so its rendered markdown must not + introduce block flow — hence the collapsed paragraphs below. A block view has + a line of its own, and collapsing there destroys the author's paragraph + breaks: two

s become one run of text. + + Note which element carries which class. ViewFieldMountable puts + mb-view-block / mb-view-inline on targetEl, and mb-view-wrapper on the child + div it creates inside it; TextVF adds mb-view-markdown to that same child. + So the mode has to be matched on the PARENT, not on the wrapper itself. + + Written as :not(.mb-view-block) > … so a block view inherits Obsidian's own +

styling untouched, and every other case — including a wrapper with no + mode class, e.g. JsViewFieldMountable — keeps exactly what it had. */ +:not(.mb-view-block) > div.mb-view-wrapper.mb-view-markdown > p { margin: 0; display: inline-block; } -div.mb-view-wrapper { +:not(.mb-view-block) > div.mb-view-wrapper { display: inline; } +.mb-view-block > div.mb-view-wrapper { + display: block; +} + .mb-button.mb-button { background-color: transparent; border: none;