Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions packages/obsidian/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 <p>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
<p> 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 {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really think the long comment is necessary. One sentance or no comment at all should suffice. Also I wonder, why you did not use .mb-view-inline > div.mb-view-wrapper.mb-view-markdown > p instead of :not(.mb-view-block) > .... Same applies on line 76.

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;
Expand Down