From c63397f8d61993f21cdbb6f5dd986e31f53ecd90 Mon Sep 17 00:00:00 2001 From: Vinta Chen Date: Fri, 16 Oct 2026 18:37:49 +0800 Subject: [PATCH] docs: add pypandoc to File Format Processing intro Co-Authored-By: Claude --- website/data/category_intros/file-format-processing.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/website/data/category_intros/file-format-processing.md b/website/data/category_intros/file-format-processing.md index e5c52292..659160f2 100644 --- a/website/data/category_intros/file-format-processing.md +++ b/website/data/category_intros/file-format-processing.md @@ -6,6 +6,7 @@ How to choose: - ELF binaries and DWARF debug info: pyelftools - A table you import or export as CSV, JSON, YAML, or Excel: Tablib - Documents turned into Markdown for an LLM: MarkItDown, or Docling for complex layouts and scans +- Documents converted between Markdown, Word, LaTeX, and HTML: pypandoc - Excel: openpyxl to edit a workbook, XlsxWriter to create one with charts and formatting - Word documents: python-docx - PowerPoint decks: python-pptx @@ -25,6 +26,8 @@ MarkItDown converts PDF, Word, Excel, PowerPoint, HTML, and more into Markdown [ Docling is for documents where layout matters: it [understands page layout, reading order, and tables, and runs OCR](https://docling-project.github.io/docling/) on scanned PDFs. It converts each file into a `DoclingDocument`, which you export to Markdown. +pypandoc wraps pandoc, which [converts between Markdown, Word, LaTeX, HTML, and many other formats](https://pandoc.org/) in both directions. It needs pandoc on your machine, and the [`pypandoc_binary` package](https://github.com/JessicaTegner/pypandoc#installation) includes it. Pass a path to `convert_file()`, or a string and its `format` to `convert_text()`. For output formats like DOCX and EPUB, [pass an `outputfile`](https://github.com/JessicaTegner/pypandoc#usage), since that's the only way to convert to them. + openpyxl reads and writes Excel workbooks, so it's the one to use when the file already exists. Install defusedxml when you open spreadsheets from other people, since openpyxl [doesn't guard against XML attacks](https://openpyxl.readthedocs.io/en/stable/#security) by default. XlsxWriter [can't read or modify existing files](https://xlsxwriter.readthedocs.io/introduction.html). In return, it supports more Excel features than the alternatives, and its files are close to what Excel itself writes.