Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var TitleSanitizer *strings.Replacer
TitleSanitizer replaces characters in paste titles that could cause path traversal or filesystem issues, replacing them with safe alternatives.
Functions ¶
func ExtToLang ¶
ExtToLang converts a file extension (e.g. ".py") to a language name (e.g. "python"). Returns "text" if the extension is not recognized.
func GenerateID ¶
func GenerateID() string
GenerateID creates a cryptographically random 6-character alphanumeric string suitable for use as a paste identifier. Uses crypto/rand to prevent ID prediction.
func GetHighlightedPreview ¶
GetHighlightedPreview returns a preview snippet with the search query wrapped in <mark> tags for visual highlighting. Falls back to GetPreview if the query is not found in the content.
func GetPreview ¶
GetPreview returns a cleaned, truncated preview snippet of paste content for display in the sidebar. Limited to 70 characters with HTML escaping.
Types ¶
This section is empty.