URL Scheme: direct navigation to heading

(Feature Request)

To open a file inside a vault, use the format:
obsidian://vault/vaultname/path/to/file
obsidian:///absolute/path/to/file (mac)
obsidian:///C:\path\to\file (win)

Not sure if it is already supported by the above but I need a direct navigate to a heading within a note, such as in

  • obsidian://vault/vaultname/path/to/file#headingtitle
  • obsidian:///absolute/path/to/file#headingtitle (mac)
  • obsidian:///C:\path\to\file#headingtitle (win)

–EDITS–
somewhat related request
Menu option to copy "obsidian:" link to the clipboard - #2 by GreenFlux

21 Likes

Can you provide a use case for this? I wonder what diverts you from relative links…

1 Like

+1, this gets my vote! I could see this being useful for future automations/integrations with text expanders.

It would simplify programming the routine if the Obsidian link not only opened the file, but also set the cursor position and/or active selection. Then you’re just one step away from pasting in a value from the clipboard or a variable from a text expander.

2 Likes

My use on any notes with heading/subheadings esp long documents:

mega note
Pointing and opening to a heading out of a sea of headings/subheadings, avoiding hunt down by using Outline pane. After clicked, the page opens and auto scrolls to the position of heading targeted.

–EDITS–
Please help me understand “relative links” and usage. Perhaps a good instant alternative solution.

Do you want to link from within obsidian or from outside obsidian?

The URL scheme use case is for the latter (and I dont know if direct linking to a specified heading is possible with that).

But if you just want to link to a specified heading from within obsidian, that is from one note to another note, you don’t need the URL scheme. Just start by typing [[, then the first letters of the note you want to link to. Obsidian will give you a couple of propositions that match your first letters. Navigate to the note you want to link to (using arrow-down key), then press # - obsidian will show you all the headings within this note. Just chose one and it will be directly linked!

The link will be “relative” - means: not containing the absolute path on your OS, but just [[notetitle#heading]], or [[obsidian-subfolder/notetitle#heading]]

1 Like

Please see the explanation by @alltagsverstand above.

Thanks a bunch! I did not realize Obsidian had this feature.

You explained well on relative links for internal linking.

But URL Scheme external linking is what this request trying to ride on, as added in the request title from its beginning.

2 Likes

I apologize for trying to offer my help…

Yeah, I read the title - but after reading your second post, including your question what “relative links” mean, I wasn’t quite sure if the meaning of URL scheme was clear or if, instead, you were just trying to establish internal links between your notes…

This would be super useful. And also having the ability to right click on a heading in a note and to copy the obsidian URL directly to that heading.

Usecase: setting up ‘deep links’ between my various vaults

6 Likes

For URL Scheme: I’m curious what would happen with #headingtitle conflicts i.e. if one note has 2 identical #headingtitles.

(Ideally we should probably avoid using identical #headingtitles but mistakes happen.) Maybe the URL scheme can default to navigating to the first #headingtitle but highlighting both just so we can see that there are multiple.

Optionally: maybe the user could choose to create a URL for block as opposed to the #headingtitle. Advantage: no name conflict. Disadvantage: URL is less readable, just a long number.

1 Like

Q: re: linking to specific section in notes

Is there a way to create a link to a specific place in a markdown document in obsidian? eg Obsidian has ‘copy obsidian url’ for a specific note, but what if i want a url to go to a specific header?

We already have:
obsidian://open?vault=Notes&file=xxzz.md

Can we get something like this?
obsidian://open?vault=Notes&file=xxzz.md#myheader

Use case:

I want to add a link to the specific note and location (sub header) to my task manager.

When I come back to the task in my task manager, I want to click the link which will open the file in obsidian, but I want it to go to the specific header, which will provide the context in which I captured the task.

4 Likes

Does anyone know when feature requests get reviewed/evaluated and prioritized?

Checking back in on this.

Is there a feature review cycle for requests like this?

1 Like

I’m also interested in this, I thought this would work already…


Another use case:

I have my task lists inside Obsidian as list items, and some of the tasks have due dates.
I’m working on syncing these to my Google Calendar.

Once I get the calendar syncing to work, it would be nice to have a link in the calendar event, which would take me straight to the task item, using a block reference.

So, the URI in the calendar event would look something like (possibly with URI encoding for # and ^):
obsidian://open?vault=VaultName&file=FileName#^block-reference-id

Or with the shorthand URIs (which are much nicer):
obsidian://vault/VaultName/FileName#^block-reference-id

Vice versa, the task item in Obsidian would have a URL to the synced event in Google Calendar.


EDIT:
I’ll probably use a search URI at first, but it’s not nearly as nice:
obsidian://search?vault=VaultName&query=^block-reference-id

3 Likes

I like the idea of a search UI. How has this been working for you? Sufficient or still lacking a particular functionality? Additional friction (extra clicks / context switching / etc)?

It’s been working okay, it’s basically one extra click, since you need to click the top search result, instead of the file opening automatically in Obsidian.

Also, Google Calendar only supports web URLs (http:// and https://), so I had to write a small “proxy” web app. Google Calendar opens the “proxy” app, and it opens the obsidian:// URI using JavaScript. This also causes an extra click, because the browser (Chrome) doesn’t allow the “proxy” tab to close itself automatically (might be possible with a browser extension, but too much effort for the minor gain).

So, it’s 3 clicks: link, search result, close tab. It could be one click less, if Obsidian supported direct navigation to headings / block references.

2 Likes

I’d also love to see this.

My use case:
I use the Obsidian_To_Anki plugin for uni notes. The created cards automatically contain a link to the notes in which they were defined, but I have an extra note (per lecture) just for the anki cards. Optimally, I’d like to be able to directly link to the topic (header) in the real note to quickly read up on something I don’t get right aways by just looking at the card.

Right now, Obsidian opens, but with the message

File “Note#Header” not found.

1 Like

I didn’t read the whole discussion, but I think the Advanced-URI plugin should help you. It supports navigating (and writing) to specific headings via the heading parameter.

3 Likes

The Advanced-URI plugin does indeed work, but it would stil be nice if the native obsidian:// URL Scheme supported either of

  • obsidian://open?vault=Foo&file=Bar#Baz
  • obsidian://open?vault=Foo&file=Bar&header=Baz
2 Likes