I'm trying so use the following function in my main
package:
html.go (from blackfriday):
func doubleSpace(out *bytes.Buffer) {
if out.Len() > 0 {
out.WriteByte('
')
}
}
main.go:
func (options *renderer) Paragraph(out *bytes.Buffer, text func() bool) {
marker := out.Len()
doubleSpace(out)
out.WriteString("<p class='custom'>")
if !text() {
out.Truncate(marker)
return
}
out.WriteString("</p>
")
}
I tried doing blackfriday.doubleSpace
and blackfriday.DoubleSpace
but in the three cases I get undefined
.
What's the correct way to do it?
You can't. That is a deliberate decision by the authors of blackfriday. Your only option is to define your own function which does the same thing. It's just like accessing a private member in a language like Java.
See the spec here: https://golang.org/ref/spec#Exported_identifiers