convert

package
v0.629.1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package convert wraps the conductor-oss/markitdown pure-Go library to turn rich document formats (docx, pdf, xlsx, …) into Markdown. It is the single integration point for document conversion across Pando: the `pando convert` CLI command and the on-the-fly Knowledge Base indexing both go through it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertibleDocumentExtensions

func ConvertibleDocumentExtensions() []string

ConvertibleDocumentExtensions returns the sorted list of extensions in the curated KB ingestion set.

func IsSupported

func IsSupported(path string) bool

IsSupported reports whether path's extension is convertible by the library.

func SupportedExtensions

func SupportedExtensions() []string

SupportedExtensions returns the sorted list of all supported input extensions (including the leading dot), suitable for display.

Types

type Converter

type Converter struct {
	// contains filtered or unexported fields
}

Converter wraps a markitdown engine. The engine is created lazily on first use because initializing the PDFium WASM runtime has a non-trivial cost; a process that never converts a PDF should not pay for it. All conversions are serialized with a mutex: the underlying PDF backend is not guaranteed to be safe for concurrent use, and KB conversion is not a hot path.

func New

func New() *Converter

New returns a ready-to-use Converter using the default curated document set for KB ingestion. The heavy engine is initialized lazily.

func NewWithConvertibleExtensions

func NewWithConvertibleExtensions(exts []string) *Converter

NewWithConvertibleExtensions returns a Converter whose curated KB set is overridden by exts (each entry with or without a leading dot, case insensitive). An empty list falls back to the built-in default set.

func (*Converter) Convert

func (c *Converter) Convert(source string) (string, error)

Convert auto-detects whether source is a local file path or a URL and converts it to Markdown.

func (*Converter) ConvertFile

func (c *Converter) ConvertFile(path string) (string, error)

ConvertFile converts a local file at path to Markdown and returns the resulting text. The path's extension must be supported.

func (*Converter) ConvertReader

func (c *Converter) ConvertReader(r io.ReadSeeker, name string) (string, error)

ConvertReader converts the contents of r to Markdown. name is used to detect the format via its extension (e.g. "report.docx").

func (*Converter) IsConvertibleDocument

func (c *Converter) IsConvertibleDocument(path string) bool

IsConvertibleDocument reports whether path belongs to the curated set of document formats that should be auto-converted during KB ingestion.

Jump to

Keyboard shortcuts

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