GUI packages, examples, and documentation for building desktop applications with Go and web technologies. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2.8 KiB
2.8 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 IPC action system:
// Automatically uses display.open_window action
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:
- Edit documentation in
docs/directory - Build with MkDocs:
mkdocs build - The built site goes to
pkg/help/public/ - 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 |
IPC Action
When using Display service, help triggers this action:
{
"action": "display.open_window",
"name": "help",
"options": {
"Title": "Help",
"Width": 800,
"Height": 600,
"URL": "/#anchor", // When using ShowAt
},
}