hugo: github.com/gohugoio/hugo/markup/converter Index | Files | Directories

package converter

import "github.com/gohugoio/hugo/markup/converter"

Index

Package Files

converter.go

Variables

var (
    FeatureRenderHooks = identity.NewPathIdentity("markup", "renderingHooks")
)
var NopConverter = new(nopConverter)

type AnchorNameSanitizer Uses

type AnchorNameSanitizer interface {
    SanitizeAnchorName(s string) string
}

AnchorNameSanitizer tells how a converter sanitizes anchor names.

type Bytes Uses

type Bytes []byte

Bytes holds a byte slice and implements the Result interface.

func (Bytes) Bytes Uses

func (b Bytes) Bytes() []byte

Bytes returns itself

type Converter Uses

type Converter interface {
    Convert(ctx RenderContext) (Result, error)
    Supports(feature identity.Identity) bool
}

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

type DocumentContext Uses

type DocumentContext struct {
    Document        interface{} // May be nil. Usually a page.Page
    DocumentID      string
    DocumentName    string
    Filename        string
    ConfigOverrides map[string]interface{}
}

DocumentContext holds contextual information about the document to convert.

type DocumentInfo Uses

type DocumentInfo interface {
    AnchorSuffix() string
}

DocumentInfo holds additional information provided by some converters.

type Provider Uses

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

Provider creates converters.

func NewProvider Uses

func NewProvider(name string, create func(ctx DocumentContext) (Converter, error)) Provider

NewProvider creates a new Provider with the given name.

type ProviderConfig Uses

type ProviderConfig struct {
    MarkupConfig markup_config.Config

    Cfg       config.Provider // Site config
    ContentFs afero.Fs
    Logger    *loggers.Logger
    Highlight func(code, lang, optsStr string) (string, error)
}

ProviderConfig configures a new Provider.

type ProviderProvider Uses

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

ProviderProvider creates converter providers.

type RenderContext Uses

type RenderContext struct {
    Src         []byte
    RenderTOC   bool
    RenderHooks *hooks.Renderers
}

RenderContext holds contextual information about the content to render.

type Result Uses

type Result interface {
    Bytes() []byte
}

Result represents the minimum returned from Convert.

type TableOfContentsProvider Uses

type TableOfContentsProvider interface {
    TableOfContents() tableofcontents.Root
}

TableOfContentsProvider provides the content as a ToC structure.

Directories

PathSynopsis
hooks

Package converter imports 8 packages (graph) and is imported by 55 packages. Updated 2020-08-21. Refresh now. Tools for package owners.