embedded

package
v0.0.0-...-4405425 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsEmbeddedURL

func IsEmbeddedURL(url string) bool

IsEmbeddedURL returns true if the URL is for an embedded article.

func SourceURL

func SourceURL(articleURL string) string

SourceURL returns the URL to view the source file for an embedded article. Returns empty string if the base URL isn't configured or the URL isn't embedded.

Types

type EmbeddedArticles

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

EmbeddedArticles holds pre-rendered embedded help articles.

func New

func New(fsys fs.FS, render RenderFunc) (*EmbeddedArticles, error)

New creates a new EmbeddedArticles instance by loading and rendering all markdown files from the given filesystem. The FS should contain a "help/" directory with .md files (e.g. via fs.Sub on the content FS).

func (*EmbeddedArticles) Get

func (ea *EmbeddedArticles) Get(url string) *wiki.Article

Get returns an embedded article by URL, or nil if not found. It returns a shallow copy so callers cannot mutate the shared article.

func (*EmbeddedArticles) List

func (ea *EmbeddedArticles) List() []string

List returns all embedded article URLs.

func (*EmbeddedArticles) RenderAll

func (ea *EmbeddedArticles) RenderAll(render RenderFunc) error

RenderAll re-renders all embedded articles using the given render function. This is useful when the render function depends on state that wasn't available at initial construction time (e.g. the existence checker for wikilinks).

type RenderFunc

type RenderFunc func(markdown string) (string, error)

RenderFunc is a function that renders markdown to HTML.

Jump to

Keyboard shortcuts

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