Live preview: Better support for Setext style Markdown headers

I use Obsidian because it most fully supports Markdown of any tools that claim to support Markdown and that can be used for keeping notes and tracking tasks. Other tools which allow Markdown-based input but don’t save Markdown miss the point, in my opinion. Obsidian, because it saves everything in Markdown, is not merely superficially supporting Markdown, and therefore is the sort of tool I want to use. However there are some gaps in this support.

One gap is the support for Setext style headers—first and second-level headers with equals signs and hyphens to form a visual underline. I prefer to use the Setext style headers in my Markdown because it best fulfills the stated goal of Markdown to visually represent the same intended formatting when viewed as plain text as when viewed as rendered HTML. Most of my old Markdown files use the Setext headers, but when I bring them into Obsidian I must manually change all of them to have a pleasantly displayed page, which is not ideal, both because of the tedium of manually changing them and because I would much prefer to use my preferred header style going forward.

It seems clear that Obsidian intends to support Setext headers, because the header text is styled properly, but the equals signs (or hyphens) remain visible, which doesn’t look good at all. The equals signs and hyphens—which no longer match the size of the header text (because the text is now larger) look terribly out of place on the page. (If there are one or two equals signs, they are large like the header, but as soon as the third equals sign is entered they shrink in size. If they remained large no matter how many there were, they would at least match in size for monospaced fonts.) Since Obsidian handles multi-line formatting smoothly for other things, like code blocks for example, it doesn’t seem like there’s any reason in principle that Setext headers should leave visible artifacts on the page when rendered. It would be very helpful if the equals signs and hyphens were only visible when on the 2 lines that pertain to the headers, and invisible at other times.

Steps to reproduce

  1. Type “Foobar” and a carriage return
  2. Type 6 equals signs and a carriage return

Expected result

I should see a styled header but no formatting artifacts.

Actual result

I see a styled header plus 6 equals signs, which look very odd on the page.

Environment

  • Operating system:
  • Debug info:

SYSTEM INFO:
Obsidian version: v0.15.9
Installer version: v0.15.9
Operating system: Darwin Kernel Version 21.6.0: Wed Aug 10 14:28:35 PDT 2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T8101 21.6.0
Login status: not logged in
Insider build toggle: off
Live preview: on
Legacy editor: off
Base theme: dark
Community theme: none
Snippets enabled: 0
Restricted mode: on

RECOMMENDATIONS:
none


Additional information

Thanks!

1 Like

moved to FR.

I would also like this feature.

It should be noted that this style of heading is part of GitHub’s Markdown spec. The spec also states that

The underlining can be any length:

Therefore both of these are valid:

Foo
-------------------------

Foo
=
1 Like