Noah Petherbridge
1ecff195ac
* Add support for JWT tokens to authenticate users from your external app. * JWT backed users can have profile pictures, profile URLs, and operator status (admin). Note that no operator features exist yet. * Add WelcomeMessages to settings.toml for default ChatServer messages to write to each public channel directed at a new user logging in. * Markdown support for chat messages!
20 lines
448 B
Go
20 lines
448 B
Go
package barertc
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/microcosm-cc/bluemonday"
|
|
"github.com/shurcooL/github_flavored_markdown"
|
|
)
|
|
|
|
// Rendermarkdown from untrusted sources.
|
|
func RenderMarkdown(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 strings.TrimSpace(string(safened))
|
|
}
|