"Embed" a note's outline

Obsidian has no syntax to embed a note’s outline, but a simple embedded search can list a note’s headings, and you can click or tap to visit them.

To list all the headings of a note named “Example”:

~~~query
File:"Example" "## "
~~~

That searches (in the specified file) for 2 # followed by a space, which matches the end of any heading marker except a level 1 (which is commonly only used for the document title). (It could match other things too, but it’s unlikely.)

You can filter out subheadings by using a regular expression.

To show only level 2 and 3 headings:

~~~query
File:"Example" /^###? /
~~~

Or only level 2:

~~~query
File:"Example" /^## /
~~~

The regular expressions mean:

  1. “Starting at the beginning of the line (^), 2#, optionally followed by another # (#?), followed by a space”.
  2. “Starting at the beginning of the line (^), 2# followed by a space”.

By default, embedded searches look like the sidebar search widget, including a yellow highlight on all matched text. I use CSS snippets to make it look more like normal text, as seen in my screenshots (the amber color is from an unrelated CSS snippet).

10 Likes