Note Composer: links to blocks and headers should be updated when extracting

That’s unlikely to happen: https://forum.obsidian.md/t/automatic-inline-update-of-links-to-headers-when-they-are-modified-no-extra-dialog-window/25412/10

Let’s keep this FR on-topic.

Sorry, I thought this was a subset of the general case, but I see now that it’s different.

Thanks for the link.

2 Likes

@I-d-as many thanks for that detailed explanation. Couple of remarks:

  • in para 8 you said: “The expression is now \[(.*)\]”, and in para 9 you said “The expression is now [(.*)\]\(.*\)”, so it seems you forgot the very 1st escape sign

  • Regex is extremely powerful, but seems quite difficult to learn, I’ll give it another try, even though

  • Regex in VSCode is slightly different from regex in Obsidian, as I seem to recall.

1 Like

@Klaas You are right. I fixed the mistake. I am definitely a novice with regex and really only use it in VSCode to accomplish things like I explained, learning as I go. In terms of the differences and/or basics Obsidian regex, I couldn’t find an exact description, although I admittedly didn’t spend too much time searching. However, that is definitely something that I would be interested in if anyone knows the “flavor” that Obsidian uses. If I am not mistaken, VSCode uses JavaScript flavor. I may be probably am wrong.

Anyways, Thanks! And good luck on your journey!

@I-d-as No, you are obviously not a novice, you just made a typo, happens to the best of experts :wink:

1 Like

It is exciting to see that a similar request will be implemented soon, here:

Perhaps if everything goes well with that, we might have a reason to be hopeful about this request. Regardless, I appreciate that this request appears to have gotten the ball rolling.

Thanks again, @a2jc4life! Nice job.

1 Like

Use case or problem

A possible use case of heading reference is to link with precision to slightly different concepts (e.g. how a bacterium reacts to particular antibiotics) without having to divide such concepts in different truly atomic notes.

This has the benefit of grouping the backlinks under the same note, instead of dispersing them across a bigger group of little notes, thus enhancing the ability to spot and create connections.

Currently, the issue with it is that, if one of those initially small slightly different concepts grows to the point it needs to become a note on its own (as we learn about the topic etc.) or to be moved under a different note (because of organization purpouses), all the links to that heading will not be automatic updated to the new location.

Proposed solution

The “extract this heading” command should trigger auto-update of:

  1. the links to the header, and
  2. the links to every hierarchically inferior sub-heading currently under the heading we are running the command on,

as the “rename this heading” feature already does.


Example

Note A has the heading # 1, and heading ## 1.1 under it
Note B has the link [[A#1]]
Note C has the link[[A#1.1]]

If heading 1 is extracted to a new note D

Note A is now empty
Note B has the link [[D#1]]
Note C has the link [[D#1.1]]
Note D has the heading # 1 and heading ## 1.1

Current workaround (optional)

I’m aware of no workaround but to manually fix every link to each heading and sub-heading.

Related feature requests (optional)

16 Likes

This Feature I find so extremely important and it is hard to believe that there seem to be so little people who have this concern.

Automatically updating backlinks to headers, after extracting them to new notes seems absolutely essential.

Otherwise the extraction Function is so dangerous to use as it can fuck up your whole link structure (which is THE Core Feature of obsidian after all).

13 Likes

Currently struggeling with the same problem. Would highly appreciate this feature!
Thanks for bringing it up!

2 Likes

Same problem here!

1 Like

+1, I’m discovering how important it is for me to update links as my references grow. My workflow has currently been Quoteblock with Bold Text Title for a small definition > Heading for a section/larger definition > Entire Note, upgrading as I need.

My current workaround is to maintain block links if I upgrade a quoteblock to a heading, or possibly even to a note.

Obsidian not doing this is a bug imho.

3 Likes

What makes you say that?

Just as a user myself who just discovered this behavior, I think that it violates user expectations – after all, the “Rename this heading…” context menu option that appears right above the “Extract this heading…” option does update links. Why should one context menu option preserve links and the other break links?

6 Likes

+1 from me for this and related features discussed above. I find it difficult to use refactoring (or note composer’s extraction) without this. A lot of search/replace going on in BBEdit for me right now.

2 Likes

There is just no usecase for leaving broken links.
Obsidian supports the “extract heading” operation, performing this operation leaves back a lot of broken links. That’s incomplete work.
Programming IDEs like Pycharm support similar features for code and of course, if you move a method/class to a different module it tries to update all the imports. That’s one of the major reasons to use an IDE. Obsidian is sort of an IDE for notes…

3 Likes

That does not “justify” leaving links broken instead of them being updated.

Here is a workaroud:

Note link template:

###### {{new_note_title}}
!{{new_note_link}}

I use the smallest heading since it fits in everywhere and presumably there wont be any subheadings. Transclusion optional.
Probably doesnt work with content only extraction and ive only tested it with a heading, not a block.
It also only works if you dont add a prefix to the new note.
I was thinking if Note refactor added an option to exclude the prefix in {{new_note_title}}, you wouldnt even have to do that, but oh well. right now i just add the prefix manually.
[/quote]

I am struggling with this issue also. Looking for a way that links to headers will be updated if the header text changes. Fixing this would be a HUGE thing in my opinion!!

2 Likes

Linking is the very core of Obsidian. Fixing this is, in my opinion, one of the most important issues regarding this app.

3 Likes