contentspec

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Converter

type Converter interface {
	Convert(ctx RenderContext) (Result, error)
}

Converter wraps the Convert method that converts some markup into another format, e.g. Markdown to HTML.

type ConverterRegistry

type ConverterRegistry interface {
	Get(name string) Provider
}

type DocumentContext

type DocumentContext struct {
	Document     any // May be nil. Usually a page.Page
	DocumentID   string
	DocumentName string
	Filename     string
}

DocumentContext holds contextual information about the document to convert.

type Provider

type Provider interface {
	New(ctx DocumentContext) (Converter, error)
	Name() string
}

Provider creates converters.

type ProviderProvider

type ProviderProvider interface {
	New() (Provider, error)
}

ProviderProvider creates converter providers.

type RenderContext

type RenderContext struct {
	// Src is the content to render.
	Src []byte

	// Whether to render TableOfContents.
	RenderTOC bool
}

RenderContext holds contextual information about the content to render.

type Result

type Result interface {
	Bytes() []byte
}

Result represents the minimum returned from Convert.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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