Skip to content

Instantly share code, notes, and snippets.

@GitMurf
GitMurf / obsidian.templater.quick-capture.js
Last active April 22, 2024 15:14
Obsidian Quick Capture using templater. Activate from anywhere in your vault to record quick ideas, notes, time logging, etc. The Quick Capture file does NOT need to be open.
<%*
//v1.4: Adding option for including a header for each DNP day to fold
//'first' will add to top of file. 'last' will add to bottom of file
let firstOrLastLine = 'first';
//Name of the Quick Capture file. Do NOT include extension '.md'
let qcFileName = 'Quick Capture';
//Leave this blank if you want to use the default file path location (set to '/' to use root of vault)
@GitMurf
GitMurf / obsidian.templater.create-and-copy-block-ref-id.js
Last active January 10, 2024 11:32
Credit to: @shabegom - Add a block ref to the current line by adding a ^uniqueId on the end and copying to the clipboard the embed reference link so you can quickly paste the block ref somewhere else in your vault. Similar to Roam ctrl + click and drag to create block ref.
<%*
//v1.1: Changed to using the new "view.editor" instead of deprecated "view.sourceMode.cmEditor"
let cmEditorAct = this.app.workspace.activeLeaf.view.editor;
let curLine = cmEditorAct.getCursor().line;
cmEditorAct.setSelection({ line: curLine, ch: 0 }, { line: curLine, ch: 9999 });
function createBlockHash() {
let result = '';
var characters = 'abcdefghijklmnopqrstuvwxyz0123456789';