Allow Seeded Random Block IDs

Use case or problem

As far as I understand it, block ids are generated completely at random.

So, say a quote is referenced in 10 notes but every single one as a unique id, users cannot use blocks to identify text duplication.

Proposed Solution

I would like the random block id generator to accept seeds and by default take the block text as a seed (so from the user’s perspective, virtually nothing has changed). (I would also recommend stripping markdown syntax from the seed – e.g. - *some* text would seed as “some text” and strip out the “-” and "*"s.)

What this does is it would allow people to search for blocks that have the same text across notes. This also has the added benefit of enhancing cross-vault/user comparisons: If Bob and Alice both have block ids (or block anchor-tags/fragments in urls on the internet) that are the same, with seeded block ids, they know they have blocks that share the same text.

Current workaround

Currently, from a single user’s vault it’s trivial to search for raw text. Not aware of any workaround for published sites.

Influence

I am getting this idea from ruby’s rspec test suite, which uses seeding to reproduce previous run scenarios.

Example output:

Run options: include {:focus=>true}

All examples were filtered out; ignoring {:focus=>true}

Randomized with seed 13030
............................

Finished in 0.30302 seconds (files took 0.1896 seconds to load)
28 examples, 0 failures

Randomized with seed 13030

So you can add the randomized seed when you re-run tests to reproduce the same run order.

Some docs.

3 Likes

I like the idea. I was just thinking that if two identical quotes in separate notes get block ids generated via the seed based on the quote, they would be matching ids which would be cool. But, what would happen as you begin editing one of them? Would the id change in real time as you edit, or perhaps wait until the block has been untouched for 15 seconds or so? If they did change, this would break the block references to that block that were created pre-change. I guess that is not a huge issue if you are aware of it and remember to fix it. Maybe this feature could be a toggle, as I am unsure the matching block ids would be worth the trouble for most people.

Thanks.

1 Like
  1. Obisidian already automatically renames all references to note title backlinks.
  2. Obsidian already silently updates notes without extra communication from the user about when they’re done editing.

Between these two pre-existing functionalities, I don’t see how the above feature would prove any novel challenges to the developers (other than having to implement the actual seeding :chestnut:).

On that note…You’ve just reminded me of another – also this – feature request… :tada:

[Edit] Words are hard.

As long as it’s not a performance issue. Obsidian would have to generate a new hash every single time the text changes. Then update all of the old block links to match the new hash.

Copying and pasting large pieces of text, this could be many blocks and many hashes at the same time. I don’t know if that would be a performance problem.