I’ve made a crude autohotkey script to create .md files out of text selections, then it puts the transclusion link in the clipboard ready for pasting… maybe someone can use it as a poor man’s ersatz of block reference.
details :
. choose a folder to store the snippets (edit the script to configure the folder’s location first). the script will create folder by month and store all snippers here
. select some text (from an obsidian doc, browser, etc…)
. CTRL+SHIFT+C
(copy) or CTRL+SHIFT+X
(cut) will create a new .md file in /snippets/yyyyMM/
:
vault/snippets/yyyyMM/xx_yyyyMMhhmmss-msec_%sourcewindowtitle%.md
. the link to the .md file is automatically copied in the clipboard and ready to be pasted in another obsidian doc as a transclusion (the script generates ![[linktosnippet]]
and puts it in the clipboard).
my current css makes inline transclusion visible with a blue border on the left + red icon on the upper left side :
my use case is to split long files into smaller snippets that can be referenced elsewhere (poor-man’s text blocks in a way). So I select a piece of text, CTRL+SHIFT+X
to cut and immediately CTRL+V
at the same place : the original block of text has been replaced by a transclusion. The transcluded file is located in /snippets (at the very bottom of the list), I can then rename/move it elsewhere for storage (links will be updated as long as the file opration is made in obsidian).
Alternatively, I use CTRL+SHIFT+C to make “children blocks” that can be transcluded/edited without modifying the original reference.
DISCLAIMER :
The script is very limited, it’s text only, no images, no formatting. I’m not a coder, so it’s use at your own risk. backup/clone your docs before testing… It only work with AutoHotkey ANSI (autoHotkeyA32.exe) because it’s easier to deal with accents.
odsbn-autosnipp.zip (1.2 KB)
a small gif to see what it does