Extract
Turn a document into Markdown that still knows what a heading is. The next stage splits on that structure — so flattening to plain text here would leave it nothing to split on.
Extract a document
Checking whether the local package is running…
Drop a document here
Text, Markdown, HTML and CSV work unaided — PDF, Word, slides and spreadsheets need the local package
Markdown keeps headings and tables. Text flattens everything — which also means the chunk tool has nothing structural left to work with.
A YAML block recording the source, page count and extraction time.
Page boundaries as HTML comments. Renderers ignore them; the chunk tool reads them, which is what lets a chunk cite its page.
Render tables as Markdown tables rather than flattening them to lines.
Nothing here is uploaded. The bridge, when it runs at all, runs on your own machine and answers only to this page.
Arguments
The same arguments work in all three places — this page, the Assistant, and the Python package. This table is generated from the tool spec the code itself reads, so it cannot drift out of date.
Where Headings Come From
Structure is read, never invented. A format with no notion of a heading gets page or section markers and nothing more — guessing from font sizes would produce an outline that looks right and is wrong.
| Format | Headings from | Runs where |
|---|---|---|
| .md | the Markdown itself | this tab |
| .html | h1–h6 tags | this tab |
| .csv | none — becomes one table | this tab |
| .txt | none — split on blank lines | this tab |
| .docx | paragraph styles | local package |
| the PDF outline, when it has one | local package | |
| .pptx | slide titles | local package |
| .xlsx | sheet names | local package |
| .epub | the table of contents | local package |
| .odt | paragraph styles | local package |
| .eml | mail headers | local package |
| .rtf | none | local package |
Use It From Python
The Python tier reads every format on the list. It is also what this page talks to when you run the bridge.
From the THL library
Document loaders are an optional extra, so the base install stays small for anyone who only wanted to convert an image.
pip install "thehallucinatedlab[extract]"from thehallucinatedlab import extract
result = extract("report.pdf")
print(result.path, result.pages, result.headings)thl extract report.pdf --format markdown
# plain english works too
thl "extract this pdf to markdown"thl serveThe bridge listens on loopback only and accepts requests from this origin alone. Nothing is uploaded — the file goes from your disk to a process on the same machine and back. Close the terminal and the page carries on with the formats it reads unaided.