Make URLs in blob viewer and blob editor into clickable links
What does this MR do?
In the file contents displayed by the blob viewer and blob editor, make URLs into clickable links.
In both viewer and editor
- consider anything starting with
http://
orhttps://
and consisting of URL safe characters to be a URL - URL safe characters are defined as anything other than whitespace, backticks, or any of
"<>{|}
- style links as if they were no different from the rest of the line (remove theme-specific colors)
- on hover, show an underline to indicate that they are links (and remove existing underlines from some links in editor)
In viewer only
- when a link is clicked, navigate to it in the same window/tab
In editor only
- when a link is clicked, open it in a new tab (
target="_blank"
)
Screenshots
Before | After |
---|---|
viewer_after | |
editor_after |
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation created/updated or follow-up review issue created -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Performance and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Issue link: #30808 (closed)
Edited by Miranda Fluharty