Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Outgoing Links #1

Closed
chenmaoran opened this issue Feb 26, 2023 · 19 comments
Closed

Support Outgoing Links #1

chenmaoran opened this issue Feb 26, 2023 · 19 comments

Comments

@chenmaoran
Copy link

This plugin works perfectly in File Explorer. It would be nice if it supported opening Outgoing Links, hopefully it will.

@patleeman
Copy link
Owner

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?

@patleeman
Copy link
Owner

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.

@chenmaoran
Copy link
Author

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.

@patleeman
Copy link
Owner

So the idea is that when you click on a backlink inside a note, it should open in a new tab?

@chenmaoran
Copy link
Author

Yes!

@patleeman
Copy link
Owner

Okay, let me try to hack on this when I get time.

@chenmaoran
Copy link
Author

Appreciate~

@patleeman
Copy link
Owner

@chenmaoran Released 1.0.5. You an update in BRAT42

@willasm
Copy link

willasm commented Feb 28, 2023

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.

@patleeman
Copy link
Owner

Thanks for the report @willasm!

Do you have an example page you could provide so i can test it?

@willasm
Copy link

willasm commented Feb 28, 2023

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.

@patleeman
Copy link
Owner

I appreciate the help! Let me dig in.

@patleeman patleeman reopened this Feb 28, 2023
@patleeman
Copy link
Owner

@willasm can you give 1.0.6 a try? It should fix the behavior around headings and blocks

@willasm
Copy link

willasm commented Feb 28, 2023

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.

@patleeman
Copy link
Owner

Let me take a look and try to fix it! Thanks for helping me debug it!

@patleeman
Copy link
Owner

@willasm 1.0.7 should fix the issue!

@willasm
Copy link

willasm commented Feb 28, 2023

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!!

@willasm
Copy link

willasm commented Mar 1, 2023

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 👍

@patleeman
Copy link
Owner

I actually found a weird case with backlinks in folders. 1.0.9 should fix it.

Thanks for helping me debug this @willasm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants