Skip to content

Instantly share code, notes, and snippets.

@dtoebe
Created January 3, 2017 11:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dtoebe/5ed42728f1a51d0a8d3041191802a0c7 to your computer and use it in GitHub Desktop.
Save dtoebe/5ed42728f1a51d0a8d3041191802a0c7 to your computer and use it in GitHub Desktop.
WRITE A SIMPLE MARKDOWN EDITOR WITH GO-QML - main.go - 5
//main.go
...
type HTMLText struct {
...
}
func (h *HTMLText) SetHTMLText(txt string) {
//As you can see this is a method of HTMLText that uses a pointer that we will initialize after we write this code
formattedTxt := blackfriday.MarkdownCommon([]byte(txt)) //blackfriday takes a byte array so we have to convert the txt string to a []byte
h.Text = string(formattedTxt) //Since we want to string literal in the QML we convert the formatted text back to a string and set the h.Text
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment