Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var FeatureRenderHooks = identity.NewPathIdentity("markup", "renderingHooks")
var NopConverter = new(nopConverter)
Functions ¶
This section is empty.
Types ¶
type AnchorNameSanitizer ¶ added in v0.62.2
AnchorNameSanitizer tells how a converter sanitizes anchor names.
type Converter ¶
type Converter interface { Convert(ctx RenderContext) (ResultRender, 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 ParseRenderer ¶ added in v0.111.0
type ParseRenderer interface { Parse(RenderContext) (ResultParse, error) Render(RenderContext, any) (ResultRender, error) }
ParseRenderer is an optional interface. The Goldmark converter implements this, and this allows us to extract the ToC without having to render the content.
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 { Conf config.AllProvider // Site config ContentFs afero.Fs Logger loggers.Logger Exec *hexec.Exec highlight.Highlighter }
ProviderConfig configures a new Provider.
func (ProviderConfig) MarkupConfig ¶
func (p ProviderConfig) MarkupConfig() markup_config.Config
type ProviderProvider ¶
type ProviderProvider interface {
New(cfg ProviderConfig) (Provider, error)
}
ProviderProvider creates converter providers.
type RenderContext ¶
type RenderContext struct { // Ctx is the context.Context for the current Page render. Ctx context.Context // 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 ResultParse ¶ added in v0.111.0
type ResultParse interface { Doc() any TableOfContents() *tableofcontents.Fragments }
ResultParse represents the minimum returned from Parse.
type ResultRender ¶ added in v0.111.0
type ResultRender interface {
Bytes() []byte
}
ResultRender represents the minimum returned from Convert and Render.
type TableOfContentsProvider ¶
type TableOfContentsProvider interface {
TableOfContents() *tableofcontents.Fragments
}
TableOfContentsProvider provides the content as a ToC structure.