Comments (8)
Thanks for your research!
As it's not an issue with this project, I'll close this issue.
from xdg-ninja.
I have created an issue within the glow repository after doing some additional testing. It appears to be a bug within glow, not this program. The solution I have proposed here and in the glow issue should resolve things. If glow takes too long to fix this, it could potentially be implemented as a hacky fix within this program until glow fixes it on their end.
from xdg-ninja.
This is definitely an issue with glow.
I don't think I want to implement a fix here, it's outside the scope of this project. I'll keep up with the issue in glow.
If you can find a maintainable solution for this repo, I'd be more than happy to look at a PR, though.
Thank you for bringing this to my attention.
from xdg-ninja.
Upon closer inspection, this doesn't seem to be an issue with glow, you should be able to configure this.
You can invoke glow with the -s flag and provide a custom style definition in json, see this page for details. I think using the prefix, suffix, and block_prefix/block_suffix, you should be able to wrap links in this escape sequence.
I'm sceptical about whether we should use that as a default, though, since not many terminal emulators seem to actually support this escape sequence.
Here's the relevant PR for alacritty, for example.
If you're interested, you could see if you manage to create a style definition for this, it shouldn't be that hard, afterwards, we could think about trying to detect that ability, but I don't want to add much complexity to this script, so I can't promise anything about merging such functionality.
from xdg-ninja.
Isn't this related to the terminal's capability to create links automatically from text?
I cannot reproduce this on alacritty
or gnome-terminal
. What terminal are you using @EricAndrechek?
from xdg-ninja.
I'm sceptical about whether we should use that as a default, though, since not many terminal emulators seem to actually support this escape sequence.
That's what I was talking about. You can reproduce their issue using kitty though.
from xdg-ninja.
Upon closer inspection, this doesn't seem to be an issue with glow, you should be able to configure this.
I say it is an issue with glow, as I believe it should do that for you. When I write [a link](https://example.com)
in markdown "a link", it creates a hyperlink. I don't have to specify line breaks or anything, it sorts that out for me. If the link wraps to a new line, the whole thing is still valid, it doesn't separate the URL onto two different lines making both lines invalid.
Isn't this related to the terminal's capability to create links automatically from text?
As to this comment, I don't believe so, no. In my testing with gnome-terminal, running
echo "https://example.com/really-long-link-to-test-a-line-break-that-is-well-over-the-default-80-character-line-length-to-force-the-terminal-to-automatically-wrap-this-text"
will automatically wrap as handled by the terminal, and is still a valid and clickable link, as shown below.
Glow/glamour handles rendering the markdown differently than expected, however. The markdown is not turned into a hyperlink within the terminal, which I understand as it means that even if your terminal doesn't support the special hyperlink escape sequences it can still identify the full link to automatically turn it into a clickable link, or allow you to copy and paste it into a web browser. Here is an illustration of the differences I am talking about:
IMO, the first hyperlink option is easily the cleanest, but I understand that it may not work on every terminal. The second option clearly works as an alternative, which is fine. The problem arises with the third method. Glow identifies that the terminal width is 80 and manually tells the text to wrap, instead of letting the terminal handle it. This breaks the link. If I tell glow to ignore the terminal width and use a wrap length longer than the link, the terminal wraps it automatically and the link still works.
from xdg-ninja.
Ok - follow up here. I attempted to using the styling json for glamour/glow to make the hyperlinking work, but unfortunately the order glamour puts them in is incorrect for what the hyperlink expects, and without making modifications to glow this seems impossible. My json was as follows:
{
"link": {
"block_prefix": "\\033\\\\",
"block_suffix": "\\033]8;;\\033\\\\\n"
},
"link_text": {
"block_prefix": "\\033]8;;"
}
}
But unfortunately, glow doesn't actually listen to the escape sequences:
Wrapping the whole thing inside an echo will have it listen to the escape sequences and render correctly:
But as you can see, the link and the link_text are flipped. This is not the way the terminal hyperlink expects it. Again, not an easy fix to this other than modifying glamour's code. Luckily, there seem to already be some people aware of this and working on it: Glamour: Feature: Support 'modern' anchors through ANSI OSC 8 escapes, and Github CLI: Auto-detected links with new lines result in 404s when clicked
from xdg-ninja.
Related Issues (20)
- [Feature Request] Lint mode? HOT 5
- Add option to output to a file HOT 3
- Detection missing for .gtk-bookmarks
- Detection missing for .irb_history
- Detection missing for GNU Solfege
- Detection missing for uim.d
- Detection missing for jack
- Detection missing for .hyprland
- Detection missing for .krew
- Move references to issues and versions supporting XDG to separate keys
- More dotfiles HOT 1
- A better python_history solution HOT 2
- Explain when and where to move files HOT 1
- Feature request: only show actionable points HOT 2
- Update xdg ninja to say that the .minecraft folder can't be moved because the --workDir flag broke.
- [BUG] xdg-ninja says to move ~/.fonts.conf to $XDG_DATA_HOME instead of $XDG_CONFIG_HOME HOT 1
- Allow list support
- Add flake-compat
- Makefile could use 'chmod' on programs subdirectory
- Update swifttmp HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xdg-ninja.