Closed chenmaoran closed 1 year ago
I responded in the thread but its probably better to have this discussion here.
Are you referring to the functionality similar to what obsidian-no-dupe-leaves provides?
Like when you click a link in the editor?
One of the issues with no-dupe-leaves is that it monkey patches a core component of obsidian which I think will be frowned upon. I'll need to see if there is a different way to hook into the behavior.
I have installed the "obsidian-no-dupe-leaves" plugin, but when I click Outing Links in preview mode, it still replaces the current tab instead of opening it in a new tab.
So the idea is that when you click on a backlink inside a note, it should open in a new tab?
Yes!
Okay, let me try to hack on this when I get time.
Appreciate~
Almost perfect now, only one problem. Links to headers in the same page also open in a new tab. That makes my table of contents not function as intended. Still better overall than the default behavior.
Thanks for the report @willasm!
Do you have an example page you could provide so i can test it?
Sure, try this.
# Table of contents
[[#Header 1]]
[[#Header 2]]
[[#Header 3]]
## Header 1
## Header 2
## Header 3
The links still go to the correct header, but open in another tab with a copy of the same file. In this case ideally you do want to stay on the same page.
I appreciate the help! Let me dig in.
@willasm can you give 1.0.6 a try? It should fix the behavior around headings and blocks
That fixed the example I gave you but I noticed one other method that does not work. Here is a sample...
# Table of contents 1
[[#Header 1]]
[[#Header 2]]
[[#Header 3|Alternate Name]]
# Table of contents 2
[[LinkDemo#Header 1]]
[[LinkDemo#Header 2]]
[[LinkDemo#Header 3]]
## Header 1
## Header 2
## Header 3
The first table of contents does work, but the second example does not. The only difference is the filename before the hashtag. In this case the filename is the current file which is a valid method of entering the link. If the filename is another note, it does open the other note in a new tab but does not jump to the header.
I guess I could change my TOC template to just use the first method, but I suspect eventually someone else will notice this and bring this up.
At any rate, great stuff and thank you very much for this.
Let me take a look and try to fix it! Thanks for helping me debug it!
@willasm 1.0.7 should fix the issue!
Wow that was quick! Yes that fixed it when the filename is the current file. However, if the filename links to another file it correctly opens that note in a new tab if not already open otherwise it uses an existing tab if it is present, but it does not jump to the header in the link.
I hope that I explained that clear enough? Here is an example..
[[CurrentFilename#Header 1]] This works!
[[SomeOtherFilename#Header 1]] This works but does not jump to Header 1
Thanks again!!
That is amazing! v1.0.8 is working perfectly. I have not been able to find any other odd case scenarios in my testing. This one's working perfectly for me.
Thanks again 👍
I actually found a weird case with backlinks in folders. 1.0.9 should fix it.
Thanks for helping me debug this @willasm!
This plugin works perfectly in File Explorer. It would be nice if it supported opening Outgoing Links, hopefully it will.