0

I have html stored in a table returning as a string, and I want to insert it into my html template. Currently it just renders as a string:

Eg. assume my myHtmlString var value is <h3>Hello</h3>

func (h *handler) buildEmailTemplate() model.myEmailModel {
    return model.myEmailModel {
        message: myHtmlString
    }
}

type myEmailModel {
    message: template.HTML '<h1>Hello</h1>'
}

I've tried changing this buildEmailTemplate function to parse to a template.HTML string unsuccessfully:

message: template.HTML(myHtmlString)

1
  • 2
    In what way was the attempted solution unsuccessful? Did the value not render as expected or something else? Commented Apr 28, 2020 at 14:57

1 Answer 1

1

Why not to leave <h1> </h1> in html and pass "hello" or whatever as usual? By default passed argument can be empty string.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.