writer

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AstroWriter

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

AstroWriter writes content in Astro's expected format. It handles: - Writing docs to src/content/docs/{pkg}/ - Writing assets to public/docs/{pkg}/ - Rewriting relative paths to absolute paths - Injecting/managing frontmatter

func NewAstro

func NewAstro(websiteDir string) *AstroWriter

NewAstro creates a new AstroWriter for the given website directory

func (*AstroWriter) TransformContent

func (w *AstroWriter) TransformContent(content []byte, pkg string, meta DocMetadata) ([]byte, error)

TransformContent applies Astro-specific transformations to markdown content. This delegates to the central transformer package for consistency.

func (*AstroWriter) WebsiteDir

func (w *AstroWriter) WebsiteDir() string

WebsiteDir returns the target website directory

func (*AstroWriter) WriteAsset

func (w *AstroWriter) WriteAsset(pkg, assetType, filename string, data []byte) error

WriteAsset writes an asset file to public/docs/{pkg}/{assetType}/{filename}

func (*AstroWriter) WriteDoc

func (w *AstroWriter) WriteDoc(pkg, filename string, content []byte, meta DocMetadata) error

WriteDoc writes a documentation file to src/content/docs/{pkg}/{filename}

func (*AstroWriter) WriteManifest

func (w *AstroWriter) WriteManifest(manifest []byte) error

WriteManifest writes the manifest file to docgen-output/manifest.json

type DocMetadata

type DocMetadata struct {
	Title       string
	Description string
	Category    string
	Version     string
	Order       int
	Package     string // Package title (for display)
}

DocMetadata contains metadata about a documentation file

type Writer

type Writer interface {
	// WriteDoc writes transformed markdown to the appropriate location
	WriteDoc(pkg, filename string, content []byte, meta DocMetadata) error

	// WriteAsset copies an asset (image, video, cast) to the appropriate location
	WriteAsset(pkg, assetType, filename string, data []byte) error

	// WriteManifest writes the manifest file
	WriteManifest(manifest []byte) error

	// TransformContent applies SSG-specific transformations (paths, frontmatter)
	TransformContent(content []byte, pkg string, meta DocMetadata) ([]byte, error)

	// WebsiteDir returns the target website directory
	WebsiteDir() string
}

Writer abstracts output format for different static site generators. This allows docgen to support multiple SSGs like Astro, Hugo, Docusaurus, etc.

Jump to

Keyboard shortcuts

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