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; }
1 Like
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.
2 Likes