Documentation
¶
Overview ¶
Package convert turns documents into Markdown for language models.
Convert picks a converter from the input's MIME type, falling back to its file extension and then to its content, and returns Markdown that keeps the structure a model can use: headings, lists, tables, links and slide notes. Styling that carries no meaning (fonts, colors, positions) is dropped.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrPasswordRequired = errors.New("encrypted, and needs a password to open") ErrWrongPassword = errors.New("wrong password") )
ErrPasswordRequired is returned, wrapped, for an encrypted document that does not open without a password; ErrWrongPassword when the password given does not open it either.
var ErrNoText = errors.New("no text found")
ErrNoText is returned, wrapped, when a document converts but holds no text, such as a PDF of scanned pages.
var ErrUnsupported = errors.New("unsupported format")
ErrUnsupported is returned, wrapped, for a format no converter handles.
Functions ¶
Types ¶
type Input ¶
type Input struct {
// Name is the document's file name, path or URL. Only its extension is
// used, to help detect the format; it may be empty.
Name string
// MIME is the document's media type when the caller knows it, such as an
// HTTP Content-Type. Parameters are ignored. It may be empty.
MIME string
// Password opens an encrypted document (a PDF); most open without one.
Password string
// Reader reads the document, which is Size bytes long.
Reader io.ReaderAt
Size int64
}
Input is a document to convert.