docs

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const Name = "Start documentation server for markdown files"

Name is the command title.

Variables

This section is empty.

Functions

func DocDir added in v0.0.12

func DocDir(ctx context.Context) string

DocDir returns the document directory from context.

func New

func New() *cli.Command

New creates a new docs command.

func Serve

func Serve(ctx context.Context, addr string, contentPath string) error

Serve starts the docs server using the platform.

func ServeDocHandler added in v0.0.12

func ServeDocHandler(m *Module) http.HandlerFunc

ServeDocHandler returns an http.HandlerFunc that serves docs (for testing).

func WithDocDir added in v0.0.12

func WithDocDir(ctx context.Context, dir string) context.Context

WithDocDir returns a context with the document directory.

Types

type DocMeta

type DocMeta struct {
	Title    string `yaml:"title"`
	Subtitle string `yaml:"subtitle"`
	Layout   string `yaml:"layout"`
}

DocMeta represents frontmatter metadata for a doc.

type Module

type Module struct {
	platform.UnimplementedModule

	FS fs.FS
	// contains filtered or unexported fields
}

Module represents the docs module for the platform.

func NewModule

func NewModule(contentFS fs.FS) *Module

NewModule creates a new docs module with a filesystem.

func (*Module) DirectivesHandler added in v0.0.12

func (m *Module) DirectivesHandler() markdown.Handler

DirectivesHandler returns a handler for paragraphs containing @ directives. It detects lines starting with @ and processes them as directives, maintaining compatibility with the legacy @tabs, @render, @file, @example syntax.

func (*Module) LoadMarkdown added in v0.0.12

func (m *Module) LoadMarkdown(filename string) (*markdown.Document, error)

LoadMarkdown loads and parses a markdown file from the module's filesystem.

func (*Module) Mount

func (m *Module) Mount(_ context.Context, r platform.Router) error

Mount registers the docs routes.

func (*Module) Name

func (m *Module) Name() string

Name returns the module name.

func (*Module) TabsHandler added in v0.0.12

func (m *Module) TabsHandler() markdown.Handler

TabsHandler returns a handler for ```tabs code blocks.

type Tab

type Tab struct {
	Label   string
	Content string
	IsCode  bool
	Mode    string // Ace editor mode (html, yaml, json, etc.)
}

Tab represents a single tab.

type TabConfig added in v0.0.12

type TabConfig struct {
	Label string `yaml:"label"`
	Type  string `yaml:"type"` // "render", "file", "example"
	Src   string `yaml:"src"`
}

TabConfig represents a tab definition in YAML.

type TabGroup

type TabGroup struct {
	Tabs []Tab
}

TabGroup represents a group of tabs.

Jump to

Keyboard shortcuts

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