Link to specific line

Use case or problem

Similar to the request here, I’d like to link to a specific line or block within a note.

The reason I am opening a new request is I’d like to enable this without explicitly adding block ids. The primary use case is for plugins like Dataview and Tasks that dynamically generate lists based on note content. Enabling these lists to link to a specific line within a note means it will be easier to quickly navigate to and edit an outstanding task, for example.

Proposed solution

I see two options:

  • Enable Linking directly to a line like [[notefile#36]]
  • Dynamically generate IDs for every block, return these IDs when calling the MetadataCache

I don’t believe that long-lived block ids are required here - this content is dynamically generated and should be trusted to establish a relationship to a line or block during collection of the content for its lists.

Enabling linking to a specific line seems like a good compromise - we can link with Note-level granularity today, so if the line number winds up out of sync, it isn’t the end of the world.

I expect that dynamic generation of IDs would require significantly more work and require those IDs to be stored somewhere, so this option sounds less attractive.

Current workaround (optional)

Linking to the overall Note or the nearest header rather than the specific line/task/block.

Related feature requests (optional)

13 Likes

Has any progress been made on this?

2 Likes

Hello everyone, I would like to know if a block id could be added programmatically to a list of tasks, my goal is to have a suggester based on a list of open task, when I select a task from suggester a link at cursor is placed pointing to the selected task which needs a unique id if not present yet.

The point is the Task JS model has a writable property for the id ?

Thanks