I'm working on introductory Golang course, and wanted to insert something like https://play.golang.org/ embeddings into my slides. I found out about golang.org/x/tools/present package, and decided to use it for my slides. I insert examples into my in .slide
file using:
.play hello.go
which works almost as expected. I'm just not able to edit example from browser.
In GOPATH/src/golang.org/x/tools/cmd/present/templates/action.tmpl
I see following code:
{{define "code"}}
<div class="code{{if playable .}} playground{{end}}" {{if .Edit}}contenteditable="true" spellcheck="false"{{end}}>{{.Text}}</div>
{{end}}
Which suggests that it is possibly editable. But how to enable it?
As usual, RTFM, in present documentation:
The .code function may take one or more flags immediately preceding the filename. This command shows test.go in an editable text area:
.code -edit test.go
Same works for the .play
command, because as documentation tells us "The function "play" is the same as "code"":
.play -edit hello.go