Last active
January 19, 2023 02:39
-
-
Save racng/03774c48376ba623e31329db42931801 to your computer and use it in GitHub Desktop.
Obsidian templater template that would format text selection into a callout quote block using Obsidian callout syntax.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%* | |
//get selection | |
noteContent = tp.file.selection(); | |
//get array of lines | |
lines = noteContent.split('\n') | |
//make a new string with > prepended to each line | |
let newContent = ""; | |
lines.forEach(l => { | |
newContent += '> ' + l + "\n"; | |
}) | |
//remove the last newline character | |
newContent = newContent.replace(/\n$/, ""); | |
//define callout header | |
header = "> [!quote]-\n" | |
// Return the complete callout block | |
return header + newContent; | |
%> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment