dongou3286 2018-07-09 11:38
浏览 46
已采纳

在Golang当前演示文稿中编辑.play代码段

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?

  • 写回答

1条回答 默认 最新

  • dtoaillwk759656786 2018-07-09 13:00
    关注

    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
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Matlab在app上输入带有矩阵形式的初始条件发生错误
  • ¥15 CST仿真别人的模型结果仿真结果S参数完全不对
  • ¥15 误删注册表文件致win10无法开启
  • ¥15 请问在阿里云服务器中怎么利用数据库制作网站
  • ¥60 ESP32怎么烧录自启动程序
  • ¥50 html2canvas超出滚动条不显示
  • ¥15 java业务性能问题求解(sql,业务设计相关)
  • ¥15 52810 尾椎c三个a 写蓝牙地址
  • ¥15 elmos524.33 eeprom的读写问题
  • ¥15 用ADS设计一款的射频功率放大器