embed

package
v1.20240717.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KindAudio = ast.NewNodeKind("Audio")
View Source
var KindIframe = ast.NewNodeKind("Iframe")
View Source
var KindVideo = ast.NewNodeKind("Video")

Functions

func ASTTWalk

func ASTTWalk(n ast.Node, walker ASTTWalker) error

func NewEmbed

func NewEmbed(opts ...EmbedOption) goldmark.Extender

func NewEmbedTransformer

func NewEmbedTransformer(opts ...EmbedOption) parser.ASTTransformer

func NewHTMLRenderer

func NewHTMLRenderer() renderer.NodeRenderer

Types

type ASTTWalker

type ASTTWalker func(n ast.Node) (ast.WalkStatus, error)

type AudioOptions

type AudioOptions struct {
	SiteId string
	Host   string
	Path   string
	Regex  *regexp.Regexp
}

type EmbedConfig

type EmbedConfig struct {
	AudioExt    map[string]struct{}
	VideoExt    map[string]struct{}
	Host2Audio  map[string][]*NoExtPattern
	Host2Video  map[string][]*NoExtPattern
	Host2Iframe map[string][]*UrlPattern
}

type EmbedOption

type EmbedOption interface {
	SetEmbedOption(*EmbedConfig)
}

func WithEmbedAudioExt

func WithEmbedAudioExt(exts []string) EmbedOption

func WithEmbedAudioUrl

func WithEmbedAudioUrl(ops []AudioOptions) EmbedOption

func WithEmbedIframeUrl

func WithEmbedIframeUrl(ops []IframeOptions) EmbedOption

func WithEmbedVideoExt

func WithEmbedVideoExt(exts []string) EmbedOption

func WithEmbedVideoUrl

func WithEmbedVideoUrl(ops []VideoOptions) EmbedOption

type HTMLRenderer

type HTMLRenderer struct{}

func (*HTMLRenderer) RegisterFuncs

func (r *HTMLRenderer) RegisterFuncs(reg renderer.NodeRendererFuncRegisterer)

type IframeOptions

type IframeOptions struct {
	SiteId string
	Host   string
	Type   string
	Path   string
	Query  string
	Regex  *regexp.Regexp
	Player string
}

type NoExtPattern

type NoExtPattern struct {
	SiteId string
	Path   string
	Regex  *regexp.Regexp
}

type NodeAudio

type NodeAudio struct {
	ast.Image
}

func NewAudio

func NewAudio(img *ast.Image, url string) *NodeAudio

func (*NodeAudio) Kind

func (n *NodeAudio) Kind() ast.NodeKind

type NodeIframe

type NodeIframe struct {
	ast.Image
}

func NewIframe

func NewIframe(img *ast.Image, name string, url string) *NodeIframe

func (*NodeIframe) Kind

func (n *NodeIframe) Kind() ast.NodeKind

type NodeVideo

type NodeVideo struct {
	ast.Image
}

func NewVideo

func NewVideo(img *ast.Image, url string) *NodeVideo

func (*NodeVideo) Kind

func (n *NodeVideo) Kind() ast.NodeKind

type UrlPattern

type UrlPattern struct {
	SiteId string
	Type   string
	Path   string
	Query  string
	Regex  *regexp.Regexp
	Player string
}

func (*UrlPattern) PlayerUrl

func (up *UrlPattern) PlayerUrl(id []string) string

type VideoOptions

type VideoOptions struct {
	SiteId string
	Host   string
	Path   string
	Regex  *regexp.Regexp
}

Jump to

Keyboard shortcuts

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