help

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package help is Docflow's manual: chapters written in Markdown beside this file, in English (en) and Japanese (ja), embedded in the binary and served by the web application at /help for everyone signed in. The same files read on GitHub: a link between chapters is written as jobs.md and rewritten to the page's URL when served.

Every chapter has the same name in every language, and the same section ids (an explicit {#id} on each heading), so that a link to a section works in any language, and the pages' own links to the manual (/help/nodes#printer) need no language.

Index

Constants

View Source
const Path = "/help"

Path is where the manual is served: /help/<lang>/<chapter>.

Variables

View Source
var Chapters = []string{"index", "jobs", "topology", "nodes", "flow", "templates", "entries", "downloads", "displays", "inboxes", "roles", "api", "operate"}

Chapters in the order of the manual: the files' names, without .md, the same in every language. The first is the overview, served at /help/<lang> as well.

View Source
var Languages = []string{"en", "ja"}

Languages the manual is written in, the first the default: the directories beside this file.

Functions

func IsLang

func IsLang(s string) bool

IsLang tells a language the manual is written in. They are the pages' languages (popcornweb.toml's [i18n]): a page links the manual in its own language.

func Links(lang, name string) ([]string, error)

Links lists the destinations of the links of a chapter's source, for the tests to check: each as written.

func URL

func URL(lang, name string) string

URL is the path of a chapter: /help/<lang>/<name>, the overview at /help/<lang>.

Types

type Page

type Page struct {
	Lang     string
	Name     string
	Title    string
	HTML     string
	Sections []Section
	// IDs are the ids of every heading of the page, for links to check
	// against.
	IDs []string
}

Page is a chapter rendered: its title (the heading at the top), the body as HTML, and its sections (the second-level headings) for a table of contents.

func Appended

func Appended(p *Page, src []byte) (*Page, error)

Appended is a page with Markdown added at its end: the chapters of the kinds of node a program registers (docflow.Kind.Doc), after the core's in nodes.md. The page itself is not changed.

func Get

func Get(lang, name string) (*Page, bool)

Get returns a chapter in a language, rendered; false when there is no such chapter or language.

func Pages

func Pages(lang string) []*Page

Pages returns the chapters of a language, in the manual's order.

type Section

type Section struct {
	ID    string
	Title string
}

Section is a heading of a page: its id (the fragment of a link to it) and its text.

Jump to

Keyboard shortcuts

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