Documentation
¶
Index ¶
- func New() goldmark.Markdown
- func Trim(markdown []byte) ([]byte, error)
- type Collection
- type Document
- func (d *Document) AddCollection(coll model.Collection)
- func (d *Document) Chunk(start int, end int) ([]byte, error)
- func (d *Document) Collections() []model.Collection
- func (d *Document) Content() ([]byte, error)
- func (d *Document) ETag() string
- func (d *Document) ID() model.DocumentID
- func (d *Document) Metadata() map[string]any
- func (d *Document) Sections() []model.Section
- func (d *Document) SetETag(etag string)
- func (d *Document) SetMetadata(metadata map[string]any)
- func (d *Document) SetSource(source *url.URL)
- func (d *Document) Source() *url.URL
- type NodeTransformer
- type NodeTransformerFunc
- type OptionFunc
- type Options
- type Section
- func (s *Section) AppendRange(end int)
- func (s *Section) Branch() []model.SectionID
- func (s *Section) Content() ([]byte, error)
- func (s *Section) Document() model.Document
- func (s *Section) End() int
- func (s *Section) ID() model.SectionID
- func (s *Section) Level() uint
- func (s *Section) Parent() model.Section
- func (s *Section) Sections() []model.Section
- func (s *Section) Start() int
- type Transformer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Collection ¶
type Collection struct {
// contains filtered or unexported fields
}
func (*Collection) Description ¶
func (c *Collection) Description() string
Description implements model.Collection.
func (*Collection) ID ¶
func (c *Collection) ID() model.CollectionID
ID implements model.Collection.
type Document ¶
type Document struct {
// contains filtered or unexported fields
}
func (*Document) AddCollection ¶
func (d *Document) AddCollection(coll model.Collection)
func (*Document) Collections ¶
func (d *Document) Collections() []model.Collection
Collections implements model.Document.
func (*Document) SetMetadata ¶ added in v0.0.3
SetMetadata attaches arbitrary metadata used for filtering at search time.
type NodeTransformer ¶
type NodeTransformerFunc ¶
var StripDataURL NodeTransformerFunc = func(n ast.Node) error { stripDataURL := func(destination []byte) []byte { if strings.HasPrefix(string(destination), "data:") { destination = []byte("#stripped") } return destination } switch typ := n.(type) { case *ast.Image: typ.Destination = stripDataURL(typ.Destination) case *ast.Link: typ.Destination = stripDataURL(typ.Destination) } return nil }
type OptionFunc ¶
type OptionFunc func(opts *Options)
func WithMaxWordPerSection ¶
func WithMaxWordPerSection(maxWord int) OptionFunc
func WithNodeTransformers ¶
func WithNodeTransformers(transformers ...NodeTransformer) OptionFunc
type Options ¶
type Options struct {
MaxWordPerSection int
Transformers []NodeTransformer
}
func NewOptions ¶
func NewOptions(funcs ...OptionFunc) *Options
type Section ¶
type Section struct {
// contains filtered or unexported fields
}
func (*Section) AppendRange ¶
type Transformer ¶
type Transformer struct {
// contains filtered or unexported fields
}
func (*Transformer) Error ¶
func (t *Transformer) Error() error
Click to show internal directories.
Click to hide internal directories.