Skip to content

Wrapped hyperlinks are broken #149

Closed

Description

@EricAndrechek

When a link that is too long is passed into glow, the resulting link breaks into a new line, which in turn breaks the link. For example, this link, when clicked, takes me to https://github.com/ValveSoftware/steam-for- which is the part of the link on its own line:
image

Making the wrap length extremely long causes the URL to wrap on its own and then still functions as a valid link:
image

Another fix for this, which I believe better matches the markdown hyperlink style, would be to implement something like the escape code method proposed in charmbracelet/glow#237. This method also survives when going through a line break/text wrap:
image

Activity

  1. EricAndrechek commented on May 17, 2022

    @EricAndrechek
    Author

    Upon closer examination, it appears this issue is within glamour, not glow, and has been identified already. I did some further digging into fixing things and solving it potentially with json styling, but unfortunately this doesn't work. I believe this issue should be moved to glamour. It is similar to glamour#114 although that is a feature request for anchor style hyperlinks, while this pertains more to the github cli issue in that a forced text wrap by glamour breaks links.

  2. transferred this issue fromcharmbracelet/glowon May 17, 2022
  3. caarlos0 commented on Jul 16, 2024

    @caarlos0
    Contributor

    fwiw, the main issue isn't even the long description, but a URL > width, e.g.:

    [a](http://example.com/with-a-big-path/likely-to-use-more-than-one-line?why-not=after-all-why-not-use-queryparams-too&abc=123)

    will render:

    CleanShot 2024-07-16 at 14 51 49@2x

  4. added a commit that references this issue on Jul 16, 2024
  5. caarlos0 commented on Jul 17, 2024

    @caarlos0
    Contributor

    unfortunately not sure if we can do something about this :/

  6. added a commit that references this issue on Jul 25, 2024
  7. added a commit that references this issue on Jul 31, 2024
  8. aymanbagabas commented on Mar 10, 2025

    @aymanbagabas
    Contributor

    This might be solved by charmbracelet/x#350

  9. added this to the fix: links milestone on Mar 21, 2025
  10. andreynering commented on Mar 28, 2025

    @andreynering
    Member

    Fixed by #411.

  11. bendecaf commented on Apr 21, 2025

    @bendecaf

    Is this really addressed with #411? I have updated to v0.10.0 and then to latest and still have that problem with a long url like "## More Information\n\nURL" when it exceeds the width. I have tried to wrap the URL in a table and the URL is still broken when clicked.

    Image

    When I click this link, I "get //hamburgwhl.infomaxnet.de/standard_widget_de/e-ankunft-aidaper" instead of the full link.

  12. andreynering commented on Apr 22, 2025

    @andreynering
    Member

    @bzeiss This should be fixed on the v2-exp branch. You can try it and follow development on this PR: #408

  13. modified the milestones: fix: links, v2.0.0 on Apr 22, 2025
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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions