Documentation
¶
Overview ¶
Package cmsrender owns Lesser's canonical Article rendering boundary.
Index ¶
Constants ¶
View Source
const ( // FormatHTML identifies already-HTML source that must be sanitized before output. FormatHTML = "html" // FormatMarkdown identifies Markdown source rendered to HTML and then sanitized. FormatMarkdown = "markdown" // MaxArticleSourceBytes caps submitted Article source before rendering. MaxArticleSourceBytes = 256 * 1024 // MaxArticleRenderedHTMLBytes caps server-rendered Article HTML output. MaxArticleRenderedHTMLBytes = 512 * 1024 )
Variables ¶
View Source
var ( // ErrUnsupportedContentFormat is wrapped when an Article content format is unsupported. ErrUnsupportedContentFormat = errors.New("unsupported article content format") // ErrArticleContentTooLarge is wrapped when Article source exceeds MaxArticleSourceBytes. ErrArticleContentTooLarge = errors.New("article content exceeds maximum source size") // ErrArticleRenderedContentTooLarge is wrapped when rendered output exceeds MaxArticleRenderedHTMLBytes. ErrArticleRenderedContentTooLarge = errors.New("rendered article content exceeds maximum output size") )
Functions ¶
func NormalizeFormat ¶
NormalizeFormat returns the storage-level content format. Empty source defaults to Markdown.
func SanitizeArticleHTML ¶
SanitizeArticleHTML sanitizes Article HTML source/output using the CMS publication policy.
func ValidateArticleSource ¶
ValidateArticleSource enforces source-format and source-size rules without rendering.
Types ¶
type LimitError ¶
LimitError reports deterministic, user-facing Article renderer limits.
func (*LimitError) Error ¶
func (e *LimitError) Error() string
func (*LimitError) Unwrap ¶
func (e *LimitError) Unwrap() error
Unwrap returns the sentinel limit cause.
type RenderedArticleContent ¶
type RenderedArticleContent struct {
HTML string
SourceFormat string
SourceBytes int
RenderedBytes int
}
RenderedArticleContent is the public Article body produced by the canonical renderer.
func RenderArticleContent ¶
func RenderArticleContent(content string, format string) (RenderedArticleContent, error)
RenderArticleContent renders Article source to the canonical sanitized public HTML body.
Click to show internal directories.
Click to hide internal directories.