content

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package content provides markdown file monitoring, caching, and change notification services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Timestamp time.Time `json:"timestamp"`
	Type      string    `json:"type"`
	Path      string    `json:"path,omitempty"`
}

Event describes change notifications emitted to subscribers.

type Options

type Options struct {
	IncludeHidden bool
}

Options configures the content service.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service coordinates content rendering, indexing, and change notifications.

func NewService

func NewService(parentCtx context.Context, root string, rendererSvc *renderer.Service, logger *slog.Logger, opts Options) (*Service, error)

NewService initializes content monitoring rooted at path.

func (*Service) Close

func (s *Service) Close() error

Close releases resources associated with the service.

func (*Service) CreateDocument

func (s *Service) CreateDocument(ctx context.Context, relPath string, data []byte) error

CreateDocument creates a new markdown document with the provided contents.

func (*Service) CurrentTree

func (s *Service) CurrentTree(ctx context.Context) (*tree.Node, error)

CurrentTree returns the cached tree snapshot.

func (*Service) DebugStatus

func (s *Service) DebugStatus() map[string]any

DebugStatus returns diagnostic information for testing.

func (*Service) DeleteDocument

func (s *Service) DeleteDocument(ctx context.Context, relPath string) error

DeleteDocument removes a markdown document from disk.

func (*Service) Document

func (s *Service) Document(ctx context.Context, relPath string) (renderer.Document, error)

Document loads and renders a markdown document by relative path.

func (*Service) RenameDocument

func (s *Service) RenameDocument(ctx context.Context, fromPath, toPath string) error

RenameDocument renames an existing markdown document to a new path.

func (*Service) SaveDocument

func (s *Service) SaveDocument(ctx context.Context, relPath string, data []byte) error

SaveDocument writes updated markdown contents to an existing document.

func (*Service) Subscribe

func (s *Service) Subscribe(ctx context.Context) <-chan Event

Subscribe registers for change events. The returned channel will close when ctx is done.

Directories

Path Synopsis
Package tree builds hierarchical navigation trees from markdown file directories.
Package tree builds hierarchical navigation trees from markdown file directories.

Jump to

Keyboard shortcuts

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