Documentation ¶
Index ¶
- func ApplyBasicAccessibleMarkdown(data []byte) string
- func ApplyBasicMarkdown(data []byte) string
- func ApplyMarkdown(data []byte) string
- func ExtractTitle(content string) (title string, body string)
- func FriendlyPostTitle(content, friendlyId string) string
- func GetSlug(title, lang string) string
- func GetSlugFromPost(title, body, lang string) string
- func PostDescription(content, title, friendlyId string) string
- func PostLede(t string, includePunc bool) string
- func PostTitle(content, friendlyId string) string
- func ShortPostDescription(content string) string
- func StripHTMLWithoutEscaping(content string) string
- func TruncToWord(s string, l int) (string, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyBasicAccessibleMarkdown ¶
ApplyBasicAccessibleMarkdown applies Markdown to the given data, rendering basic text formatting and preserving hard line breaks in HTML. It is meant for formatting text in small, multi-line UI elements, like user profile biographies.
func ApplyBasicMarkdown ¶
func ApplyMarkdown ¶
func ExtractTitle ¶
ExtractTitle takes the given raw post text and returns a title, if explicitly provided, and a body.
func FriendlyPostTitle ¶
func GetSlugFromPost ¶
func PostDescription ¶
PostDescription generates a description based on the given post content, title, and post ID. This doesn't consider a V2 post field, `title` when choosing what to generate. In case a post has a title, this function will fail, and logic should instead be implemented to skip this when there's no title, like so:
var desc string if title == "" { desc = PostDescription(content, title, friendlyId) } else { desc = ShortPostDescription(content) }
func PostLede ¶
PostLede attempts to extract the first thought of the given post, generally contained within the first line or sentence of text.
func ShortPostDescription ¶
func StripHTMLWithoutEscaping ¶
StripHTMLWithoutEscaping strips HTML tags with bluemonday's StrictPolicy, then unescapes the HTML entities added in by sanitizing the content.
Types ¶
This section is empty.