obsidian-text-expand icon indicating copy to clipboard operation
obsidian-text-expand copied to clipboard

[Feature Request] Get a specific line of a file?

Open EhuddR opened this issue 2 years ago • 2 comments

Hi! I would like to know if you can get as a search result a specific line of a note. At the moment the $line argument returns the entire contents of the note, likewise, using $lines:10 returns the first 10 lines of the file. It would be helpful if you could get a specific line using something like $line:9:9 so that you get as result the line 9 of the file. I tend to take a lot of notes with dashes as points of interest and it would be great to be able to quickly access a specific line.

image

Thanks.

EhuddR avatar Jun 23 '22 08:06 EhuddR

Hi @EhuddR. While you can't do that by sequences you can do that using eta template.

file:FILENAME
<% it.files.forEach(file => { %>
<%= file.content.split('\n')[8] %>
<% }) %>

But yeah... This might be useful feature for sequences.

Also, you can use $matchline to get the line from search panel.

mrjackphil avatar Jun 23 '22 10:06 mrjackphil

Thank you for the answer. So far I had tried to avoid the eta template because I am not very good at programming except for a bit of HTML, CSS and R. Maybe we need a little more documentation on how to use this template.

EhuddR avatar Jun 27 '22 18:06 EhuddR

Anyone feel free to reopen the issue if there are still enough cases for this feature.

mrjackphil avatar Oct 19 '22 06:10 mrjackphil