This plugin will search files using Obsidian search functionality and then paste the result. The output can be customized using template feature.
```expander
SEARCH_QUERY
Ctrl + P
)Text expand: expand
commandFirst line in expander code block is always a search request. You can leave it empty to use results from search panel as is.
Once searching, plugin waits some time (configurable) and extract results from search panel to template engine.
You can use eta template engine for managing results.
## <%= it.current.frontmatter.title %>
<% it.files.forEach(file => { %>
- <%= file.link %>
<% }) %>
Use it
object to access search results and fields for current file.
Path | Type | Description |
---|---|---|
it.current |
FileParameters | Info about current file |
it.files |
Array |
Info about files in search panel |
FileParameters
type has those fields.
Name | Type | Description | Example |
---|---|---|---|
basename | string | Name of the file | Obsidian |
name | string | Full name of the file with extension | Obsidian.md |
content | string | Content of the file | Obsidian\nContent of the file. |
extension | string | Extension of the file | .md |
link | string | Wiki or MD link (depends on Obsidian's settings) | [[Obsidian]] |
path | string | Relative to vault root path to the file | resources/Obsidian.md |
frontmatter | Object | Returns all values from frontmatter | { title: "Obsidian", author: MrJackphil } |
stat | Object | File stats returned by Obsidian | { ctime: 1654089929073, mtime: 1654871855121, size: 1712 } |
links | Array | Array with links in the file | |
headings | Array | Array with headings in the file | |
sections | Array | Array with section of the file | |
listItems | Array | Array with list items of the file |
Using template feature you can customize an output.
Ctrl+P
) and find Text expand: expand
commandTo create a list:
```expander
SEARCH_QUERY
- [[$filename]]
```
or to create a table:
```expander
SEARCH_QUERY
^|Filename|Content|
^|---|---|
|$filename|$lines:1|
```
Syntax looks like that:
```expander
SEARCH_QUERY
^This is a header
This line will be repeated for each file
Also, [[$filename]] <- this will be a link
>This is a footer
```
^
is a header. It will be added at the top of the list>
is a footer. It will be added at the bottom of the listRegexp | Description | Usage example |
---|---|---|
$filename |
a basename of a file | $filename |
$link |
wikilink | $link |
$searchresult |
the context displayed in the Obsidian search, depending on the amount of context that is selected in the search window | $searchresult |
$matchline |
the line which contains the search query | $matchline |
$matchline:NUMBER |
the line which contains the search query and NUMBER lines after and before matched line | $matchline:10 |
$matchline:+NUMBER |
the line which contains the search query and NUMBER lines after matched line | $matchline:+10 |
$matchline:COUNT:LIMIT |
the line which contains the search query and NUMBER lines around and limit line by LIMIT characters | $matchline:0:10 |
$lines |
the full content of the file | $lines |
$lines:NUMBER |
NUMBER lines from the file | $lines:10 |
$ext |
extension of the file | |
$created |
||
$size |
||
$parent |
parent folder | |
$path |
path to file | |
$frontmatter:NAME |
frontmatter value from field NAME |
|
$header:## |
all headers as links | |
$header:###HEADER |
headers as links | $header:##Ideas $header:"## Plugins for Obsidian" |
$blocks |
all blocks paths from the note as links |
100ms
) - the plugin don't wait until search completed. It waits for a delay and paste result after that.<-->
) - how will looks like the line below the expanded content- [[$filename]]
) - how will look the expanded content when no template providedText expand
plugin<vault>/.obsidian/plugins/