-
Notifications
You must be signed in to change notification settings - Fork 398
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
feat(gnoweb): add hyperlinks to import p/*
and r/*
in source code viewer
#3759
base: master
Are you sure you want to change the base?
Conversation
🛠 PR Checks SummaryAll Automated Checks passed. ✅ Manual Checks (for Reviewers):
Read More🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers. ✅ Automated Checks (for Contributors):🟢 Maintainers must be able to edit this pull request (more info) ☑️ Contributor Actions:
☑️ Reviewer Actions:
📚 Resources:Debug
|
@mous1985 before any reviews, can you add tests, especially testing:
import (
"abc.yx/a/b/c"
"abc.yx/a/b/c"
"abc.yx/a/b/c"
)
import (
hello "abc.yx/a/b/c"
)
import (
_ "abc.yx/a/b/c"
) thanks |
Codecov ReportAttention: Patch coverage is
📢 Thoughts on this report? Let us know! |
@@ -344,3 +344,12 @@ | |||
scrollbar-width: none; | |||
} | |||
} | |||
/* Styling for import links */ | |||
.gno-import { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please try to use Tailwind and its config theme instead of using a new classes, new colors etc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fffb7f4
It's good if i use <a href="/%s$source" class="text-blue-600 hover:underline">"%s"</a>
the same color as the original import ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍 I've left a few points related to refactoring things
start end ==1 to reduce nesting depth
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
remove: review/triage-pending
flag
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice feature 👍
Nit: Could using a regex help by robustly matching import tokens, so we are not relying on fixed strings and specific newline formatting? But maybe it's a picky safeguard against potential changes in output format.
|
return nil | ||
formatted := buf.String() | ||
|
||
// Process .gno files to add links |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a hack
We have an extensible markdown engine, we should implement this as an extension there, unless you can show it's impossible
This PR adds hyperlinks to
package
andrealm
imported in the source code viewer ongnoweb
.When users view source code on
gnoweb
, they often need to explore dependencies and related code. the goal was to make this easier by making imports linkable for example, when you seeimport "gno.land/p/demo/avl"
, you should be able to click it to see that package's source code.thanks to @gfanton for the help