Block reference

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

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.

1 Like

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

very impressive!!

1 Like

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

Sources:

7 Likes

:grinning:
Using “quicker”, a third-party software, is close to the block reference function, which is not so convenient to use, but the effect is already good. Two-way link, synchronous modification can be as small as one letter.

https://getquicker.net/Sharedaction?code=1ac2f804-1444-4897-72e8-08d8309f8f6f

在用Obsidian 搜索需要被引内容后,
使用该动作几乎已经达到block reference(块 引用)的效果。
而且引用能支持到非常小的粒度。
同步、非同步修改也能做到。

我来补充一下对这个动作的使用需要注意的一些地方:
1、如果开始目录没选对,引文也可以引,但在软件内会看不到被引文功能所使用的文本。
2、每次打开不同库都要ctrl 重新设定一遍文件夹
3、按住ctrl键点击动作按钮,可以重新指定库目录

不知道开发者是否能看得到此贴。我尝试在qq上给开发者单独发过几次信息都没有任何响应。

块引用是非常重要的功能
见文:


上文是南开大学博士王树义对块引用粒度重要性的的描述,

简单而言小粒度的块引用可以大大的提升链接的效率和可能性,让之前所有做过的任何笔记到现在都可以轻松的产生链接,构建“第二大脑”,这个功能的意义还是很大的。而大粒度的块引用“双向链接”是是非常多的软件很久之前就已经具备的功能并没有什么独特性。目前Obsidian不借助quicker动作的话只能做到[[ ]] 盒子 [[ # ]]盒子内的小单元引用的级别。

如果把[[ ]]形容成一个 盒子 、那么[[ # ]]就是这个盒子里的小单元 、而(( ))块 就是更小的内容的载体。obsidian目前缺失块的功能,我见目前这个大贴中很大多国内外朋友都在想各种办法解决此缺陷,而且此大贴目前也成为了需求类的最大贴。

我想到了一更多从软件层面就解决块引用的思路,这是基于借助标签来实现块引用的办法,在标签的基础之上。标签只要能全局修改,它就和块引用 (block reference)功能其实就一样了。目前国内的 蚕子 也已经用quicker实现了标签同步修改的功能,如下连接:

https://getquicker.net/Sharedaction?code=75a8ce9b-4a2b-4a0d-b57b-08d83289803e

这个功能的粒度 已经非常独有,它所达到的引用的块是比Roam Research要细腻的Roam Research根本无法做到。而且可以对行文格式外观没有破坏,但是如此会带来一个困扰,原来的标签功能无法正常使用,还有它并不能达到真正的块引的快捷方便的效果。

https://www.getquicker.net/Sharedaction?code=1ac2f804-1444-4897-72e8-08d8309f8f6f
另外还有一个解决办法就是利用quicker软件扫描全部的.MD文件做全局对某符号的识别实现块引用。用[[☛]]符号配合一个内置的☛引文文件做回链,但这个方法会带来一个缺陷就是把图谱(思维导图)的关系破坏,大量的链接只链向一个点。所以目前全局修改标签的方法是最佳的块引用方法。

但这个“标签块引用”功能要更好的实现需要软件原生内置才行,所以我到此贴中把这个想法反馈给开发者,开发者完全运用 #标签 的理念来做块引用,只需要在软件内把 #标签 换成其它符号比如 ((双括号 即可,如此标签和块引互相就不会干扰,打出((命令后 可全文检索关键词来引用,和用搜索功能一样,用这个命令实现可以把软件变得非常易用,((命令可以在标签功能的基础上 加上1、源文可回链 2、可全局修改3、在图谱中关系可见

就是 使用(( 双括号符号后 输入需要的字符 会出现下拉框 供关联筛选 ,选中某需要 块引用的内容 后就变成了 标签(块)一样的功能,这个标签也具备1、源文可回链 2、可全局修改3、在图谱中关系可见。

最简单说
这个标签符号 (( 要具备 1、全局搜索功能 2、回链 3
全局修改功能 就做到任意粒度的块引用了,这种功能也具备独创性。

补充:
回需要回链的定位可以用在软件中在 (()) 已经被标签的内容符号后计上十六进制(或36进制更简短)数值就可以大量数据的快捷定位做顺序记号产生回链,比如这是.MD文件中的第10亿个块 就可以表示为 ((源被引的块内容))5f5e100 即可轻松对数据定位,它就可以是第十亿零一个数据 ((被引的块内容))3b9aca01的源,就可以轻松做成了回链,这个定位的数据可以在软件内单独建立一个储存文件实现识别或者用比较好的算法再软件内无需多余文件直接实现,十六、三十六进制数值有字符短软件无需高算力就能识别的优势。

另外((被引的块内容))3b9aca01的3b9aca01和(())都可以在软件的CCS文件定制为隐藏,这样文本格式就会最大程度的不被破坏。
如果不想破坏md的格式进行导出其它软件使用,可以设定一个去除编码导出的选项功能即可。

如果有md文件需要到其它软件用的用户,开发者完全可以把这种(()) 引用的功能设置一个开关,这样即方便了只用obsidian的大部分用户,也方便了md文件需要到别的地方再使用的用户。

附上进制在线转换网页,这种十六、三十六进制转换是非常微小的算力就能做到
https://tool.oschina.net/hexconvert/

1 Like

标签实现块引用的想法很好。由于标签前后都需要空格,中文一句话可以没有空格,但英文如何实现?