Documentation
¶
Index ¶
- Variables
- func ParseContentMeta(data plugindata.Data) *nodes.ContentMeta
- type Content
- type ContentElement
- func (c *ContentElement) AsData() plugindata.Data
- func (c *ContentElement) AsMarkdownSrc() []bytedeprecated
- func (c *ContentElement) AsNode() (*astsrc.ASTSource, *nodes.FabricContentNode)
- func (c *ContentElement) AsPluginData() plugindata.Data
- func (c *ContentElement) AsSerializedNode() *astv1.FabricContentNode
- func (c *ContentElement) ID() uint32
- func (c *ContentElement) IsAst() bool
- func (c *ContentElement) Meta() *nodes.ContentMeta
- func (c *ContentElement) SetMeta(meta *nodes.ContentMeta)
- type ContentEmpty
- type ContentProvider
- type ContentProviders
- type ContentResult
- type ContentSection
- func (c *ContentSection) Add(content Content, loc *Location) error
- func (c *ContentSection) AsData() plugindata.Data
- func (c *ContentSection) AsPluginData() plugindata.Data
- func (c *ContentSection) Compact()
- func (c *ContentSection) ID() uint32
- func (c *ContentSection) IsEmpty() bool
- func (c *ContentSection) Meta() *nodes.ContentMeta
- func (c *ContentSection) SetMeta(meta *nodes.ContentMeta)
- type DataSource
- type DataSources
- type InvocationOrder
- type Location
- type LocationEffect
- type OutputFormat
- type ProvideContentFunc
- type ProvideContentParams
- type PublishFunc
- type PublishParams
- type Publisher
- type Publishers
- type RetrieveDataFunc
- type RetrieveDataParams
- type Schema
- func (p *Schema) ProvideContent(ctx context.Context, name string, params *ProvideContentParams) (_ *ContentResult, diags diagnostics.Diag)
- func (p *Schema) Publish(ctx context.Context, name string, params *PublishParams) (diags diagnostics.Diag)
- func (p *Schema) RetrieveData(ctx context.Context, name string, params *RetrieveDataParams) (_ plugindata.Data, diags diagnostics.Diag)
- func (p *Schema) Validate() diagnostics.Diag
Constants ¶
This section is empty.
Variables ¶
var BaseMarkdownOptions = goldmark.WithExtensions( extension.Table, extension.Strikethrough, extension.TaskList, )
var ErrContentLocationNotFound = fmt.Errorf("content location not found")
Functions ¶
func ParseContentMeta ¶ added in v0.4.1
func ParseContentMeta(data plugindata.Data) *nodes.ContentMeta
Types ¶
type Content ¶
type Content interface {
SetMeta(meta *nodes.ContentMeta)
AsData() plugindata.Data
ID() uint32
AsPluginData() plugindata.Data
Meta() *nodes.ContentMeta
// contains filtered or unexported methods
}
func ParseContentData ¶ added in v0.4.1
func ParseContentData(data plugindata.Map) (Content, error)
type ContentElement ¶ added in v0.4.1
type ContentElement struct {
// contains filtered or unexported fields
}
func NewElement ¶
func NewElement(content ...astv1.BlockContent) *ContentElement
NewElement is the preferred way to create a new content element. It accepts a list of AST nodes to build the content element.
func NewElementFromMarkdown
deprecated
func NewElementFromMarkdown(source string) *ContentElement
NewElementFromMarkdown creates a new content element from a markdown string.
Deprecated: opt in to working with the new AST by using NewElement instead.
func NewElementFromMarkdownAndAST ¶
func NewElementFromMarkdownAndAST(source []byte, ast *astv1.FabricContentNode, meta *astv1.Metadata) *ContentElement
NewElementFromMarkdownAndAST creates a new content element from a markdown string and an AST. This is a temporary method to allow for a smooth transition to the new AST. Should only be used for deserialization purposes during the transition.
func (*ContentElement) AsData ¶ added in v0.4.1
func (c *ContentElement) AsData() plugindata.Data
func (*ContentElement) AsMarkdownSrc
deprecated
func (c *ContentElement) AsMarkdownSrc() []byte
AsMarkdownSrc returns the markdown source of the content element.
Deprecated: opt in to working with the new AST by using .AsNode()
func (*ContentElement) AsNode ¶
func (c *ContentElement) AsNode() (*astsrc.ASTSource, *nodes.FabricContentNode)
func (*ContentElement) AsPluginData ¶
func (c *ContentElement) AsPluginData() plugindata.Data
func (*ContentElement) AsSerializedNode ¶
func (c *ContentElement) AsSerializedNode() *astv1.FabricContentNode
func (*ContentElement) ID ¶ added in v0.4.1
func (c *ContentElement) ID() uint32
func (*ContentElement) IsAst ¶
func (c *ContentElement) IsAst() bool
func (*ContentElement) Meta ¶ added in v0.4.1
func (c *ContentElement) Meta() *nodes.ContentMeta
func (*ContentElement) SetMeta ¶
func (c *ContentElement) SetMeta(meta *nodes.ContentMeta)
type ContentEmpty ¶ added in v0.4.1
type ContentEmpty struct {
// contains filtered or unexported fields
}
func (*ContentEmpty) AsData ¶ added in v0.4.1
func (n *ContentEmpty) AsData() plugindata.Data
func (*ContentEmpty) AsPluginData ¶
func (n *ContentEmpty) AsPluginData() plugindata.Data
func (*ContentEmpty) ID ¶ added in v0.4.1
func (n *ContentEmpty) ID() uint32
func (*ContentEmpty) Meta ¶ added in v0.4.1
func (n *ContentEmpty) Meta() *nodes.ContentMeta
func (*ContentEmpty) SetMeta ¶
func (n *ContentEmpty) SetMeta(meta *nodes.ContentMeta)
type ContentProvider ¶
type ContentProvider struct {
// first non-empty line is treated as a short description
Doc string
Tags []string
ContentFunc ProvideContentFunc
Args *dataspec.RootSpec
Config *dataspec.RootSpec
InvocationOrder InvocationOrder
}
func (*ContentProvider) Execute ¶
func (cg *ContentProvider) Execute(ctx context.Context, params *ProvideContentParams) (_ *ContentResult, diags diagnostics.Diag)
func (*ContentProvider) Validate ¶
func (cg *ContentProvider) Validate() diagnostics.Diag
type ContentProviders ¶
type ContentProviders map[string]*ContentProvider
func (ContentProviders) Validate ¶
func (cp ContentProviders) Validate() diagnostics.Diag
type ContentResult ¶ added in v0.4.1
type ContentSection ¶ added in v0.4.1
type ContentSection struct {
Children []Content
// contains filtered or unexported fields
}
func NewSection ¶ added in v0.4.2
func NewSection(contentID uint32) *ContentSection
func (*ContentSection) Add ¶ added in v0.4.1
func (c *ContentSection) Add(content Content, loc *Location) error
Add content to the content tree.
func (*ContentSection) AsData ¶ added in v0.4.1
func (c *ContentSection) AsData() plugindata.Data
AsData returns the content tree as a map.
func (*ContentSection) AsPluginData ¶
func (c *ContentSection) AsPluginData() plugindata.Data
func (*ContentSection) Compact ¶ added in v0.4.1
func (c *ContentSection) Compact()
Compact removes empty sections from the content tree.
func (*ContentSection) ID ¶ added in v0.4.1
func (c *ContentSection) ID() uint32
func (*ContentSection) IsEmpty ¶
func (c *ContentSection) IsEmpty() bool
IsEmpty returns true if the section does not contain children
func (*ContentSection) Meta ¶ added in v0.4.1
func (c *ContentSection) Meta() *nodes.ContentMeta
func (*ContentSection) SetMeta ¶
func (c *ContentSection) SetMeta(meta *nodes.ContentMeta)
type DataSource ¶
type DataSource struct {
// first non-empty line is treated as a short description
Doc string
Tags []string
DataFunc RetrieveDataFunc
Args *dataspec.RootSpec
Config *dataspec.RootSpec
}
func (*DataSource) Execute ¶
func (ds *DataSource) Execute(ctx context.Context, params *RetrieveDataParams) (_ plugindata.Data, diags diagnostics.Diag)
func (*DataSource) Validate ¶
func (ds *DataSource) Validate() diagnostics.Diag
type DataSources ¶
type DataSources map[string]*DataSource
func (DataSources) Validate ¶
func (ds DataSources) Validate() hcl.Diagnostics
type InvocationOrder ¶ added in v0.4.1
type InvocationOrder int
const ( InvocationOrderUnspecified InvocationOrder = iota InvocationOrderBegin InvocationOrderEnd )
func (InvocationOrder) Weight ¶ added in v0.4.1
func (order InvocationOrder) Weight() int
type Location ¶ added in v0.4.1
type Location struct {
Index uint32
Effect LocationEffect
}
type LocationEffect ¶ added in v0.4.1
type LocationEffect int
const ( LocationEffectUnspecified LocationEffect = iota LocationEffectBefore LocationEffectAfter )
type OutputFormat ¶ added in v0.4.2
type OutputFormat int
const ( OutputFormatUnspecified OutputFormat = iota OutputFormatMD OutputFormatHTML OutputFormatPDF )
func (OutputFormat) Ext ¶ added in v0.4.2
func (f OutputFormat) Ext() string
func (OutputFormat) String ¶ added in v0.4.2
func (f OutputFormat) String() string
type ProvideContentFunc ¶
type ProvideContentFunc func(ctx context.Context, params *ProvideContentParams) (*ContentResult, diagnostics.Diag)
type ProvideContentParams ¶
type PublishFunc ¶ added in v0.4.2
type PublishFunc func(ctx context.Context, params *PublishParams) diagnostics.Diag
type PublishParams ¶ added in v0.4.2
type PublishParams struct {
DocumentName string
Config *dataspec.Block
Args *dataspec.Block
DataContext plugindata.Map
Format OutputFormat
}
type Publisher ¶ added in v0.4.2
type Publisher struct {
Doc string
Tags []string
PublishFunc PublishFunc
Args *dataspec.RootSpec
Config *dataspec.RootSpec
AllowedFormats []OutputFormat
}
func (*Publisher) Execute ¶ added in v0.4.2
func (pub *Publisher) Execute(ctx context.Context, params *PublishParams) (diags diagnostics.Diag)
func (*Publisher) Validate ¶ added in v0.4.2
func (pub *Publisher) Validate() diagnostics.Diag
type Publishers ¶ added in v0.4.2
func (Publishers) Validate ¶ added in v0.4.2
func (pubs Publishers) Validate() diagnostics.Diag
type RetrieveDataFunc ¶
type RetrieveDataFunc func(ctx context.Context, params *RetrieveDataParams) (plugindata.Data, diagnostics.Diag)
type RetrieveDataParams ¶
type Schema ¶
type Schema struct {
Name string
Version string
Doc string
Tags []string
DataSources DataSources
ContentProviders ContentProviders
Publishers Publishers
}
func WithLogging ¶ added in v0.4.2
WithLogging wraps the plugin with logging instrumentation.
func WithTracing ¶ added in v0.4.2
WithTracing wraps a plugin schema with tracing instrumentation.
func (*Schema) ProvideContent ¶
func (p *Schema) ProvideContent(ctx context.Context, name string, params *ProvideContentParams) (_ *ContentResult, diags diagnostics.Diag)
func (*Schema) Publish ¶ added in v0.4.2
func (p *Schema) Publish(ctx context.Context, name string, params *PublishParams) (diags diagnostics.Diag)
func (*Schema) RetrieveData ¶
func (p *Schema) RetrieveData(ctx context.Context, name string, params *RetrieveDataParams) (_ plugindata.Data, diags diagnostics.Diag)
func (*Schema) Validate ¶
func (p *Schema) Validate() diagnostics.Diag
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Documentable wrapper types form
|
Documentable wrapper types form |
|
pluginapi
|
|