gui/docs/framework/help.md
Virgil 450d04411a
Some checks failed
Security Scan / security (push) Failing after 14s
Test / test (push) Successful in 1m5s
refactor(ax): remove legacy compatibility aliases
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-31 07:28:11 +00:00

2.7 KiB

Help Service

The Help service (pkg/help) provides an embeddable documentation system that displays MkDocs-based help content in a dedicated window.

Features

  • Embedded help content (MkDocs static site)
  • Context-sensitive help navigation
  • Works with or without Display service
  • Multiple content sources (embedded, filesystem, custom)

Basic Usage

import "github.com/Snider/Core/pkg/help"

// Create with default embedded content
helpService, err := help.New(help.Options{})

// Initialize with core dependencies
helpService.Init(coreInstance, displayService)

Showing Help

// Show main help window
err := helpService.Show()

// Show specific section
err := helpService.ShowAt("getting-started")
err := helpService.ShowAt("api/config")

Options

type Options struct {
    Source string  // Path to help content directory
    Assets fs.FS   // Custom filesystem for assets
}

Default Embedded Content

// Uses embedded MkDocs site
helpService, _ := help.New(help.Options{})

Custom Directory

// Use local directory
helpService, _ := help.New(help.Options{
    Source: "/path/to/docs/site",
})

Custom Filesystem

//go:embed docs/*
var docsFS embed.FS

helpService, _ := help.New(help.Options{
    Assets: docsFS,
})

Integration with Core

The help service can work standalone or integrated with Core:

With Display Service

When Display service is available, help opens through the display service's declarative window API:

helpService.Init(core, displayService)
helpService.Show()

Without Display Service

Falls back to direct Wails window creation:

// Creates window directly via Wails
helpService.Init(core, nil)
helpService.Show()

Lifecycle

// Called on application startup
err := helpService.ServiceStartup(ctx)

Building Help Content

Help content is a static MkDocs site. To update:

  1. Edit documentation in docs/ directory
  2. Build with MkDocs:
    mkdocs build
    
  3. The built site goes to pkg/help/public/
  4. Content is embedded at compile time

Frontend Usage (TypeScript)

import { Show, ShowAt } from '@bindings/help/service';

// Open help window
await Show();

// Open specific section
await ShowAt("configuration");
await ShowAt("api/display");

Help Window Options

The help window opens with default settings:

Property Value
Title "Help"
Width 800px
Height 600px

Display Integration

The help window spec stays internal to the service. Callers initialize the help service with the display service and then call Show() or ShowAt(); the display layer opens the window from a declarative window.Window spec.