Documentation
¶
Overview ¶
Package content provides a system for making content-focused apps and websites consisting of Markdown, HTML, and Cogent Core.
Index ¶
- Variables
- type Content
- func (ct *Content) Init()
- func (ct *Content) MakeToolbar(p *tree.Plan)
- func (ct *Content) MakeToolbarPDF(p *tree.Plan)
- func (ct *Content) MakeToolbarSearch(p *tree.Plan)
- func (ct *Content) MenuSearch(items *[]core.ChooserItem)
- func (ct *Content) Open(url string) *Content
- func (ct *Content) OpenEvent(url string, e events.Event) *Content
- func (ct *Content) PagePDF(path string) error
- func (ct *Content) PageRefs(page *bcontent.Page) *core.Frame
- func (ct *Content) SetContent(content fs.FS) *Content
- func (t *Content) SetReferences(v *csl.KeyList) *Content
- func (ct *Content) SetSource(source fs.FS) *Content
- type History
- type Location
- type SettingsData
Constants ¶
This section is empty.
Variables ¶
BindTextEditor is a function set to cogentcore.org/core/yaegicore.BindTextEditor when importing yaegicore, which provides interactive editing functionality for Go code blocks in text editors.
var NewPageInitFunc func()
NewPageInitFunc is called when a new page is just being rendered. This can do any necessary new-page initialization, e.g., [yaegicore.ResetGoalInterpreter]
var OfflineURL = ""
OfflineURL is the non-web base url, which can be set to allow docs to refer to this in frontmatter.
Functions ¶
This section is empty.
Types ¶
type Content ¶
type Content struct {
core.Splits
// Source is the source filesystem for the content.
// It should be set using [Content.SetSource] or [Content.SetContent].
Source fs.FS `set:"-"`
// Context is the [htmlcore.Context] used to render the content,
// which can be modified for things such as adding wikilink handlers.
Context *htmlcore.Context `set:"-"`
// References is a list of references used for generating citation text
// for literature reference wikilinks in the format [[@CiteKey]].
References *csl.KeyList
// contains filtered or unexported fields
}
Content manages and displays the content of a set of pages.
func NewContent ¶
NewContent returns a new Content with the given optional parent: Content manages and displays the content of a set of pages.
func (*Content) MakeToolbar ¶
MakeToolbar adds the standard toolbar buttons for the content. See Content.MakeToolbarPDF for the optional PDF button.
func (*Content) MakeToolbarPDF ¶ added in v0.3.13
MakeToolbarPDF adds the PDF button to the toolbar. This is optional.
func (*Content) MakeToolbarSearch ¶ added in v0.3.16
MakeToolbarSearch adds a within-page search button to the toolbar. This is optional.
func (*Content) MenuSearch ¶
func (ct *Content) MenuSearch(items *[]core.ChooserItem)
func (*Content) Open ¶
Open opens the page with the given URL and updates the display. If no pages correspond to the URL, it is opened in the default browser. This version is for programmatic use -- see also OpenEvent.
func (*Content) OpenEvent ¶ added in v0.3.16
OpenEvent opens the page with the given URL and updates the display. If no pages correspond to the URL, it is opened in the default browser. This version is for widget event cases, where the keyboard modifiers are used to control the way the page is opened: Ctrl/Meta = new tab.
func (*Content) PagePDF ¶ added in v0.3.13
PagePDF generates a PDF of the current page, to given file path (directory). the page name is the file name.
func (*Content) PageRefs ¶ added in v0.3.13
PageRefs returns a core.Frame with the contents of the references cited on the given page. if References is nil, or error, result will be nil.
func (*Content) SetContent ¶
SetContent is a helper function that calls Content.SetSource with the "content" subdirectory of the given filesystem.
func (*Content) SetReferences ¶ added in v0.3.12
SetReferences sets the [Content.References]: References is a list of references used for generating citation text for literature reference wikilinks in the format [[@CiteKey]].
type History ¶ added in v0.3.16
type History struct {
// Index is the current index in the Records, which is typically the
// current page as saved. Back decrements then returns that.
Index int
// Records is the list of saved locations.
Records []*Location
}
History records the history of browsing locations, for back arrow navigation.
func (*History) Back ¶ added in v0.3.16
Back decrements Index and returns that location. If already at the start, returns false.
type SettingsData ¶ added in v0.3.13
type SettingsData struct {
PDF paginate.Options
// SiteTitle is the title of the site, used in page headings and titles.
SiteTitle string
// PageSettings is a function that returns the settings data to use
// for the current page. Can set custom parameters for different pages.
// The default sets the PDF Header function to HeaderLeftPageNumber
// with current page Title.
PageSettings func(ct *Content, curPage *bcontent.Page) *SettingsData
}
SettingsData has settings parameters for content, including PDF rendering options.
var Settings SettingsData
Settings are the current settings for content rendering.
func (*SettingsData) Defaults ¶ added in v0.3.13
func (s *SettingsData) Defaults()
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package bcontent ("base content") provides base types and functions shared by both content and the core build tool for content.
|
Package bcontent ("base content") provides base types and functions shared by both content and the core build tool for content. |
|
examples
|
|
|
basic
command
|