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

More closely follow CommonMark for link auto-generation. #3839

Closed
laurent22 opened this issue Sep 27, 2020 · 4 comments · Fixed by #3975
Closed

More closely follow CommonMark for link auto-generation. #3839

laurent22 opened this issue Sep 27, 2020 · 4 comments · Fixed by #3975
Labels
enhancement Feature requests and code enhancements high High priority issues renderer About the note renderer spec Fully developed spec that can serve as a starting point for a project

Comments

@laurent22
Copy link
Owner

laurent22 commented Sep 27, 2020

Current behaviour

Proposed behaviour

  • https://example.com => https://example.com
  • file://C:\AUTOEXEC.BAT => file://C:\AUTOEXEC.BAT
  • example.com => example.com
  • oo.ps => oo.ps
  • [email protected] => test@example.com
  • <https://example.com> => https://example.com

In general Joplin auto-links too much text, which is not necessary as Markdown already provides way to explicitly create a link. It is reasonable to auto-link URLs that start with a valid URL schemes, but other cases should be disabled.

CommonMark does not auto-link anything except for URLs within < >

@laurent22 laurent22 added enhancement Feature requests and code enhancements high High priority issues renderer About the note renderer labels Sep 27, 2020
@dpoulton-github
Copy link

Personal opinion is that Joplin should follow Commonmark. Any active links would have to be explicitly defined using the [name](link) or <link> formats. This would mean that any exported Markdown should be reproduced, as intended by the author, in any other Markdown-based app and would also remove the chance of "false positives".

HOWEVER

I appreciate that a certain amount of "auto-linking" adds somewhat to the ease and speed of use and, if an option to switch off auto-linking is not considered suitable, a logic that minimises "false positives" (as proposed above) sounds like a good compromise. Some URL-like text would still have to be purposefully "neutered" using HTML to break the hyperlink but the occurrance of such situations should be reduced.

@laurent22
Copy link
Owner Author

Personal opinion is that Joplin should follow Commonmark.

Yes, ideally I'd prefer to stick closely to the CommonMark spec. It's hard to evaluate whether we really need auto-links for URL-like text. I don't think I need it much personally. Perhaps it's a matter of disabling it completely and see what users will say. We can always document that they should add <> around the URLs.

@tessus
Copy link
Collaborator

tessus commented Sep 28, 2020

Well, that's the thing. I believe people are really split on that topic. That's why an option would make sense. Especially since it is just a boolean for the markdown-it renderer. Adding additional code to have a "better" link recognition actually is against your initial sentiment with regards to code maintenance.
Setting a flag however has no maintenance implications.

@laurent22 laurent22 added the spec Fully developed spec that can serve as a starting point for a project label Oct 9, 2020
@laurent22 laurent22 mentioned this issue Oct 9, 2020
29 tasks
laurent22 added a commit that referenced this issue Oct 31, 2020
@laurent22
Copy link
Owner Author

Implemented here: #3975

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests and code enhancements high High priority issues renderer About the note renderer spec Fully developed spec that can serve as a starting point for a project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants