Obsidian Note Compiler
I have wanted an automated way to compile transcluded notes together rather than having to manually copy pasta a bunch of notes together. So, i created an iOS Shortcut that can do it for me. It is very simple and potentially inefficient so take care when you try it out. It will NOT alter any notes involved but instead create a new merged note made up of the text.
Here’s the iCloud link. Explanation of how it works follows. https://www.icloud.com/shortcuts/a5ebf572834f4a909ba0c79b01441ecf
- Shared/starting note: note shared into the shortcut
- Merged note: resultant compiled note from shared note and transcluded notes
- Transcluded note: any note referenced by
“![[note name]]”in the shared note
How the shortcut works On import of the shortcut, you are asked two questions.
- Where to source your note files
- Where to save them
For 1, I use my base Obsidian vault folder. if your database is huge, this may result in slower response times because of how the Shortcut gathers note file references.
For 2, it will default to your Shortcuts folder but you can save it wherever Shortcuts has access.
This shortcut accepts selected text from within a note or a note file from within your Obsidian vault. If neither are provided, it will prompt you to select the file you want to compile.
It will then parse through the shared note text to match any
![[note name]], including any with an “|alias”, text in the body. When found, the shortcut will find that transcluded file by file name in the source folder you provided on import and grab the text of it. In the shared note, the
![[note name]] text is replaced by the text of the transcluded note.
There are some important caveats for how this works.
- In order to work, the shortcut has to gather a list of all the notes that could be transcluded in the note you’re trying to compile. If you know that your notes are only in a subset of folders, you can select that folder for the first import question instead of your base vault folder.
For me, I set it to be the base vault folder. With about 500 notes in the database, it takes about 5 seconds to gather those files for reference later in the shortcut. YMMV.
This will only work with ONE LAYER DEEP of transclusion. If your transcluded note has transcluded notes, this will NOT gather those notes. I do not intend to add that any time soon because it makes the shortcut FAR more complex, more complex than my personal needs and potentially beyond my skill set to accomplish readily.
Both the supplied note and the transcluded notes will NOT be edited. The text is just taken from them and merged together. The compiled note is saved to the folder location you set in the second import question.
There are probably more efficient ways to do what this is doing so if you figure any out, feel free to drop a comment in the post you found the link to this on Reddit or the Obsidian forum.
I’d recommend you test this before using it seriously just in case. it shouldn’t edit any existing files but sometimes Shortcuts does weird things.