mProjectsCode / obsidian-meta-bind-plugin

A plugin for Obsidian to make your notes interactive with inline input fields, metadata displays, and buttons.
https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/
GNU General Public License v3.0
534 stars 42 forks source link

Allow "Open link" button types to navigate to sections within current note without need for stating note name explicitly #450

Closed hdsateyate closed 3 days ago

hdsateyate commented 2 weeks ago

Please fill out these Check-boxes

Is your Feature Request related to a Problem or Annoyance?

At the moment the "Open link" button does not allow navigation within the current note in the way you would navigate by clicking [[#Section]]

Describe the Feature you'd like

Allow "Open link" button type to navigate to section within current note without specifying the note name (such that it can be used in a template without needing to reference the note name).

Alternatives

N/A

Additional Context

What I am currently doing alongside my other buttons is writing a section of plain markdown which renders as clickable links but I would prefer for them all to be buttons:

image image
mProjectsCode commented 2 weeks ago

This seems like an oversight on my part, as it works with normal wiki links but not with the open action. I will investigate.

mProjectsCode commented 2 weeks ago

Links to headings like [[#heading]] work, but sections like [[#^section-id]] do not.

mProjectsCode commented 2 weeks ago

After a small fix to the markdown link parser to support section links, the following examples both work.

label: Scroll to Bottom
style: default
actions:
  - type: open
    link: "[[#This is a Heading at the Bottom]]"
    newTab: false
label: Scroll to Labeled Section
style: default
actions:
  - type: open
    link: "[[#^section-1]]"
    newTab: false
hdsateyate commented 2 weeks ago

Apologies, I did not test carefully enough on 1.2.5. It does indeed work fine for my purposes (headings only) with 1.2.5. I was on an earlier version where it wasn't working.

Many thanks for your work on this plugin. I press one of your buttons probably 50+ times a day.