website/pkg/markdown/markdown.go
Noah de3d6e9315 User Profile and Settings Pages
* Vendor fontawesome icons
* User settings page: to edit profile details (other features not hooked
  up yet)
* Initial user profile page
2022-08-10 20:59:59 -07:00

19 lines
467 B
Go

// Package markdown provides markdown render functions.
package markdown
import (
"github.com/microcosm-cc/bluemonday"
"github.com/shurcooL/github_flavored_markdown"
)
// Render markdown from untrusted sources.
func Render(input string) string {
// Render Markdown to HTML.
html := github_flavored_markdown.Markdown([]byte(input))
// Sanitize the HTML from any nasties.
p := bluemonday.UGCPolicy()
safened := p.SanitizeBytes(html)
return string(safened)
}