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: interactive example playgrounds #44090

Closed
jamalc opened this issue Feb 3, 2021 · 4 comments
Closed

x/pkgsite: interactive example playgrounds #44090

jamalc opened this issue Feb 3, 2021 · 4 comments
Assignees
Labels

Comments

@jamalc
Copy link
Member

@jamalc jamalc commented Feb 3, 2021

Documentation pages on pkgsite display static code examples inline with a play button. When the play button is clicked a new tab will open that directs users to an external site (play.golang.org) that runs the code from the example.

In an effort to maintain feature parity with golang.org, we plan to update example playgrounds on documentation pages to be editable and interactive.
Screen Shot 2021-02-03 at 11 44 39 AM
Below each example code snippet on the documentation page we’ll display buttons to run, format, and share the relevant example code. Pressing run displays the result output below the code snippet, format will reformat the code on the current page, and share will display a share link below the code snippet. The buttons will display only for examples that are playable.

@jamalc jamalc added this to the pkgsite/golang.org-redirect milestone Feb 3, 2021
@jamalc jamalc self-assigned this Feb 3, 2021
@gopherbot
Copy link

@gopherbot gopherbot commented Feb 3, 2021

Change https://golang.org/cl/288989 mentions this issue: internal/frontend: add additional endpoints for playground interaction

@gopherbot
Copy link

@gopherbot gopherbot commented Feb 18, 2021

Change https://golang.org/cl/293830 mentions this issue: content/static: copy dochtml templates into legacy files

@gopherbot
Copy link

@gopherbot gopherbot commented Feb 18, 2021

Change https://golang.org/cl/293833 mentions this issue: content/static: interactive example playgrounds

@gopherbot
Copy link

@gopherbot gopherbot commented Feb 18, 2021

Change https://golang.org/cl/293832 mentions this issue: internal/godoc: use legacy templates in dochtml package

gopherbot pushed a commit to golang/pkgsite that referenced this issue Feb 22, 2021
This change creates new endpoints to support interactive
example playgrounds. Requests to "/play/compile" and
"/play/share" are proxied to play.golang.org. Requests to
"/play/fmt" are handled on the pkgsite server using the
go/format package to format code sent in the request body.

For golang/go#44090

Change-Id: If42fea540ae743a32b5afce7edf37b9133219720
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/288989
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
gopherbot pushed a commit to golang/pkgsite that referenced this issue Feb 22, 2021
Copies body.tmpl and example.tmpl into legacy files to
prepare for interactive playground related updates.

For golang/go#44090

Change-Id: I2b7650693d3f3cc373c9a757048e0442ce37f1be
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/293830
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
gopherbot pushed a commit to golang/pkgsite that referenced this issue Feb 22, 2021
Updates dochtml package to refer to legacy
templates in preperation for changes related
to interactive playgrounds.

For golang/go#44090

Change-Id: I5c2c882190de72755a114374869aa050133aaa79
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/293832
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
gopherbot pushed a commit to golang/pkgsite that referenced this issue Feb 22, 2021
Example playgrounds on documentation pages are
editable and interactive. Below each example code
snippet on the documentation page we’ll display
buttons to run, format, and share the snippet.
Pressing run displays the result output below the
code snippet, format will reformat the code inline
and share will display a share link below the code
snippet and open the playground in a new window.

For golang/go#44090

Change-Id: I56d635e60a89a382974ef7100eb4348dbbb4b893
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/293833
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
@jamalc jamalc closed this Feb 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants