markdown

package
v0.25.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExtractedData

type ExtractedData struct {
	Tags     []string
	Property *storepb.MemoPayload_Property
}

ExtractedData contains all metadata extracted from markdown in a single pass.

type Option

type Option func(*config)

Option configures the markdown service.

func WithTagExtension

func WithTagExtension() Option

WithTagExtension enables #tag 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)

	// RenderHTML renders markdown content to HTML
	RenderHTML(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. HTML rendering is primarily done on frontend using markdown-it, but backend provides RenderHTML for RSS feeds and other server-side rendering needs.

func NewService

func NewService(opts ...Option) Service

NewService creates a new markdown service with the given options.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL