Skip to content

editor: heading & list folding#3962

Merged
tvanderstad merged 3 commits intomasterfrom
code-folding
Nov 16, 2025
Merged

editor: heading & list folding#3962
tvanderstad merged 3 commits intomasterfrom
code-folding

Conversation

@tvanderstad
Copy link
Copy Markdown
Contributor

@tvanderstad tvanderstad commented Nov 16, 2025

This PR implements Bear-style heading & list folding using invisible HTML tags that match Bear's. The state of folding in the document is persisted in the document itself, with the following pros & cons:

pros:

  • fold state is persisted for no additional complexity
  • fold state is invisible to markdown renderers
  • copy & paste preserves state even from lockbook to bear and back (2nd video demo below)
  • undo applies to fold changes in case something unexpected happens

cons:

  • fold state is not invisible to markdown editors, shows up as inline HTML in Obsidian (screenshot below)
  • affects suggested docs & activity
  • incurs network overhead
  • fold state is synced across users
  • requires write access to a document to use
fold-demo.mov
fold-bear-interop.mov
image

fixes: #3934

There's some kind of funkiness with the selection - when folding an element, if the cursor is below the element, the editor will scroll to the cursor.

@Parth
Copy link
Copy Markdown
Member

Parth commented Nov 16, 2025

for your convenience fixes: #3934

@tvanderstad tvanderstad merged commit 7910353 into master Nov 16, 2025
1 check passed
@tvanderstad tvanderstad deleted the code-folding branch November 16, 2025 03:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

foldable sections

2 participants