content

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package content renders Markdown bodies for content pages (REQ-CNT-02) and code frames for the docs kit (REQ-CNT-05). It wraps the internal renderers, so package gx keeps no Markdown or chroma dependency (SDD §12.4). Content comes from repository files (SI-12).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Body

func Body(markdown []byte) (gx.Node, error)

Body renders the Markdown body of a content entry: CommonMark plus GFM, footnotes and heading anchors.

func BodySlots added in v0.4.0

func BodySlots(markdown []byte, slots ...gx.Node) (gx.Node, error)

BodySlots renders a Markdown body that holds components (REQ-CNT-03). The Markdown has one marker for each slot, and the result has slots[n] in the place of marker n. The generated body function of a collection calls it; the prose around the components of one parent is one document, so a component in a list item stays in the list item.

func Code

func Code(c gx.Code, opt CodeOptions) gx.Node

Code renders a resolved code block (REQ-CNT-05): the compiler fills gx.Code at build time from a repository file, and chroma highlights it here.

func CodeCSS

func CodeCSS() string

CodeCSS returns the light and dark stylesheet of code frames (REQ-CNT-04).

func Install

func Install()

Install installs the YAML frontmatter decoder and the body renderer of content pages (REQ-CNT-02). The app's main calls it once:

content.Install()

Types

type CodeOptions

type CodeOptions struct {
	// Title sits in the frame bar.
	Title string
	// Wrap wraps long lines.
	Wrap bool
	// Marks, Ins, Del and Words mark 1-based lines of the shown source.
	Marks []int
	Ins   []int
	Del   []int
	Words []int
}

CodeOptions are the frame options of a code block (REQ-CNT-05).

type Heading

type Heading = gxcontent.Heading

Heading is one heading of a content page (REQ-CNT-06).

func Headings

func Headings(markdown []byte) []Heading

Headings returns the rendered headings of a Markdown body, so the docs shell can build its table of contents (REQ-CNT-06).

Jump to

Keyboard shortcuts

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