content

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2025 License: BSD-3-Clause Imports: 33 Imported by: 0

README

Cogent Content

Cogent Content is a package for making content-focused apps and websites consisting of Markdown, HTML, and Cogent Core.

References

Wikilink styles for scientific source references are supported, using the csl Citation Style Language format, with one citation per wikilink:

  • [[@CiteKey]] generates a Parenthetical citation, e.g., for APA style it is like: "Smith & Jones, 1989", which should be put in parentheses along with any others, e.g., ([[@SmithJones89]]; [[@West05]]).

  • [[@^CiteKey]] generates a Narrative citation, where the citation serves as the subject of the sentence. For APA style this is: "Smith & Jones (1989)".

Documentation

Overview

Package content provides a system for making content-focused apps and websites consisting of Markdown, HTML, and Cogent Core.

Index

Constants

This section is empty.

Variables

View Source
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]

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

func NewContent(parent ...tree.Node) *Content

NewContent returns a new Content with the given optional parent: Content manages and displays the content of a set of pages.

func (*Content) Init

func (ct *Content) Init()

func (*Content) MakeToolbar

func (ct *Content) MakeToolbar(p *tree.Plan)

func (*Content) MenuSearch

func (ct *Content) MenuSearch(items *[]core.ChooserItem)

func (*Content) Open

func (ct *Content) Open(url string) *Content

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.

func (*Content) SetContent

func (ct *Content) SetContent(content fs.FS) *Content

SetContent is a helper function that calls Content.SetSource with the "content" subdirectory of the given filesystem.

func (*Content) SetReferences

func (t *Content) SetReferences(v *csl.KeyList) *Content

SetReferences sets the [Content.References]: References is a list of references used for generating citation text for literature reference wikilinks in the format [[@CiteKey]].

func (*Content) SetSource

func (ct *Content) SetSource(source fs.FS) *Content

SetSource sets the source filesystem for the content.

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

Jump to

Keyboard shortcuts

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