Documentation
¶
Overview ¶
Package markdown owns Markdown parsing and rendering for presentation and generated-file boundaries.
Index ¶
- func DecodeFrontmatter(source []byte, destination any) (body []byte, found bool, err error)
- func DecodeFrontmatterReader(source io.Reader, destination any) (body io.Reader, found bool, err error)
- func EncodeFrontmatter(metadata any, body []byte) ([]byte, error)
- func RewriteReferences(source string, replace func(reference.Identity) string) string
- type AttachmentResolver
- type IssueReferenceResolver
- type LogReferenceResolver
- type Renderer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeFrontmatter ¶
DecodeFrontmatter parses YAML frontmatter into destination and returns the authored Markdown body that follows it. Found is false when source has no frontmatter.
func DecodeFrontmatterReader ¶
func DecodeFrontmatterReader( source io.Reader, destination any, ) (body io.Reader, found bool, err error)
DecodeFrontmatterReader parses YAML frontmatter from source and returns the remaining Markdown body without retaining that body in memory.
Body is nil when source has no frontmatter. DecodeFrontmatterReader does not close source. The source owner retains close ownership through body consumption.
func EncodeFrontmatter ¶
EncodeFrontmatter encodes metadata as YAML frontmatter followed by body.
Types ¶
type AttachmentResolver ¶
type AttachmentResolver interface {
// ResolveAttachments returns input-aligned attachment outcomes.
ResolveAttachments(context.Context, attachment.ResolveRequest) ([]attachment.Resolution, error)
}
AttachmentResolver resolves one board-scoped attachment reference batch.
type IssueReferenceResolver ¶
type IssueReferenceResolver interface {
// ResolveIssueReferences returns issue IDs known to the board.
ResolveIssueReferences(
context.Context,
board.ID,
[]issue.ID,
) ([]issue.ID, error)
}
IssueReferenceResolver resolves one board-scoped issue reference batch.
type LogReferenceResolver ¶
type LogReferenceResolver interface {
// ResolveLogReferences returns log ownership metadata known to the board.
ResolveLogReferences(
context.Context,
board.ID,
[]issue.LogID,
) ([]issue.LogReference, error)
}
LogReferenceResolver resolves one board-scoped log reference batch.
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer applies Cardamom's shared safe Markdown policy.
func New ¶
func New() *Renderer
New constructs a Renderer with GFM, server-side code highlighting, Mermaid diagram markup, and Goldmark's safe HTML defaults. The browser owns diagram rendering and script loading.
func NewWithAttachments ¶
func NewWithAttachments(attachments AttachmentResolver) *Renderer
NewWithAttachments constructs a Renderer that resolves attachment destinations in board-scoped batches.
func NewWithReferences ¶
func NewWithReferences( attachments AttachmentResolver, issues IssueReferenceResolver, logs LogReferenceResolver, ) *Renderer
NewWithReferences constructs a Renderer that resolves attachment destinations and typed Cardamom references in board-scoped batches.
func (*Renderer) RenderBoard ¶
func (r *Renderer) RenderBoard( ctx context.Context, boardID board.ID, routePrefix string, sources []string, ) ([]string, error)
RenderBoard renders one response's Markdown sources after resolving unique typed references and attachment destinations in bounded board-scoped batches.