Created
January 3, 2017 11:55
-
-
Save dtoebe/5ed42728f1a51d0a8d3041191802a0c7 to your computer and use it in GitHub Desktop.
WRITE A SIMPLE MARKDOWN EDITOR WITH GO-QML - main.go - 5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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