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

Way to insert links that open in new tab #11

Open
sbarratt opened this issue Oct 3, 2018 · 0 comments
Open

Way to insert links that open in new tab #11

sbarratt opened this issue Oct 3, 2018 · 0 comments

Comments

@sbarratt
Copy link

sbarratt commented Oct 3, 2018

I've made it so that if you start a link with \/, it opens it in a new tab. I've done this by adding the lines

    if link[:2] == '\\/':
      link = link[2:]
      newtab = True
    else:
      newtab = False

and then the lines

    if not newtab:
      b = b[:m.start()] + r'<a href=\"%s\">%s<\/a>' % (link, linkname) + b[m.end():]
    else:
      b = b[:m.start()] + r'<a rel=\"noopener noreferrer\" target=\"_blank\" href=\"%s\">%s<\/a>' % (link, linkname) + b[m.end():]

to the replacelinks function which seems to work well.

What do you think about adding this to master? What would be a good way to signify new tab?

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

1 participant