Closed firefart closed 3 months ago
Hi there is a solution for this now that should do the trick for you:
templ x() {
<pre> {`
package main
func main() {
println("Hello, world!")
}
`} </pre>
}
Hi there is a solution for this now that should do the trick for you:
templ x() { <pre> {` package main func main() { println("Hello, world!") } `} </pre> }
Thanks for the hint! Is there a nice way to use and output variables inside this format and keep it somewhat readable?
Yes, I would probably reach for the fmt
package:
templ x(text string) {
<pre> {fmt.Sprintf(`
package main
func main() {
println("%s")
}
`, text)} </pre>
}
Currently
<pre>
tags seem to be handled incorrectly.1)
templ fmt
removes all double newlines and leading and trailing spaces. Text rendered inside