convert

command
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Command convert demonstrates two things at once:

  • File conversion: a non-markdown document (here HTML) is converted to markdown before being parsed and indexed. Conversion is wired through amoxtli.WithFileConverter; the ingestion pipeline invokes it automatically for any extension the converter supports.
  • Task tracking: IndexFile is asynchronous and returns a task.ID. This example polls the task state and prints the live progress and the step messages emitted by the pipeline ("converting document", "parsing document", "indexing document", ...).

To keep it runnable with no external binary, the converter below is a tiny self-contained HTML→markdown transform. In a real deployment you would typically use one of the bundled converters instead, e.g.:

import "github.com/bornholm/amoxtli/convert"
import "github.com/bornholm/amoxtli/convert/pandoc"
amoxtli.WithFileConverter(convert.NewRouted(pandoc.NewConverter()))

(pandoc handles .docx, .odt, .rtf, .epub, .html, .tex, ... — see convert/pandoc.)

Usage:

go run ./example/convert <storage-dir>

Jump to

Keyboard shortcuts

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