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
<%* | |
//Find leaf next door | |
const thisLeaf = app.workspace.activeLeaf; | |
const thisFile = thisLeaf.view.file; | |
let leafToUse = app.workspace.getAdjacentLeafInDirection(thisLeaf, "right"); | |
if(!leafToUse){leafToUse = app.workspace.getAdjacentLeafInDirection(thisLeaf, "left");} | |
if(!leafToUse){leafToUse = app.workspace.getAdjacentLeafInDirection(thisLeaf, "bottom");} | |
if(!leafToUse){leafToUse = app.workspace.getAdjacentLeafInDirection(thisLeaf, "top");} | |
if(leafToUse) { |
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
<%* | |
let dueDateStr = await tp.system.prompt("Enter Date", "Tomorrow"); | |
let parseResult; | |
let parseResultLink; | |
if(dueDateStr) { | |
let nlDatesPlugin = this.app.plugins.getPlugin('nldates-obsidian'); | |
parseResult = nlDatesPlugin.parseDate(dueDateStr); | |
if(parseResult){parseResultLink = parseResult.formattedString;} | |
} | |
if(parseResultLink) { |
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]; | |
const dnp = tp.date.now('YYYY-MM-DD'); | |
const dnp2 = tp.date.now('YYYY_MM_DD'); | |
search.view.setSortOrder("byCreatedTime"); | |
search.view.setCollapseAll(false); | |
search.view.setExtraContext(true); | |
//looking for backlinks only | |
let finalQuery = `/\\[\\[${dnp}(\\]\\]|\\|)/`; | |
//Optional - looking for date with underscores too |
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]; | |
search.view.setSortOrder("byCreatedTime"); | |
search.view.setCollapseAll(false); | |
search.view.setExtraContext(true); | |
const dnp = tp.date.now('YYYY-MM-DD'); | |
const dnp2 = tp.date.now('YYYY_MM_DD'); | |
let myString = `((file:${dnp2} task-todo:"[ ]") OR ((/Due Date: .*\\[\\[${dnp}\\]\\].*/ OR /due date: \\[[0-9, -]*${dnp}[0-9, -]*\\]/) task-todo:"[ ]") OR (file:${dnp} task-todo:"[ ]") OR (task-todo:"${dnp}") OR section:(/^\#.*${dnp}/ "[ ]") OR section:(/^\#.*${dnp}/ section:("[ ]"))) -file:("weekly review")`; | |
search.view.setQuery(`${myString}`); | |
app.workspace.revealLeaf(search); |
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
<%* | |
let dueDateStr = await tp.system.prompt("Enter Date", "Tomorrow"); | |
let parseResult; | |
let parseResultLink; | |
let myString = ''; | |
if(dueDateStr) { | |
let findDays = dueDateStr.split(';'); | |
let myDateStr = findDays[0]; | |
if(myDateStr) { | |
let nlDatesPlugin = this.app.plugins.getPlugin('nldates-obsidian'); |
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 addPageBrackets = false; //true = '[[page]]' ... false = 'page' | |
const files = await app.vault.getMarkdownFiles(); | |
const links = []; | |
const finalLinkArr = []; | |
files.forEach(file => { | |
links.push(file.basename); | |
finalLinkArr.push('📄 ' + file.basename); | |
}); | |
const unResLinks = Object.entries(app.metadataCache.unresolvedLinks); |
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 thisFile = app.workspace.getActiveFile(); | |
search.view.setSortOrder("byCreatedTime"); | |
search.view.setCollapseAll(false); | |
search.view.setExtraContext(true); | |
let myString = thisFile.basename; | |
search.view.setQuery(`file:("${myString}") task-todo:(/^./)`); | |
app.workspace.revealLeaf(search); | |
%> |
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]; | |
const files = await app.vault.getMarkdownFiles(); | |
const links = []; | |
files.sort(function(a,b){return b.stat.mtime - a.stat.mtime}); | |
files.forEach(file => { | |
links.push(file.basename); | |
}); | |
const unResLinks = Object.entries(app.metadataCache.unresolvedLinks); | |
unResLinks.forEach((eachLink) => { |
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 thisFile = app.workspace.getActiveFile(); | |
search.view.setSortOrder("byCreatedTime"); | |
search.view.setCollapseAll(false); | |
search.view.setExtraContext(true); | |
let myString = thisFile.basename; | |
myString = myString.replace(/[-[\]{}()+?.,\\^$|#]/g, '\\$&'); | |
search.view.setQuery(`/\\[\\[${myString}(\\]\\]|\\|)/`); | |
app.workspace.revealLeaf(search); |
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
<%* | |
//v0.1 - open search pane and add the logseq block ref ID automatically to see block ref source and locations | |
const search = app.workspace.getLeavesOfType("search")[0]; | |
const editor = app.workspace.activeLeaf.view.editor; | |
const curLineNum = editor.getCursor().line; | |
const curLine = editor.getLine(curLineNum); | |
const blockRef = curLine.match(/\(\([a-zA-Z0-9\-]*\)\)/); | |
let searchString = ""; |