Feature request: treat horizontal rules as folding section boundaries

The addition of folding for headings and outlines is great. I also sometimes organize chunks of notes by breaking them up with horizontal rules (---/***), however, and I really wish folding took these into account. I would expect each HR to delimit a folding boundary at the same level as the nearest section heading under which it lives (a level-1 fold if the only heading above it is an H1, a level-2 fold if the nearest heading above is an H2, etc.). Simply treating them as a barrier where “folding never goes past the next (or previous) HR” is also potentially reasonable. I would want triggering the “fold” command in a span with no headings but between two HRs to fold away the content between those HRs.


I second this suggestion. Right now to make clean delineation between a section and the notes after it, I have to make a fake section and call it something like “next” or “other”. It would be nice to be able to use horizontal lines to indicate that the section has ended and the next notes don’t belong to the previous group.

Mochi notecards basically does this with horizontal rule, treating them as representing endless sides of a flashcard. The app is a clever mix between anki spaced repetition and a PKM wity relational links and tags and decks. Good idea for an app, but kinda buggy electron app.

Horizontal rule is already in bear. Op is talking about using hr tag to delimit folding sections

Yes, that’s what I was talking about as well. If you fold a section even with a horizontal line, the horizontal line disappears along with all the notes below it … until the next section of (at least) the same heading level. To avoid this, I have to make a fake ‘other’ section so that when I fold the above section, only the set of notes above the fake section are folded (see pictures below). Having horizontal rule ‘declare’ an end of the section will alleviate this unnecessary and rather unsightly step with a bunch of meaningless ‘next’ sections. Hope I have explained what I meant properly now.

Let’s pretend I have this note

Now I have to add an Other section if I want the notes below the line to remain visible when I fold the subsection

I support this suggestion.

+1 from me. A hr is an even stronger separator than a h1 in my usage.

Another workaround for now is to insert an empty heading (instead of calling it Other) to break folding.

Just type ## space return (or whatever heading level you want). it will leave some vertical space, but is otherwise invisible on export and print.

1 Like

I would be confused to see how toc changes without typing anything in the editor but just folding.

Actually combining folding and a separator is somehow absurd: a separator is not an element of a hierarchical structure like a toc or nested bullet lists are. Because of that folding by separator has an arbitrary and paradox charakter.

This is a marvelous hack! Thank you for this idea :slight_smile:

FWIW, NotePlan had this same issue come up and came up with the idea of allowing horizontal dividers in headings, which allows explicitly specifying their folding hierarchy level:

I’d love to see this in Bear

I do not want to be a grinch but that feature doesn‘t make sense at all in regard How it is achieved. Folding a header is related to the content under a header. A divider is part of this content. That feature to stop folding just until divider breaks the actual meaning of the fold feature. Further more it may go against some users expectations who do not like that behaviour

Maybe I do not understand correctly your suggested feature but what I would use is a heading plus three dashes e.g. ## --- as a quasi-separator (I would also see --- in TOC and could quickly switch to “next thread” even if I would see more similar separators in TOC. I could expand/fold by that heading etc. I would probably use H6 heading for that use as I use H6 for similar technical use (e.g. for linking to specific part of the text). I understand that I would not see a full line, but only three dashes, but it would be ok for me (If I would need more, I would write more dashes)

I think you’re misunderstanding what they have settled on for NotePlan. You don’t fold the new header containing a horizontal divider, you fold something above that, and this is just a scheme for making the folding stop.

So previously you might have:

# Heading 1
## Heading 2


More text

# Heading 3

and folding either Heading 1 or Heading 2 would swallow everything up to Heading 3.

The proposal is that the exact above Markdown would still behave exactly as it currently does, but you could also write:

# Heading 1
## Heading 2

## ---

More text

# Heading 3

and in this case, folding of Heading 2 would stop at the horizontal divider (which is now inside an H2). The divider could also be inside an H1 (# ---) to stop even folding of Heading 1, but it’s controllable.

You can already do this in Bear, and it behaves exactly this way. The only limitation is that the rendering is poor – since standard Markdown doesn’t allow dividers within a heading like this, you just get the literal text “—” in a large, bold heading font. If instead this were supported as an extension, that same thing could be rendered as a horizontal divider.

That is what I mean: the divider gets a meaning which actually it doesn‘t have. As the separator is part of the text I expect it to be folded too. I am not sure how exactly that feature should work but I think it would also lead either to inconsistency with table of content or to an overcompensate interplay. If I miss something so sorry :wink:

What about inserting an empty heading? …

1 Like

What about inserting an empty heading?

Yes, you can do that, this is just taking that idiom one step further and allowing it to be more “native” and not need an extra (tall) line with the empty heading.