Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsEmbeddedURL ¶
IsEmbeddedURL returns true if the URL is for an embedded article.
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 ¶
RenderFunc is a function that renders markdown to HTML.