Skip to content

Instantly share code, notes, and snippets.

<%*
const noteName = tp.file.title;
const queryKeyword = await tp.system.prompt("Keyword for Tasks search query", noteName);
if(queryKeyword) {
tR = `
\`\`\`query
-file:inbox (file:("${queryKeyword}") line:(" [ ] ")) OR (section:(--"${queryKeyword}" " [ ] ")) OR (section:(--"${queryKeyword}" section:(" [ ] ")))
\`\`\`
`
}
@GitMurf
GitMurf / obsidian.live-preview.css.block-ref-inline.css
Last active October 27, 2025 08:27
CSS for inline block references that works for both NEW CM6 Live Preview and also Preview Mode for both CM5 (Legacy) and CM6 (New)
:root {
/* #7159de (similar to Obsidian purple) */
--block-ref-line-color: grey;
--block-ref-line-type: solid;
--block-ref-line-size: 2px;
/* Set to "inherit" for no bg color */
--block-ref-hover-bg-color: #d4d0d026;
}
/*
/* Default font-family and default 16 size */
:root {
--bullet-one: '●';
--bullet-one-pos-top: 5px;
--bullet-one-size: 9px;
--bullet-two: '■';
--bullet-two-pos-top: 5px;
--bullet-two-size: 9px;
--bullet-three: '○';
--bullet-three-pos-top: 3px;
/* RAINBOW INDENT COLORS */
:root {
/* default */
--font-use-default: var(--default-font);
--font-size-use-default: var(--editor-font-size);
--indent-use-default: 1.8ch;
/* ------- */
/* theme */
--font-use-theme: inherit;
@GitMurf
GitMurf / obsidian.templater.pane.send-to-next.js
Created January 8, 2022 04:07
Send the current active line of text or if text is selected, send the selection... to the pane next to the active one
<%*
//OPTIONS: TOP / BOTTOM
const whereToWrite = "TOP";
//OPTIONS: COPY / MOVE
const copyOrMove = "COPY";
//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");}
@GitMurf
GitMurf / obsidian.api.notion-test.js
Created January 11, 2022 00:52
This is a POC test to connecting to the Notion API from Obsidian
<%*
const notionApiKey = 'YOUR_API_KEY_SEE_COMMENTS_FOR_HOW_TO_GET';
const reqParams = {
url: 'https://api.notion.com/v1/databases',
method: 'GET',
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${notionApiKey}`,
"Notion-Version": `2021-08-16`,
},
<%*
const search = app.workspace.getLeavesOfType("search")[0];
let thisFile = app.workspace.getActiveFile();
//SortOrder Options: alphabeticalReverse, alphabetical, byModifiedTime, byModifiedTimeReverse, byCreatedTime, byCreatedTimeReverse
search.view.setSortOrder("byCreatedTime");
//Collapse=true, Expand=false
search.view.setCollapseAll(false);
//Show Extra Context: true or false
search.view.setExtraContext(true);
/* Add the Obsidian purple border */
.markdown-source-view.mod-cm6.is-live-preview .cm-preview-code-block {
border: 4px solid var(--interactive-accent);
border-radius: 10px;
}
/* Hide query syntax in search query embeds */
.markdown-source-view.mod-cm6.is-live-preview .cm-preview-code-block .internal-query div.internal-query-header {
display: none;
}
.markdown-source-view.mod-cm6.is-live-preview .cm-preview-code-block .internal-query {
<%*
const editor = app.workspace.activeLeaf.view.editor;
if(editor.somethingSelected() === true) {
let selectedText = editor.getSelection();
let splitLines = selectedText.split('\n');
let finalOutput = '';
let listItem = false;
let codeBlock = false;
splitLines.forEach(eachLine => {