Skip to content

Instantly share code, notes, and snippets.

@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`,
},
@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");}
/* 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;
/* 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;
@GitMurf
GitMurf / obsidian.live-preview.css.block-ref-inline.css
Last active April 27, 2024 07:28
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;
}
/*
<%*
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:(" [ ] ")))
\`\`\`
`
}
<%*
//v1.0
let cmEditorAct = this.app.workspace.activeLeaf.view.editor;
let curLine = cmEditorAct.getCursor().line;
cmEditorAct.setSelection({ line: curLine, ch: 0 }, { line: curLine, ch: 9999 });
let dueDateStr = await tp.system.prompt("Due Date");
let parseResult;
let parseResultLink;
if(dueDateStr) {
<%*
const openInNewPane = false; //If false, will save link to clipboard
const folderName = `refactor`;
const firstVal = await tp.system.prompt("First thought to add to the new note");
//Client name
const files = await app.vault.getMarkdownFiles();
const links = [];
const finalLinkArr = [];
files.forEach(file => {
:root {
/* Vertical Masonry */
--leaf-height: 480px;
--scroll-width: 20px;
/* Horizontal Masonry */
/* Split Screen: 930px ... Thirds: 570px or 600px (main ext monitor) */
--leaf-width: 600px;
--leaf-height-child: 700px;
}
<%*
const curPane = document.querySelector(`.mod-active.workspace-leaf`);
let isMax = false;
if(curPane) {
if(curPane.style.minWidth) {
if(curPane.style.minWidth === `100%`){isMax = true}
}
}
const rootPanesCont = document.querySelector(`.workspace-split.mod-root`);