Using H6 headers as blocks (albeit that can be a bit resource-intensive from what I recall).
To piggyback on @ja_rule ’s suggestion, one way of referencing blocks that currently exists is to enclose text in an h6 (######) ‘block’:
###### If you dislike folding
If you dislike folding for whatever reason, it can be turned off in Settings.
######
###### A really great quote
> Obsidian rocks!
> \- Anonymous
######
The second ###### acts as a terminator to delineate the block.
Then use obsidian.css to hide h6 (whoever used an h6 with a straight face though, really?):
h6 {
display: none;
}
Using the first few words of the sentence/block in the h6 heading works nicely when autocomplete kicks in during link creation (as opposed to using something like an ID).
I’ve never had the need to ‘title’ a block reference, so it seems fine for my use that the h6 is used as a reference, but never rendered.
@Théry in the Obsidian CSS discord offered a little more refinement. I’m just copying it here because this is where people will find it. (I haven’t tested it yet)
For basic hiding of H6 in Preview:
.markdown-preview-view h6
{
display: none;
}
Refining margins with the embedded text:
h6 + p { margin-top: 0; }
h6 + ul { margin-top: 0; }
Block-level references for mathematical proofs:
When I am taking notes from a mathematical text, there are many definitions that one has to keep track of when attempting to write proofs. For example the following definitions are in my page corresponding to notes from a math text:
Some way down through the notes, there is another entry which refers to a theorem and linked note page containing the proof.
On the page which contains the actual proof, I use block references which pull in relevant definitions or theorems that are required for actually proving the theorem.
Using header-level embeds:
# Definition
your definition
and in the other file you embed as
![[firstfile#definition]]
Using CSS to make embeds inline:
Multi-line support
.internal-embed,
.internal-embed > .markdown-embed,
.internal-embed > .markdown-embed > .markdown-embed-content,
.markdown-embed-content > * {
display: inline;
}
.markdown-embed-link {
position: static;
display: inline;
}
Autohotkey script to create new notes based on selections:
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
How to add “naked” embeds
As per a request on the Obsidian Discord (shoutout to @scmwiz , @spacejunky , @kard32 and others) this allows note embeds to look as if they were part of the note in preview mode.
I’m not a huge fan of this approach, myself. I prefer to see the embedded note look a little different. But that’s just my personal taste.
Screenshot:
[20200520113915]
Instructions:
Copy the snippet into your vault’s obsidian.css file. It should be compatible with whatever other theme you have in there at the time.
…
Dor
October 3, 2020, 9:48am
27
My current usage:
I have a text expander set up with a zettelkasten type date/time and an h6 followed by the date time.
I add text as desired either before the date/time or after - depending on how I envisage searching and preferred label.
I tend to use the pure date/time for new notes and the h6 one for blocks in a note.
This is quite sufficient for me. Unique names and links guaranteed. Most of the time I have no need for blocks, so I may not be typical of those who are interested in them.