Documentation
¶
Overview ¶
Package pages provides an easy way to make content-focused sites consisting of Markdown, HTML, and Cogent Core.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Examples = map[string]func(b core.Widget){}
Examples are the different core examples that exist as compiled Go code that can be run in pages. The map is keyed by ID. Generated pagegen.go files add to this by finding all code blocks with language Go (must be uppercase, as that indicates that is an "exported" example).
var NumExamples = map[string]int{}
NumExamples has the number of examples per page URL.
Functions ¶
func ExampleHandler ¶
ExampleHandler is the htmlcore handler for <pages-example> HTML elements that handles examples.
Types ¶
type Page ¶
type Page struct { core.Frame // Source is the filesystem in which the content is located. Source fs.FS // Context is the page's [htmlcore.Context]. Context *htmlcore.Context `set:"-"` // contains filtered or unexported fields }
Page represents a content page with support for navigating to other pages within the same source content.
func NewPage ¶
NewPage returns a new Page with the given optional parent: Page represents a content page with support for navigating to other pages within the same source content.
func (*Page) MakeToolbar ¶ added in v0.2.0
func (*Page) MenuSearch ¶ added in v0.3.3
func (pg *Page) MenuSearch(items *[]core.ChooserItem)
func (*Page) OpenURL ¶
OpenURL sets the content of the page from the given url. If the given URL has no scheme (eg: "/about"), then it sets the content of the page to the file specified by the URL. This is either the "index.md" file in the corresponding directory (eg: "/about/index.md") or the corresponding md file (eg: "/about.md"). If it has a scheme, (eg: "https://example.com"), then it opens it in the user's default browser.
func (*Page) SetContent ¶ added in v0.2.2
SetContent is a helper function that calls Page.SetSource with the "content" subdirectory of the given filesystem.