Skip to main content

The Pythonic document-to-Markdown library — beautiful API, helpful errors, zero surprises.

Project description

🧪 Alchemark

Transmute documents into Markdown gold.

The Pythonic document-to-Markdown library — beautiful API, helpful errors, zero surprises.

PyPI version Python versions License: MIT CI


✨ Why Alchemark?

There are plenty of "doc-to-markdown" tools out there. Alchemark is opinionated about three things:

  • 🪶 A library first. Clean, type-hinted Python API. The CLI is a thin wrapper.
  • 🔮 Helpful errors. Did you typo a filename? We'll tell you what you probably meant. Missing a dependency? We'll tell you exactly what to install.
  • 🧩 Pluggable. Each format is a converter module. Adding new ones is one file.

📦 Installation

pip install alchemark

That's it — every converter (DOCX, HTML, PDF, PPTX, image OCR) is bundled by default.

Note: image OCR additionally needs the Tesseract binary on PATH:

# macOS:   brew install tesseract
# Ubuntu:  sudo apt-get install tesseract-ocr
# Windows: choco install tesseract

🚀 Quick Start

Library

import alchemark

# Simplest possible: file in, markdown out.
markdown = alchemark.alchemize("report.docx")
print(markdown)

Advanced

from alchemark import Alchemist

alchemist = Alchemist(
    preserve_images=True,
    image_dir="./images",
    on_warning=lambda w: print(f"⚠ {w}"),
)

result = alchemist.transmute("report.docx")
print(result.markdown)
print(result.metadata)   # {'title': '...', 'author': '...', ...}
print(result.warnings)   # non-fatal issues, e.g. unsupported features

# Save directly:
result.save("report.md")

Batch

from alchemark import Alchemist

alchemist = Alchemist()
for result in alchemist.transmute_all("./docs/*.docx"):
    result.save(f"./out/{result.source.stem}.md")

CLI

# Convert and write to file
alchemark convert report.docx -o report.md

# Pipe to stdout
alchemark convert report.html | less

# See what formats are available
alchemark formats

🎨 Friendly Errors

Typo a filename? You get suggestions, not stack traces:

❌ Alchemark Error
Cannot find 'reprot.docx'

  Hint: Did you mean: report.docx?
        Working directory: /Users/you/projects
        Tip: Use absolute paths to avoid ambiguity.

Missing an optional dependency? You're told exactly what to install:

❌ Alchemark Error
Unsupported file format: .pdf (report.pdf)

  Hint: Supported formats: .docx, .html, .htm.
        Install PDF support with: pip install alchemark[pdf]

📋 Supported Formats

Format Extension Notes
Word .docx with image extraction & embedding
HTML .html, .htm with metadata extraction
PDF .pdf text-based PDFs
PowerPoint .pptx with image extraction & embedding
Images (OCR) .png, .jpg, .tiff, ... needs Tesseract binary

🛠 Development

git clone https://github.com/guru4tw/alchemark
cd alchemark
pip install -e ".[dev,all]"

pytest                    # run tests
ruff check .              # lint
ruff format .             # format
mypy src                  # type-check

🗺 Roadmap

  • DOCX
  • HTML
  • PDF (text-based)
  • PPTX
  • Image OCR
  • Image extraction & embedding for DOCX and PPTX
  • EPUB
  • RTF
  • Async API
  • Streaming for huge files

🤝 Contributing

Contributions are welcome! Please open an issue first to discuss major changes.

📜 License

MIT — see LICENSE.


Like medieval alchemists turning lead into gold, Alchemark turns your documents into Markdown.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

alchemark-0.1.0.tar.gz (30.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

alchemark-0.1.0-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

Details for the file alchemark-0.1.0.tar.gz.

File metadata

  • Download URL: alchemark-0.1.0.tar.gz
  • Upload date:
  • Size: 30.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for alchemark-0.1.0.tar.gz
Algorithm Hash digest
SHA256 47a491425cf51950d195d4580d66a38c6d8951ce6586c35574be5274470d4cc5
MD5 4bc70e66c2479b54b9392beed90c0e95
BLAKE2b-256 0dd78dd31ca900d8793b1349eff2420d168d82c097434b6c4bdb900b31c75bca

See more details on using hashes here.

File details

Details for the file alchemark-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: alchemark-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for alchemark-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e8d6c20643c9042dcca4625e1fedce12ab4e7ac2c429498844f00a6fc2d4df02
MD5 f1befbeb71a2f2c62cb5512db00a8b41
BLAKE2b-256 7223a49f7e2cb742bc717b5470c29a5ab868d194ce86b2451aeb357028487032

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page