Block reference

ok, let me publish the code to github.

Does that mean you have use it through a terminal?

For those who like inline embed…

.internal-embed {
	display: inline-flex;
}

5 Likes

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;
}

8 Likes

yes, it does.

This works in most cases and is my recommended solution for most people for now: How to do block referencing in Obsidian

1 Like

Thanks, it’s helpful. I think it would be a good solution if these [[]] links with no actually content don’t generate .md files in the file explorer. Maybe we can open a temp file when we open this kind of link to see backlinks. What do you think about that?

I have to say that I’m with @ryanjamurphy . I’m actually doing legal work, and trying to incorporate that with Roam/Obisidian. I’m finding that block linking leads me to be less disciplined. I suppose that block level linking allows for longer notes, but right now I’m finding that my Roam is a mess. Maybe I’m just not getting it.

One plus with this feature in Roam is that it might help with epiphany thinking, for lack of a better word. Many folks want to use Roam as a generator of new knowledge and block level linking might aid with that.

I’ve seen Nate Eliason and Tiago Forte and David Perell (in reference to the response to @ryanjamurphy) do this type of content creation by swimming through their zettelkasten, but it feels a little artificial to me and falsely equates content creation with knowledge creation, but that’s just my opinion. It reminds me of when I was in undergrad and I found two or three quotes I liked then just researched around that to write a paper. Luhman’s zettelkasten approach, in my view, is a step or two beyond that, and I’m not sure block level linking necessarily aids greater understanding or knowledge creation, but it does generate greater potential for content creation.

In my context, which is the sphere of labour law and arbitration, I’m thinking I can get by with Obsidian - a note for each case law summary, and a note for each legal concept, and finally a note for each novel new idea I have (i.e. permanent notes). But since the application of labour law is so fact specific and precedent dependent, it is very rare that I would need a “permanent note”, I think. So maybe what I really need is a wiki rather than Roam or Obsidian. LOL.

6 Likes

Just because of block referencing? That does not sound convincing.

Block references and being an outliner are two sides of the same Roam coin. I suspect this is what produces the frequently described writing more and the possibility of mess is the other side of that coin.

1 Like

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
pbn3rlCJpx

13 Likes

Off topic, but what was the css you used to make embed logo and long line spanning the paragraphs of the embed?

It might be doable in markdown if the text is wrapped in parentheses like {{…}} if you calculate a md5 salted with the base name of the document you get an automatic ID close to a uuid. The downside is recalculation and updating the links that reference the block if content is added or changed outside of obsidian. Maybe reference the block with a unique id related to the document which can be an anchor text or number/timestamp like;

Document.md
{text goes in here
Multi line if needed}#20200619

Reference as;

[[Document#20200619]]

Transcluded as;

{{Document#20200619}}

It can get messy if it needs to be user editable outside of Obsidian, one needs to be aware that ids should be unique in a document.

I will always need to edit some documents outside Obsidian, for specific features or simple preference. OTOH, I’m unconcerned about block references.

3 Likes

That’s why I think any of the solutions described in this thread will end up being plugins, not part of the core app.

3 Likes

I like the cutting-and-pasting solution. It reminds me of Scrivener Ctrl-K which cuts the document from cursor position and makes a new one (essentially “discarding” that part). I use that shortcut to get deleted paragraphs out of sight immediatedly (but keeps them elsewhere in case of need).

This approach feels like promoting a reusable paragraph to file level when it is being used, and using custom grammar to mark out blocks seems like the exact opposite way around, which defines reusability before it is used.

One thing I haven’t really got used to in Roam is that it assumes every block to be reusable. It’s slick by default, but as notes accumulate it gets hard to find the exact block. It’d be cool if Obsidian implements user-controlled (and not uniform) granularity through plugins.

6 Likes

@s-kyy : I’ve just shared the theme here : Theme: Obsdn-Dark-Rmx (Dark only), you can look for the section transclusion inside the css. It’s mostly work in progress though, and I’m not sure I will finish it anytime soon.

@idelem : I loved the link and split workflow in Scrivener ! But I eventually grow tired of waiting for a proper scrivener 3 windows version… Regarding blocks, I agree 100%. There a lot of problems to be solved to get the right amount of control vs efficiency. I’d love to have non-textual blocks, like list/sublists with tables/diagrams/images and that doesn’t always fit well with the current way of handling transclusions.

1 Like

I’m sharing some thoughts as a software engineer as well on how this could potentially be implemented.

Just thinking out loud and don’t want to impact priorities as the devs have been AWESOME with shipping fast and building a great product, but wanted to be helpful rather than just begging. :slightly_smiling_face:

The main benefit of Block References is knowledge re-use and composition.
The main benefit of Block Transclusion is maintaining a single source of truth for actively referenced blocks, you change one place, and the original gets updated as well.
Blocks are Lego Blocks of Atomic Thought to build regional brains of knowledge.

Although Markdown does not support native blocks, it should be possible locally using the natural structure of paragraphs.

You can think of each paragraph as a chunk of change, like in git, or how headers have a collapsible scope currently in obsidian. Each paragraph could then have its own unique hash that has an id, location(positional location within the document), parent(id of the page reference it is associated with), primary (is this the original pointer or a reference) and reference pointer(pointer to line location for editing transcluded source) stored and maintained in .obsidian runtime config.

Then they can be referenced with a GUI autocomplete similar to page references that index based on the words in the first sentence and wrapped in a reference, which has a key of the block reference hash and a body of the paragraph content.

The primary location of the block reference could then have a total count, which is the aggregate of the number of times the block has been referenced in other markdown files using the hash.

Thinking in paragraphs as blocks also enable moving chunks of paragraphs with navigational keys.

Design Inspiration:

Live Example of Markdown Based Paragraph as Blocks
https://blockdown.surge.sh/

38 Likes

That’s really cool! :slight_smile:

This is a great idea. Perhaps pressing “shift + enter” will create a new block, and pressing “enter” does a return without a new block.

1 Like