Last active
March 15, 2022 04:04
-
-
Save GitMurf/a2666cc0a47581bbe58ea54c03cd2845 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%* | |
const search = app.workspace.getLeavesOfType("search")[0]; | |
let keyword = await tp.system.prompt('Keyword', '[' + '[Journal'); | |
keyword = keyword.replace(/(\[|\])/g, "\\$1"); | |
const searchQuery = `section:(/^#+ ${keyword}.*\\n+\\S[\\s\\S]*[^\\n]/) OR section:(/^#+ ${keyword}.*/ section:(/[\\s\\S]*[^\\n]/))`; | |
//Collapse=true, Expand=false | |
search.view.setCollapseAll(false); | |
//Show Extra Context: true or false | |
search.view.setExtraContext(false); | |
//SortOrder Options: alphabeticalReverse, alphabetical, byModifiedTime, byModifiedTimeReverse, byCreatedTime, byCreatedTimeReverse | |
search.view.setSortOrder("byCreatedTime"); | |
search.view.setQuery(searchQuery); | |
app.workspace.revealLeaf(search); | |
%> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment