-
Notifications
You must be signed in to change notification settings - Fork 760
Render bare URLs as hyperlinks #326
Comments
Thank you for opening an issue. If this issue is related to a bug, please follow the steps and provide the information outlined in the Troubleshooting Guide. Failure to follow these instructions may result in automatic closing of this issue. |
Seems this is a "known issue" with Jekyll. I found multiple feature requests of this sort around the internet for various markdown-based apps. Kramdown in particular does not support this. Some implementations support GitHub Flavored Markdown via
So "GFM" is specified, but Kramdown's GFM mode is not actually GFM-compliant. The alternative of specifying
is not supported in FastPages. |
I have a solution, thanks to "@mandy8055" on SO. This will add angle brackets around bare URLs and leave other links (HTML or regular Markdown) alone. I have tested it with some rather complicated URLs and found it to be compliant. Currently this is set up to modify the file in place:
where If you want to see what the output will be first without overwriting the file, you can remove the "-i.orig" in the perl command, and it will just print to stdout. Whether this gets integrated in everyone's fastpages is, totally up to you. The There's a chance that adding this to the fastpages build would break something else somewhere, somehow, whereas users could easily just run this command manually if they want. So, might just leave this here as "handy tip". (I have yet to test this in Jupyter notebooks. ) |
sed -i -E 's@^[^<]?(https?://(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&/=]*))[^>]?$@<\1>@gm' markdown_post.md |
I'll go ahead and close this as you have found a workaround. Thanks for documenting your approach so that other people can find this |
Is your feature request related to a problem? Please describe.
I'm always frustrated when I add bare URLs in my Markdown editor and see them rendered as hyperlinks, but then when fastpages compiles them they are rendered on the blog as merely plain text with no opportunity to click on them. For example typing "https://www.google.com" appears as a clickable link as I'm editing the blog...
(^^ btw see how GitHub automatically rendered that bare URL as a clickable link? That's what I'm used to and that's what I'd like.)
...then I have to go back and manually either add angle-brackets around all the URLs, or add some kind of square-brackets-parentheses construction like
[https://www.google.com](https://www.google.com)
Describe the solution you'd like
That any properly-formatted bare URL gets rendered as a clickable link, i.e. "blue with an underline".
Describe alternatives you've considered
As I mentioned, manually going back and reformatting the URLs.
Additional context
As mentioned, even GitHub Issues formats bare URLs as hyperlinks by default. As do many Markdown viewers.
The text was updated successfully, but these errors were encountered: