Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Template for the Templater Obsidian plugin to copy current Obsidian note as markdown link

<%* const title = tp.file.title; const uri = 'obsidian://open?vault=Vault&file=' + encodeURI(title); const fullstring = '[' + title + ']' + '(' + uri + ')'; navigator.clipboard.writeText(fullstring); %>

@mdroidian
Copy link

mdroidian commented Feb 8, 2022

I think there is a missing ; for the const fullstring ?

I got Templater Error: Template parsing error, aborting. Bad template syntax when I tried it.

This worked for me

<%*
const title = tp.file.title; 
const uri = 'obsidian://open?vault=Vault&file=' + encodeURI(title);
const fullstring = '[' + title + ']' + '(' + uri + ')';
navigator.clipboard.writeText(fullstring); 
%>

@selfire1
Copy link
Author

selfire1 commented Feb 8, 2022

Yes, there is. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment