When toggled closed, header is badly formatted if it contains a code fence at the end

Steps to reproduce

  1. Create a new note in editor mode
  2. Make a header with any number of #'s
  3. Insert a code fence with any content. Don’t add a new line after the code fence and make sure that nothing comes after the code fence.
  4. Collapse the header using the toggle button.

Expected result

In both editor and preview mode, the header should collapse everything under it up to the header of the same size or until the end of the page.

Actual result

When the header is collapsed (only in editor mode), it inherits the background of the code fence instead of keeping the normal background when it is not collapsed.

Photo of the non-collapsed header:

Photo of collapsed header:


  • Operating system: Windows 10
  • Obsidian version: v0.11.5
1 Like

A post was merged into an existing topic: When a header (or a list item) that contains a code block is folded, the format is wrong