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)

5 Likes