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

x/pkgsite: copy button and view source code link in code snippet #42486

Closed
julieqiu opened this issue Nov 10, 2020 · 5 comments
Closed

x/pkgsite: copy button and view source code link in code snippet #42486

julieqiu opened this issue Nov 10, 2020 · 5 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. pkgsite/dochtml Issues related to package documentation in pkgsite pkgsite

Comments

@julieqiu
Copy link
Member

This feature was originally mentioned in #41587, and is now being tracked as a separate issue:

We'd like to add these features to the documentation section to improve usability:

image

Copy
Next to each code block, we will be adding a copy button, so that users can easily copy and paste the code in that block.

View Source Code
We also want to make jumping to the source identifier a more discoverable feature. To do so, if a block of code corresponds to a function, type or method, we will also include a source code widget. Clicking on that link will take users to the source code.

@gopherbot gopherbot added this to the Unreleased milestone Nov 10, 2020
@julieqiu julieqiu added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Nov 10, 2020
@julieqiu julieqiu modified the milestones: Unreleased, pkgsite/dochtml Nov 10, 2020
@gopherbot
Copy link

Change https://golang.org/cl/277633 mentions this issue: content,internal/godoc/dochtml/internal/render: move pre tag to tmpl

@gopherbot
Copy link

Change https://golang.org/cl/277632 mentions this issue: content,internal/godoc/dochtml: add declaration.tmpl

gopherbot pushed a commit to golang/pkgsite that referenced this issue Dec 14, 2020
Logic for rendering code snippets from the output of render_decl is
moved to a helper template.

The </br> tag is removed for the Constants and Variables sections:
https://photos.app.goo.gl/FosXd66T3nfufaXf7

For golang/go#40939
For golang/go#42486

Change-Id: Icfe61be5f164e0be54e5357602477fc9ed24b05d
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/277632
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Trust: Julie Qiu <julie@golang.org>
gopherbot pushed a commit to golang/pkgsite that referenced this issue Dec 14, 2020
The $out.decl <pre> tag is now generated in the declaration.tmpl,
instead of as a string concatentation in formatDeclHTML.

This will make it easier to style this element in a future CL.

For golang/go#40939
For golang/go#42486

Change-Id: I2f5c0a339020deac002ed32a12ccf68f691cba8f
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/277633
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
@gopherbot
Copy link

Change https://golang.org/cl/278434 mentions this issue: content/static: display source code link HTML

@julieqiu
Copy link
Member Author

Updated mock for this issue:

Screen Shot 2020-12-15 at 3 40 14 PM

gopherbot pushed a commit to golang/pkgsite that referenced this issue Dec 15, 2020
The HTML for the source code link is added. The style is set to
display:none, and will be styled in a future CL.

There are no user facing changes in this CL.

For golang/go#40939
For golang/go#42486

Change-Id: I01ba3ead6b2d0a9ea7dc1488d3b9f5eadb33d472
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/278434
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Trust: Julie Qiu <julie@golang.org>
@gopherbot
Copy link

Change https://golang.org/cl/282072 mentions this issue: content/static: styles for view source link in code snippets

@golang golang locked and limited conversation to collaborators Jan 11, 2022
@hyangah hyangah added the pkgsite/dochtml Issues related to package documentation in pkgsite label May 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. pkgsite/dochtml Issues related to package documentation in pkgsite pkgsite
Projects
None yet
Development

No branches or pull requests

3 participants