Horizontal Rule "---" Sometimes Changes Text Size & Offers Folding, etc

Steps to reproduce

  1. Verify that “fold heading” is enabled in Obsidian’s “Editor” settings.
  2. Type some text on a blank line, do not give it a heading value (e.g. H1).
  3. Press enter to move down to the very next line. This only happens if there is no vertical space separating the text & the line below it containing the three sequential hyphens. The line in question must also not already be a header.
  4. On the new line you’re now on enter three sequential hyphens while observing the behavior in both the preview & edit displays. Obsidian does something slightly different after each hyphen. I’ll detail these below in the “Actual Result” section.

Expected result

I expected a horizontal rule to be rendered after entering the third hypen.

Actual result

After entering the first hyphen the line of text immediately above it will increase in size, in the preview only. Sometimes instead of this happening the first hyphen will be rendered a bullet without requiring a space after it.

After you enter the second hyphen you’re given the ability to fold the contents beneath that line & the size of the same text will now have increased in size in the editor similar to the preview.

After the third hyphen the preview will now properly show the horizontal rule & the size of the text will revert to normal, but the folding ability persists in the editor. Sometimes Obsidian will also require a “space” following the third hyphen before the horizontal rule will render.

Environment

  • Operating system: Windows 10
  • Obsidian version: 0.9.3

Additional information

The line above the hyphens seems to be being treated as a header after entering the second hyphen. If only “fold indent” is enabled the text will still increase in size, but you’ll not be be given the ability to fold.

I’m still fairly new to Markdown, but I don’t think this is intentional behavior. If I’m wrong I apologize.

In the screenshots attached I’m illustrating the behavior on the “see also:” line. The bullet behavior I described is later illustrated in the “source” line.





1 Like

This is not a bug at all. This is part of the markdown spec
it’s different way of defining an h2 header

cat
-

https://babelmark.github.io/?text=%23%23+h2+test h2+test - h2+test --- h2+test -----

1 Like

Thank you, I was afraid of that, but when I looked through Obsidian’s how to “format your notes”, I didn’t see it listed.

However now knowing that, it doesn’t explain all of the observed behavior.

  • One hyphen creates H2 size in the preview, but not the editor. Also with only one hyphen the editor does not allow you to fold it.
  • Three hyphens will sometimes render a horizontal rule in the preview window & the text will not be H2 size, but in the editor it will be rendered as H2 size.
    • Other times three hyphens will render the preceding line as H2 on both views & not display a horizontal rule.

Can you offer any clarity on what causes the first hyphen to sometimes create a bullet & others to make the preceding line an H2? It seems this happens if there are 2 or more lines of text without any separating space between them when the first hyphen is entered.

See the attached screenshot for self-documented examples of each of these.

1 Like

Use - - - for a horizontal rule, --- for a post header.
I know it’s an old thread, but thought it may be useful for some people

1 Like