2015-12-11 22:17
浏览 77

如何告诉Sublime Text在HTML内突出显示Go代码?

Sublime Text can highlight HTML. It can highlight Go. I would like to tell Sublime Text 3 to highlight the Go code in between the {{ and }} markers in my HTML to highlight in Go rather than as plain text.

There must be some way to combine the two. I thought surely one of the golang packages on Package Control would address this but I haven't found one that offers an HTML (Go) syntax like GitHub's Atom editor does by default.

图片转代码服务由CSDN问答提供 功能建议

Sublime Text可以突出显示HTML。 它可以突出显示Go。 我想告诉Sublime Text 3在我HTML的 {{}} 标记之间突出显示Go代码,以在Go中突出显示,而不是纯文本。< / p>

必须有某种方式将两者结合起来。 我以为Package Control上的一个golang软件包肯定会解决这个问题,但是我没有找到像GitHub的Atom编辑器默认那样提供 HTML(Go)语法的软件包。

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongwujie7477 2015-12-12 08:05

    The default highlighting packages will not correctly highlight your templates. You'll need to install Package Control and then install GoSublime.

    Once you've done that, open your template file. Then click View > Syntax > GoSublime > GoSublime: HTML.

    You should now have {{define "foo"}}{{end}} highlighted as Go and <p>foo</p> highlighted as HTML.

    解决 无用
    打赏 举报