Syntex for URL scheme to jump to LineNumber

What to augment to the obsidian://open?vault=Vault_name&file=Note_name pattern to jump to a certain line number in the file as specified?

I have the following Vim function to jump to the corresponding entry in Obsidian. It works on Windows for Gvim. Recently, I found a need to jump to a specific line when opening the note in Obsidian.

function! OpenFileinObsidian()
    " Source for the expand command: https://vim.fandom.com/wiki/Get_the_name_of_the_current_file
    let filename = expand("%:t:r")
    let foldername = expand('%:p:h:t')
    let composed_HTML_schema = "obsidian://open?vault=".foldername."&file=".filename.".md"
    " echo composed_HTML_schema "Toggl this line for debugging
    exe '!start /MIN cmd /c "start "" "' . composed_HTML_schema '"'
        " Note, the closing double quote is important to include.
        " `start "" "command"` is for cmd, which executes the command bit
endfunc

Until now, I don’t see a clear documentation for the URL scheme. The best reference I found is this post where URL scheme was proposed as a feature. It helps to have a pointer to a standalone documentation page for URL scheme as well.

Thanks in advance :slight_smile:

1 Like

The documentation for the URI scheme is here: URI protocol documentation. Currently, there is no page= attribute available.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.