Skip to content

Raw HTML

How to show embedded HTML with ui.RichText.

Raw HTML

package main

import (
	_ "embed"

	"go.wdy.de/nago/application"
	"go.wdy.de/nago/presentation/core"
	. "go.wdy.de/nago/presentation/ui"
	"go.wdy.de/nago/web/vuejs"
)

//go:embed html.gohtml
var html string

func main() {
	application.Configure(func(cfg *application.Configurator) {
		cfg.SetApplicationID("de.worldiety.tutorial_92")
		cfg.Serve(vuejs.Dist())

		cfg.RootView(".", func(wnd core.Window) core.View {
			return VStack(
				RichText(html).Frame(Frame{
					MaxWidth: "420px",
				}),
			).Alignment(Center).Frame(Frame{Height: "100vh", Width: "100vw"})
		})

	}).Run()
}

View on GitHub ↗ · run it with go run go.wdy.de/nago/example/cmd/tutorial-92-raw-html@latest