obsidian-meta-bind-plugin icon indicating copy to clipboard operation
obsidian-meta-bind-plugin copied to clipboard

allow realtive offsets for line numbers

Open mProjectsCode opened this issue 2 years ago • 3 comments

mProjectsCode avatar Apr 09 '24 23:04 mProjectsCode

I'm dying for this feature in my notes :P While looking for a workaround, I came across other options that have been discussed here and elsewhere that would be good to have:

  • prepend note
  • append note
  • targetted lines relative to the current line (perhaps 0 replaces the current line, -1 would be the line above the button, and 1 would be the one below?)
  • specific numerical line in a note (exists)

Tejeev avatar Jun 05 '24 20:06 Tejeev

Alright, so the current design plan would allow for very simple expressions (for line numbers in button actions) like the following:

  • selfStart
  • selfEnd + 1
  • fileStart-15
  • fileEnd +7
  • 4

Simple numbers are still allowed, but on top of that simple addition and subtraction where the left-hand operand is a relative number and the right-hand operand is a user-specified number. Just a relative number should also be possible.

selfStart and selfEnd refer to the beginning of the button block (only for code block buttons) according to the markdown post processor section info. If the info is not available, the action should error when run.

fileStart and fileEnd refer to line 1 and the final line respectively.

Possibly frontmatterStart and frontmatterEnd for frontmatter offsets, defaulting to fileStart if not available (e.g. due to no frontmatter being present in the note).

mProjectsCode avatar Jul 05 '24 13:07 mProjectsCode

i really need this.

DZL1943 avatar Sep 11 '24 09:09 DZL1943

I'm happy to work on this if no one has taken it on

@mProjectsCode let me know if you'd like me to and I'll try to get something back to you by midweek

jjmax75 avatar Oct 27 '24 17:10 jjmax75