package converter
import "github.com/gohugoio/hugo/markup/converter"
Index ¶
- Variables
- type AnchorNameSanitizer
- type Bytes
- type Converter
- type DocumentContext
- type DocumentInfo
- type Provider
- type ProviderConfig
- type ProviderProvider
- type RenderContext
- type Result
- type TableOfContentsProvider
Variables ¶
var FeatureRenderHooks = identity.NewPathIdentity("markup", "renderingHooks")
var NopConverter = new(nopConverter)
Types ¶
type AnchorNameSanitizer ¶
AnchorNameSanitizer tells how a converter sanitizes anchor names.
type Bytes ¶
type Bytes []byte
Bytes holds a byte slice and implements the Result interface.
func (Bytes) Bytes ¶
Bytes returns itself
type Converter ¶
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 ¶
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 DocumentInfo ¶
type DocumentInfo interface { AnchorSuffix() string }
DocumentInfo holds additional information provided by some converters.
type Provider ¶
type Provider interface { New(ctx DocumentContext) (Converter, error) Name() string }
Provider creates converters.
func NewProvider ¶
func NewProvider(name string, create func(ctx DocumentContext) (Converter, error)) Provider
NewProvider creates a new Provider with the given name.
type ProviderConfig ¶
type ProviderConfig struct { MarkupConfig markup_config.Config Cfg config.Provider // Site config ContentFs afero.Fs Logger loggers.Logger Exec *hexec.Exec highlight.Highlighter }
ProviderConfig configures a new Provider.
type ProviderProvider ¶
type ProviderProvider interface { New(cfg ProviderConfig) (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 // GerRenderer provides hook renderers on demand. GetRenderer hooks.GetRendererFunc }
RenderContext holds contextual information about the content to render.
type Result ¶
type Result interface { Bytes() []byte }
Result represents the minimum returned from Convert.
type TableOfContentsProvider ¶
type TableOfContentsProvider interface { TableOfContents() tableofcontents.Root }
TableOfContentsProvider provides the content as a ToC structure.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
markup/converter/hooks |
- Version
- v0.104.3
- Published
- Oct 4, 2022
- Platform
- js/wasm
- Imports
- 10 packages
- Last checked
- 19 minutes ago –
Tools for package owners.