Export PDF causes infinite loop if there are recursive note embeds

Steps to reproduce

  1. Create a note called Note.md
  2. Write ![[Note]] inside the new note
  3. Open the command palette
  4. Select “Export to PDF”
  5. Use the default options

If you have any cycles this bug occurs, eg via mutual recursion.

Expected result

This is a tricky one. I think the best behaviour is that whenever a note is embedded inside itself (any number of layers deep), it should replace the embedding with a link. This is what zoni/obsidian-export does.

Actual result

Result: Obsidian freezes, using 100% of a single core with rapidly increasing memory usage (presumably as it’s constructing an infinitely long PDF).

Environment

  • Operating system: Arch Linux
  • Obsidian version: v0.11.13