From aa034701df990c2492b444a8022d522a7a795f72 Mon Sep 17 00:00:00 2001 From: Jason Streifling Date: Sun, 18 Feb 2024 10:48:37 +0100 Subject: [PATCH] Show HTML on website --- cmd/handlers/editor.go | 4 ++-- web/templates/editor.html | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/handlers/editor.go b/cmd/handlers/editor.go index 1ff3282..84291a2 100644 --- a/cmd/handlers/editor.go +++ b/cmd/handlers/editor.go @@ -1,7 +1,7 @@ package handlers import ( - "fmt" + "html/template" "log" "net/http" @@ -18,6 +18,6 @@ func HandleFinishedEdit() http.HandlerFunc { log.Panicln(err) } - fmt.Println(html) + template.Must(template.ParseFiles("web/templates/editor.html")).ExecuteTemplate(w, "html-result", html) } } diff --git a/web/templates/editor.html b/web/templates/editor.html index 0a74a5a..010e823 100644 --- a/web/templates/editor.html +++ b/web/templates/editor.html @@ -1,6 +1,10 @@ {{define "page-content"}}
- +
{{end}} + +{{define "html-result"}} +{{.}} +{{end}}