Turn documents into clean input for LLMs

Weavon converts web pages, office files, and PDF into clean Markdown and token-sized JSON Lines chunks for RAG.

Clean Markdown from any input

--main-content
Keeps the main article and drops navigation bars and footers.
--clean
Removes raw HTML, attributes, and layout wrappers.
--base-url
Resolves relative links into full URLs.
-t llm-markdown
Applies all three cleanup settings in one option.

The same pipeline reads DOCX, ODT, EPUB, LaTeX, and all 52 supported input formats.

Chunks with heading context

weavon chunk emits one JSON object per line, keeping the heading breadcrumb above each block.

{"index":1,"heading_path":["Install","macOS"],"markdown":"## macOS\n\nMove the program to a folder on your PATH.","token_estimate":14,"char_count":52,"block_start":2,"block_end":4,"metadata":{}}

The token count is a fast estimate rather than one specific model tokenizer.

Generate llms.txt in batches

--emit-llms-txt writes llms.txt and llms-full.txt for a whole folder, just like this site's llms.txt.

Build the pipeline

  1. Extract the article

    Keep the main content and write clean Markdown.

    weavon page.html --main-content -t llm-markdown -o page.md
  2. Split it into chunks

    Write chunks of at most 512 estimated tokens as JSON Lines.

    weavon chunk page.md --max-tokens 512 -o chunks.jsonl
  3. Load the chunks

    Read each line of chunks.jsonl, embed the markdown field, and store heading_path with it as metadata.

Common questions

How do I convert a web page to Markdown for an LLM?

Run weavon page.html --main-content -t llm-markdown -o page.md. --main-content keeps the main article, and llm-markdown removes raw HTML and wrappers.

What does weavon chunk output?

It writes JSON Lines. Each chunk contains heading_path, markdown, token_estimate, char_count, and its block range.

How do I control chunk size?

Pass --max-tokens N and optionally --overlap-tokens M. The token count is a fast estimate, not one model-specific tokenizer.

Can Weavon generate llms.txt files?

Yes. --emit-llms-txt writes llms.txt and llms-full.txt for a batch of documents.

Can Weavon read PDF files for RAG?

Yes, with the opt-in Cargo feature reader-pdf for born-digital PDF. Scanned pages perform no OCR and emit W_PDF_SCANNED_PAGE_NEEDS_OCR.

Can I chunk documents in Node.js or the browser?

Yes. The WebAssembly module exposes the same chunk operation, and the playground runs it locally.