Pracownia.Programowania/helpers/utils.go

19 lines
276 B
Go
Raw Normal View History

2018-12-11 20:42:44 +01:00
package helpers
import (
"crypto/rand"
"fmt"
2018-12-22 20:04:32 +01:00
"github.com/russross/blackfriday"
2018-12-11 20:42:44 +01:00
)
func GenerateId() string {
b := make([]byte, 8)
rand.Read(b)
return fmt.Sprintf("%x", b)
}
2018-12-22 20:04:32 +01:00
func MarkdownToHtml(s string) string {
return string(blackfriday.MarkdownBasic([]byte(s)))
}