mrjackphil / obsidian-text-expand

A simple text expand plugin for Obsidian.md
186 stars 12 forks source link

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

Closed EhuddR closed 1 year ago

EhuddR commented 2 years ago

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.

mrjackphil commented 2 years ago

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.

EhuddR commented 2 years ago

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.

mrjackphil commented 1 year ago

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