vdoc: enable browser custom search with ?q=<search> #20949
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some browsers (e.g. Chrome) have a feature called "site search" that allow you to associate a shortcut with a custom site search string URL. For example, the shortcut "gl" can be set to
https://pkg.go.dev/search?q=%s
such that if you type "gl net/http" the browser would search forhttps://pkg.go.dev/search?q=net/http
which then redirects tohttps://pkg.go.dev/net/http
.This PR would allow users to create a "vl" shortcut set to
https://modules.vlang.io/?q=%s
that would immediately act as if the user had typedCtrl-k
followed by their search string.I have tested this locally with
?q=<alert>yo</alert>
and?q=<alert>yo</alert>
and it appears thatencodeURIComponent
does not need to be called, as these characters are being escaped already.Note that I ran
v test-all
locally and there were 5 errors that appear to be unrelated to this change:This was run on a Mac M2 Max running Sonoma 14.2.