Skip to content

Support hyperlinks encoded as terminal escape sequences #39

Closed

Description

@michael-plutoflume

Some terminals support clickable text via escape sequences. If we use the escape sequence

>>> import tabulate
>>>
>>> def encode_url(text: str, target:str):
...     return f"\u001b]8;;{target}\u001b\\{text}\u001b]8;;\u001b\\"
... 
>>> table = tabulate.tabulate([[encode_url("test", "http://example.org")]], headers=["test"], tablefmt="grid")
>>> print(table)
+--------+
| test   |
+========+
| test        |
+--------+

tabulate does not calculate the width correctly.

Activity

  1. astanin commented on Mar 5, 2020

    @astanin
    Owner

    Never heard of it. A pull request with an implementation and tests to make sure it covers all cases would be welcome.

  2. changed the title [-]Tabulate does not support some escape sequances[/-] [+]Support hyperlinks encoded as terminal escape sequences[/+] on Mar 22, 2020
  3. added a commit that references this issue on Feb 17, 2021
    2aa7e1a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions