Documentation
¶
Overview ¶
Package builtin provides embedded documentation that can be deployed as a regular project.
Index ¶
- Constants
- Variables
- func ConvertToHTML(mdContent []byte, nav []DocEntry, currentPath, basePath string) ([]byte, error)
- func GetDocsFS() fs.FS
- func GetIndexContent() ([]byte, error)
- func GetProjectSlug() string
- func GetTitle(content []byte, fallback string) string
- func HasFile(path string) bool
- func IsBuiltinDocsProject(slug string) bool
- func ListMarkdownFiles() ([]string, error)
- func MustReadFile(path string) []byte
- func NormalizePath(path string) string
- func ReadMarkdown(path string) ([]byte, error)
- func TransformMarkdownLinks(content []byte) []byte
- func ValidateDocs() error
- type Deployer
- type DocEntry
- type MissingDocsError
- type PageData
Constants ¶
const ( // ProjectSlug is the slug used for the built-in docs project. ProjectSlug = "asiakirjat-docs" // ProjectName is the display name for the built-in docs project. ProjectName = "Asiakirjat Documentation" // ProjectDescription is the description for the built-in docs project. ProjectDescription = "Built-in documentation for Asiakirjat" )
Variables ¶
var Version = "dev"
Version is the application version, set from main.go via ldflags.
Functions ¶
func ConvertToHTML ¶
ConvertToHTML converts markdown content to a full HTML page with navigation.
func GetIndexContent ¶
GetIndexContent returns the index.md content.
func GetProjectSlug ¶
func GetProjectSlug() string
GetProjectSlug returns the slug for the built-in docs project.
func GetTitle ¶
GetTitle extracts the title from markdown content. It looks for the first # heading, or falls back to the filename.
func IsBuiltinDocsProject ¶
IsBuiltinDocsProject returns true if the given slug is the built-in docs project.
func ListMarkdownFiles ¶
ListMarkdownFiles returns all markdown file paths in the docs.
func MustReadFile ¶
MustReadFile reads a file and panics if it doesn't exist. Only use during initialization.
func NormalizePath ¶
NormalizePath normalizes a path for comparison.
func ReadMarkdown ¶
ReadMarkdown reads a markdown file from the embedded docs.
func TransformMarkdownLinks ¶
TransformMarkdownLinks converts .md links to .html links in content.
func ValidateDocs ¶
func ValidateDocs() error
ValidateDocs checks that all required documentation files exist.
Types ¶
type Deployer ¶
type Deployer struct {
Storage docs.Storage
Projects store.ProjectStore
Versions store.VersionStore
SearchIndex *docs.SearchIndex
BasePath string // URL base path (e.g., "/docs")
Logger *slog.Logger
}
Deployer handles deployment of built-in documentation.
type DocEntry ¶
type DocEntry struct {
Title string // Display title (from # heading or filename)
Path string // Relative path without extension (e.g., "tutorials/getting-started")
HTMLPath string // Path with .html extension
Children []DocEntry // Subdirectory entries (for directories)
IsDir bool // Whether this is a directory
Order int // Sort order for display
}
DocEntry represents a documentation file or directory.
func ParseDocTree ¶
ParseDocTree parses the embedded docs directory and returns a structured tree.
type MissingDocsError ¶
type MissingDocsError struct {
Missing []string
}
MissingDocsError is returned when required docs are missing.
func (*MissingDocsError) Error ¶
func (e *MissingDocsError) Error() string