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

Open Links in New Tabs #1005

Closed
PackeTsar opened this issue Jul 1, 2020 · 2 comments
Closed

Open Links in New Tabs #1005

PackeTsar opened this issue Jul 1, 2020 · 2 comments
Labels
S: triage Issue needs triage.

Comments

@PackeTsar
Copy link

PackeTsar commented Jul 1, 2020

First off, thank you for the awesome library! I found this project looking for a way to get strikethroughs working properly and found a bunch of cool features I have now picked up and used!

I wanted to ask if it is already possible, and if not then can it be added as a feature, to have regular hyperlinks open in a new tab?

I have seen suggestions in other places of using [Some Text](https://domain.com){:target="_blank"} for this, although it would seem easier to pass internal parameters like {newtab}. I was also looking at the [Feature Request] Video Embeds issue which seems to want to do something similar for media (![Text](URL){some_params}) links.

Please let me know if this is already possible or if it can be. Thanks! :D

@gir-bot gir-bot added the S: triage Issue needs triage. label Jul 1, 2020
@facelessuser
Copy link
Owner

I have seen suggestions in other places of using [Some Text](https://domain.com){:target="_blank"}

This is a valid recommendation and one that holds true still. This requires the usage of the markdown.extensions.attr_list extension. It's a generic way to set classes, ids, and arbitrary attributes: {: .class #id attr=value}.

It is rare that I ever need to have every link open externally. This is nothing I've investing time in trying to solve. I can see it being more useful in relation to links external to the host though. Relative links would obviously not need to open externally, but to detect a different host, you'd need to be able to send that to a plugin so it could detect the host. This is probably the most realistic use case that I think I'd consider. I currently have nothing in place that does this, nor is there anything in Python Markdown that can do this.

With that said, you could easily post-process and covert all links easy enough as well.

@PackeTsar
Copy link
Author

Yes this makes sense. I didn't realize this was possible with markdown.extensions.attr_list. I will go that way. Thanks for the help!!

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

No branches or pull requests

3 participants