Strict line breaks option doesn't work in the first paragraph of a callout with title

Steps to reproduce

In the sandbox vault:

  • Enable “Strict line breaks” option
  • Create a new file, and write down the following code
> [!note] title
> 
> foo
> bar
> 
> foo2
> bar2

Expected result

image

Actual result

image

Environment

SYSTEM INFO:
Obsidian version: v1.4.5
Installer version: v1.4.5
Operating system: Windows 10 Enterprise 10.0.19045
Login status: not logged in
Insider build toggle: off
Live preview: off
Legacy editor: off
Base theme: dark
Community theme: none
Snippets enabled: 0
Restricted mode: on

RECOMMENDATIONS:
none


Additional information

  1. An extra <br> tag cause this problem (it shouldn’t be there)

  1. A callout without title doesn’t have this issue, for example:
> [!note]
> 
> foo
> bar
> 
> foo2
> bar2
  1. This problem won’t occur if there is no empty line between the title and the first line of content:
> [!note] title
> foo
> bar
> 
> foo2
> bar2

Well, a title section is a short, concise description of a text body to follow.

A title isn’t meant to be a text body replacing the latter. The text body expands and explains in detail what the title describes.
Mixing both concepts and their order is confusing in a semantic and technical way.
Also, Markdown usually doesn’t break lines.

Sorry I didn’t catch your meaning.

I’m not talking about the concept of title and text, I’m reporting a bug.

And,

Also, Markdown usually doesn’t break lines.

It’s a matter of personal habit. For example, I use it with CSS snippets to show multiple images in a row:

(some paragraphs)

![[42-monostack-1.png]]
![[42-monostack-2.png]]

(some paragraphs)

Result:

This report should be a feature request, because “a matter of habit” is how you want markdown to behave, not how markdown normally behaves.

Exceptions to the rule are feature requests and additional code to write for a developer.

No, it is a bug.

How I use this feature is a matter of personal habit, but the feature itself is not a personal habit, it is the syntax included in the canonical John Gruber’s Markdown and the CommonMark, every markdown parser/renderer should obey it.

John Gruber’s Markdown

PARAGRAPHS AND LINE BREAKS

A paragraph is simply one or more consecutive lines of text, separated by one or more blank lines. (A blank line is any line that looks like a blank line — a line containing nothing but spaces or tabs is considered blank.) Normal paragraphs should not be indented with spaces or tabs.

The implication of the “one or more consecutive lines of text” rule is that Markdown supports “hard-wrapped” text paragraphs. This differs significantly from most other text-to-HTML formatters (including Movable Type’s “Convert Line Breaks” option) which translate every line break character in a paragraph into a <br> tag.

When you do want to insert a <br> break tag using Markdown, you end a line with two or more spaces, then type return.

Yes, this takes a tad more effort to create a <br>, but a simplistic “every line break is a <br>” rule wouldn’t work for Markdown. Markdown’s email-style blockquoting and multi-paragraph list items work best — and look better — when you format them with hard breaks.

CommonMark Spec

Now that I enable the “strict line break” option, the markdown parser/renderer should act like this:

  • A single line break → a space
  • A line break with two or more spaces → a <br> tag

The above rule(s) should apply everywhere, no matter in a normal paragraph or inside a callout block.

Reproduced on iPadOS in a restricted mode vault.

Thanks!