Code
API
Interface
func Code(c *tgframe.Container, code string, conf ...*CodeConf)
Parameters
c: Parent container.code: Code to display.conf: Optional configuration, at most one.
// CodeConf provide extra config for Code Component.
type CodeConf struct {
tgframe.Base // ID
// Language is language of code block, leave empty to use `go`
Language string
}
Example
tgcomp.Code(c, "package main\n\nfunc main() {\n\tprintln(\"Hello, World!\")")
tgcomp.Code(c, "print('Hello, World!')",
&tgcomp.CodeConf{
Language: "python",
ID: "mycode",
})