-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Render inline code/file references #29133
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
Conversation
c2c2752
to
23853f9
Compare
aa32138
to
06fbaed
Compare
Please add some tests for newly introduced regex and the function. |
Maybe it can also support branches and tags files but not commits only. |
Have added the requested test.
It would advise against it. These file previews are commonly used with permalinks to discuss a certain state in the codebase and thus need to refer to the state of those files in the moment the issue takes place. Using "dynamic" links, such as a branch or tag, where a commit isnt fixed, can lead to confusion since later the file contains not that what was talked about. |
Needs a merge in |
5232975
to
69a6aa0
Compare
@silverwind Have resolved the conflict and rebased onto main. You're welcome to test now :) |
@Mai-Lapyst Why close this PR? |
Sorry I wasn't able to review sooner. I think this was pretty close to mergeable. |
This PR adds a preview box like github does for permalinks to a range of lines for a file in the repo, e.g:
http://localhost:3000/mai-lapyst/testprojet_ci/src/commit/49fb6d29fad1933818f06eef1bf95f6d7235f3f6/some/deep/folder/test.js#L7-L19
.Closes #20359.
This works in both issues/PRs, as well as other markup rendering for example markdown files.
It's implemented as a processor in
modules/markup/html.go
.It also supports the unicode warnings the "normal" code view of files inside the repo support, as shown in the example rendering.
Example renderings:
