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

Hyperlinks are not rendered correctly #48

Open
patrickelectric opened this issue Sep 30, 2023 · 10 comments
Open

Hyperlinks are not rendered correctly #48

patrickelectric opened this issue Sep 30, 2023 · 10 comments

Comments

@patrickelectric
Copy link

https://anvilproject.org/guides/content/creating-links

image

@segfaultsourcery
Copy link

I'm interested in this as well. I would love for there to be buttons or links.

@exor2008
Copy link

exor2008 commented Apr 4, 2024

@patrickelectric @segfaultsourcery @
Any ideas, what exactly the links should look like?
If this is a link to another md file, it can be clickable.
But what if it's an actual http link?
Something like Google search (https://google.com/)?

@patrickelectric
Copy link
Author

That's a great question, I believe that it depends. It would be nice to have a configuration for such thing. I would believe that the showing the link is the best way for a presentation, but that should be up to who is presenting. If we do normal hyperlink without showing the link by default, the user would be free to add the link in the text. If we do otherwise, it'll not be possible for the user to remove it. So, if there will not be a setting for such behavior, I would vote for not having it.

@segfaultsourcery
Copy link

segfaultsourcery commented Apr 4, 2024 via email

@patrickelectric
Copy link
Author

Would it be possible to implement a special class of link that somehow signals back what was clicked? What I mean by that is that I think it would be immensely useful if we could define a button in markdown, for example like this: I am a button If the button is clicked, the signal (this-is-a-signal) is emitted somewhere (perhaps a channel) where the developer can handle it.

On Thu, Apr 4, 2024, 06:40 exor2008 @.> wrote: @patrickelectric https://github.com/patrickelectric @segfaultsourcery https://github.com/segfaultsourcery @ Any ideas, what exactly the links should look like? If this is a link to another md file, it can be clickable. But what if it's an actual http link? Something like Google search (https://google.com/)? — Reply to this email directly, view it on GitHub <#48 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGF4MBXO66HEA72URHDPITY3TKTRAVCNFSM6AAAAAA5NZQ5RKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZWGE3TSMJTGM . You are receiving this because you were mentioned.Message ID: @.>

There is a terminal protocol just for that

@exor2008
Copy link

exor2008 commented Apr 4, 2024

I see it this way:

let mut skin = MadSkin::default();
skin.link.style = Link::TextAndLink // or Link::Text or Link::Link

where
Link::TextAndLink will display

Google search (https://google.com/)

Link::Text will display

Google search

Link::Link will display

https://google.com/

Click on it will generate event, so developer can handle it. Like, display another md file or just ignore it if it was random http link.

@exor2008
Copy link

exor2008 commented Apr 6, 2024

@Canop what do you think?

@Canop
Copy link
Owner

Canop commented Apr 6, 2024

@exor2008 There are two separate concerns here:

  • web-like rendering of hyperlinks, making them clickable using the almost standard terminal protocol
  • buttons with some kind of callback system

I'd rather keep the present issue focused on the expected link rendering, that is [a](b) would just display a but trigger a call to b URI using standard platform opener.

The reasons I didn't initially did it were:

  • not all terminals support it
  • in my use cases, I prefer to display the URL and almost all terminals supports clicks on links so instead of [a](b) you can put b.

The reason I don't do it now is just that I don't have time enough at the moment.

@exor2008
Copy link

exor2008 commented Apr 6, 2024

@Canop sure, it's a great job done already.
Do you accept pull requests?
Looks like, minimad should be changed first here.

@Canop
Copy link
Owner

Canop commented Apr 7, 2024

Do you accept pull requests?

I do accept a lot of them, but I'm cautious. See https://dystroy.org/blog/contributing/

Looks like, minimad should be changed first here.

Exact

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

4 participants