Documentation
¶
Overview ¶
Package markdown is the markdown engine: parsing memo content into the AST in markdown/ast, the memos-specific syntax in markdown/extensions and markdown/parser (tags, mentions, math, GFM extras), rendering, and the derived memo payload (tags, properties, snippet).
Layering: markdown may import proto/gen and internal. It must not import store, core, or server.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseManagedAttachmentImageURL ¶
ParseManagedAttachmentImageURL parses a same-origin relative managed image URL. Absolute URL origin matching is intentionally left to callers that know the configured instance URL.
Types ¶
type ExtractedData ¶
type ExtractedData struct {
Tags []string
Mentions []string
ImageDestinations []string
ManagedAttachmentReferences []ManagedAttachmentReference
InvalidManagedAttachmentReferences []string
Property *storepb.MemoPayload_Property
}
ExtractedData contains all metadata extracted from markdown in a single pass.
type ManagedAttachmentReference ¶
type ManagedAttachmentReference struct {
UID string
}
ManagedAttachmentReference is an attachment URL embedded using Markdown image syntax.
type Option ¶
type Option func(*config)
Option configures the markdown service.
func WithMentionExtension ¶
func WithMentionExtension() Option
WithMentionExtension enables @mention parsing.
type Service ¶
type Service interface {
// ExtractAll extracts tags, properties, and references in a single parse (most efficient)
ExtractAll(content []byte) (*ExtractedData, error)
// ExtractTags returns all #tags found in content
ExtractTags(content []byte) ([]string, error)
// ExtractProperties computes boolean properties
ExtractProperties(content []byte) (*storepb.MemoPayload_Property, error)
// RenderMarkdown renders goldmark AST back to markdown text
RenderMarkdown(content []byte) (string, error)
// GenerateSnippet creates plain text summary
GenerateSnippet(content []byte, maxLength int) (string, error)
// ValidateContent checks for syntax errors
ValidateContent(content []byte) error
// RenameTag renames all occurrences of oldTag to newTag in content
RenameTag(content []byte, oldTag, newTag string) (string, error)
}
Service handles markdown metadata extraction. It uses goldmark to parse markdown and extract tags, properties, and snippets.
func NewService ¶
NewService creates a new markdown service with the given options.