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

Support Automatic Link Detection and Hyperlinking #844

Closed
4 tasks done
mayank1513 opened this issue Jul 15, 2024 · 4 comments
Closed
4 tasks done

Support Automatic Link Detection and Hyperlinking #844

mayank1513 opened this issue Jul 15, 2024 · 4 comments
Labels
🙅 no/wontfix This is not (enough of) an issue for this project 👎 phase/no Post cannot or will not be acted on

Comments

@mayank1513
Copy link
Contributor

Initial checklist

Problem

I would like to request support for automatic link detection and hyperlinking in react-markdown. This feature would automatically convert plain text URLs and email addresses into clickable links during the rendering process, without requiring manual Markdown formatting.

Currently, the official alternative requires adding bulky plugins such as remark-gfm.

Solution

Automatic link detection and hyperlinking is a common feature in many markdown parsers and text editors. It enhances user experience by simplifying the process of adding links and ensures that URLs and email addresses are always clickable, improving accessibility and usability.

Create a property autoLink. When this property is set on the ReactMarkdown component, links should be parsed and converted to a tag.

Alternatives

Currently, the official alternative requires adding bulky plugins such as remark-gfm. Another alternative could be using react-markdown-autolink

<Markdown>{autoLinkMd(md)}</Markdown>

This is a tiny library less than 1/2 kB.

@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Jul 15, 2024
mayank1513 added a commit to mayank1513/react-markdown that referenced this issue Jul 15, 2024
@ChristianMurphy
Copy link
Member

Welcome @mayank1513 👋
react-markdown supports commonmark out of the box, no more, no less.
Autolinks are not part of commonmark.

It could be added through an plugin, like remark-gfm.

bulky plugins

If your top priority is bundle size, and you don't need to customize the syntax tree/content with plugins.
Use micromark https://github.com/micromark/micromark

You can shave a lot more than the 10kb that you seem frustrated by currently.

react-markdown-autolink

I appreciate the offer.
Regardless of the above thoughts on API structure.
I don't think adding a pre alpha (0.0.1) library that was published an hour ago with a single test and no sanitization is such a good idea. 😅

@ChristianMurphy ChristianMurphy closed this as not planned Won't fix, can't repro, duplicate, stale Jul 15, 2024
@ChristianMurphy ChristianMurphy added the 🙅 no/wontfix This is not (enough of) an issue for this project label Jul 15, 2024

This comment has been minimized.

@github-actions github-actions bot added 👎 phase/no Post cannot or will not be acted on and removed 🤞 phase/open Post is being triaged manually labels Jul 15, 2024
@mayank1513
Copy link
Contributor Author

Thanks. One additional thing is that, I had initially used remark-gmf for achieving what I want, but it turned out that, remark-gmf does not detect - and _ at the end of the link.

@ChristianMurphy
Copy link
Member

Right that's how auto link detection works on github, see how the autolink is handled below:

https://github.com/micromark/micromark_

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙅 no/wontfix This is not (enough of) an issue for this project 👎 phase/no Post cannot or will not be acted on
Development

Successfully merging a pull request may close this issue.

2 participants