Skip to content

Instantly share code, notes, and snippets.

@GitMurf
GitMurf / obsidian.api.notion-test.js
Created Jan 11, 2022
This is a POC test to connecting to the Notion API from Obsidian
View obsidian.api.notion-test.js
<%*
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 Jan 8, 2022
Send the current active line of text or if text is selected, send the selection... to the pane next to the active one
View obsidian.templater.pane.send-to-next.js
<%*
//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");}
View obsidian.css.live-preview.list-rainbow-indents.css
/* 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;
View obsidian.css.live-preview.list-bullet-shapes.css
/* 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 Jan 17, 2022
CSS for inline block references that works for both NEW CM6 Live Preview and also Preview Mode for both CM5 (Legacy) and CM6 (New)
View obsidian.live-preview.css.block-ref-inline.css
:root {
--block-ref-line-color: green;
--block-ref-line-type: solid;
--block-ref-line-size: 2px;
--block-ref-hover-bg-color: #a9a9a93d; /* Set to "inherit" for no bg color */
}
/*
***************************************************
Live Preview (WYSIWYG Edit mode) inline block refs
View obsidian.templater.query.tasks.keyword.js
<%*
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:(" [ ] ")))
\`\`\`
`
}
View obsidian.templater.task.new-note.js
<%*
//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) {
View obsidian.templater.new-note.client.meeting.js
<%*
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 => {
View obsidian.css.masonry-mode.css
div.workspace-split.mod-root > div.workspace-split.mod-vertical {
overflow: auto;
}
div.workspace-split.mod-root div.workspace-split.mod-vertical > div.workspace-leaf {
min-width: 550px;
}
/* Splitting sidebar individual pane horizontally */
div.workspace-split.mod-root div.workspace-split.mod-vertical > div.workspace-split.mod-horizontal {
min-width: 555px;
View obsidian.templater.css.pane.full-screen.js
<%*
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`);