Block reference

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/

35 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

This is a constructive suggestion for the discussion - well done !!

Let’s say the pane on the right is complete, nothing to be added, nothing to be deleted.
There is a a green preview button on the top right (on live sheet on the linked page): what happens when that is clicked on, does it render as a normal page? Are the blocks rendered as paragraphs?

1 Like

This is very smart!!

1 Like

Worth referencing “arrange mode” in the iOS/macOS app Drafts. Doesn’t do everything suggested here, but is a start.

Hiding h6 (your example) only works in Preview mode in the note (note 1) itself where there is

###### If you dislike folding
If you dislike folding for whatever reason, it can be turned off in Settings.
######

But, if you want to link to that header from another note (note 2), then that header ###### If you dislike folding is shown as
[[note 1 title#If you dislike folding]]

So, what is the advantage of hiding h6 headers?

Thanks for bringing the question over here @Klass. There may be several reasons that others could contribute. I may be missing an important part of your perspective (and I feel like that may be the case), my apologies if that’s true. But I’ll at least try to offer one reason.

It brings Obsidian closer to a Roam style utility, based on the current section referencing that the Obsidian developers have given us so far.

In roam, there’s a hidden UID for each block. Obsidian doesn’t have that, which is one of the reason for this whole thread. Creating an H6 that’s hidden is essentially letting us add a hidden UID to the parts of our content we want to embed elsewhere.

2 Likes

Thanks for your explanation.

I understand the thinking behind hiding an h6 header, I use it myself in 1 or 2 notes. So, I see the header in Edit mode, I don’t in Preview. I link to that header from somewhere within that note.

But if I would want to link to it from another note, that other note does show that header, even if that other note is in Preview.

So, are we talking about linking within the same note only?

BTW, my pseudonym is KLAAS, nothing to do with “class”. @Klass doesn’t work.

For my uses, I’m definitely not talking about referencing only within the same note. I plan to use source content from one page in many different locations. I plan to transclude single lines, whole paragraphs, and sections with richer content like Latex and tables. And for clarity, we’re not talking about linking (which I associate with external, internal, and back links). We’re focusing on transclusion (which many are calling embeds in these discussions)

That’s strange that one note doesn’t show the header in the embed and another note does show the header in the embed. It shouldn’t be like that since the CSS should be consistent for all pages.

  • sorry about the misspelled pseudonym, @Klaas :wink:
2 Likes

OK, now we’re talking. I initially assumed it was about transclusions, but since that has become my big love I thought I might have got into a rut and did not want to talk x-purposes.

Anyway, what I see is that when I have in note 1
###### header text
Some text.
######

and I transclude that in note 2 by using ![[note 2#header text]] then I do see that “header text” in note 2, it is not hidden. Hence my confusion.

It’s not implemented in Obsidian. We can just ‘hack’ any of the headings to try it out if you want. You have to change your CSS a little. And doing the change on H6 makes the most sense because it’s used the least often.

You have to find .markdown-preview-view h6 in your CSS and change whatever is in the brackets { } to

.markdown-preview-view h6
{
  display: none;
}
2 Likes

I know. A few days ago I asked the question and @ryanjamurphy suggested:

h6 {
   display: none;
}

Further to my last note, I added the .markdown-preview-view bit, and then indeed the header does not show in the transclusion. Sorry for the mix-up, and thanks for a handy tip.

1 Like

This is so cool! Good job

1 Like