Skip to main content

Export Feishu/Lark docs with synced blocks to Markdown and themeable PDF

Project description

lark-doc-exporter

Export Feishu/Lark docs with synced blocks expanded into:

  • Markdown with localized images
  • Themeable locally rendered PDF by default
  • Optional native Feishu PDF mode with AI-footer post-processing

Requirements

  • lark-cli configured with a user session
  • Python 3.14
  • For --pdf-mode rendered: a working Chrome/Chromium runtime, or the ability to install one with uvx --from playwright playwright install chromium
  • For --pdf-mode native: PyMuPDF available in the runtime environment (bundled with this package dependency as pymupdf)

If you use uvx / uv tool install, uv can provision the required Python for the tool environment automatically.

Quick Start

uv tool install lark-doc-exporter
lark-doc-exporter doctor

If you want rendered PDF output and Chromium is missing, prepare it once:

uvx --from playwright playwright install chromium

Then run an export:

lark-doc-exporter \
  --doc "https://dynamia-ai.feishu.cn/wiki/WEgBwqGYOiBoQikRzjncvJDonAg" \
  --output-dir exports/demo \
  --formats markdown,pdf \
  --theme default

One-off Run

If you do not want a persistent tool install:

uvx lark-doc-exporter \
  --doc "https://dynamia-ai.feishu.cn/wiki/WEgBwqGYOiBoQikRzjncvJDonAg" \
  --output-dir exports/demo \
  --formats markdown,pdf \
  --theme default

Install As A Tool

After installing the released package, companion-skill operations stay the same:

lark-doc-exporter skill install --dry-run
lark-doc-exporter skill install

Auto mode installs the companion skill into every detected supported host:

  • Codex: ~/.agents/skills/lark-doc-exporter
  • Claude Code: ~/.claude/skills/lark-doc-exporter

Use --host codex, --host claude, or --host all to target specific hosts. --dry-run previews the install plan and target directories without writing files. Use --force only when you intentionally want to replace an existing unmanaged target directory.

Chromium Setup

  • doctor reports whether lark-cli is ready and whether Chromium is available for rendered PDF mode.
  • If you already have a browser binary, you can point the exporter at it with LARK_DOC_EXPORTER_CHROMIUM=/path/to/chromium.
  • If LARK_DOC_EXPORTER_CHROMIUM is set to a missing path, the command fails explicitly instead of silently falling back.

Output

  • markdown keeps the localized Markdown file in the output directory.
  • pdf uses either local HTML/CSS + Chromium (--pdf-mode rendered) or Feishu native PDF plus footer handling (--pdf-mode native).
  • images/ contains same-run localized image assets used by the Markdown/PDF.

Native PDF Mode

If you want Feishu native PDF layout instead of the local HTML/Chromium path:

lark-doc-exporter \
  --doc "https://dynamia-ai.feishu.cn/wiki/BVXXwgzbZivjQZkr7jmcsGcinGh" \
  --output-dir exports/native \
  --formats pdf \
  --pdf-mode native

Native mode rules:

  • only the PDF branch changes; markdown stays on the current markdown pipeline
  • explicit non-default --theme / --css are rejected
  • success states are removed and not_found
  • failure states emit warnings and keep <stem>.native-raw.pdf for inspection

Themes

Built-in themes:

  • default
  • company

You can also layer custom CSS on top:

lark-doc-exporter \
  --doc "https://dynamia-ai.feishu.cn/wiki/WEgBwqGYOiBoQikRzjncvJDonAg" \
  --output-dir exports/company \
  --formats pdf \
  --theme company \
  --css /path/to/your-company-print.css

Development / Unreleased

Use the Git URL or a local checkout only when you intentionally need unreleased code:

uvx --from git+https://github.com/spencercjh/lark-doc-exporter lark-doc-exporter doctor

git clone https://github.com/spencercjh/lark-doc-exporter
cd lark-doc-exporter
uv sync --python 3.14 --group dev
make fmt
make ci

# Optional runtime/environment check (not part of required CI)
uv run lark-doc-exporter doctor

Notes

  • The current implementation still uses a temporary Feishu doc to translate the expanded XML into fresh Markdown.
  • The temporary doc is deleted by default after the Markdown export step. Use --keep-temp-doc only when you need to inspect that intermediate document.
  • Feishu image authcode URLs expire quickly, so image localization happens in the same run as the Markdown export.

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

lark_doc_exporter-0.3.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.

lark_doc_exporter-0.3.0-py3-none-any.whl (25.8 kB view details)

Uploaded Python 3

File details

Details for the file lark_doc_exporter-0.3.0.tar.gz.

File metadata

  • Download URL: lark_doc_exporter-0.3.0.tar.gz
  • Upload date:
  • Size: 30.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for lark_doc_exporter-0.3.0.tar.gz
Algorithm Hash digest
SHA256 c3f83bc91277db2e266edbef091275811615b772389f15b239ce9d44417bfcbd
MD5 8f8683abb824468af9207650fb248452
BLAKE2b-256 1f78cd132e52a83404bffbe0b2667c02fe22ae51fe2560d32dfae9a5d9694347

See more details on using hashes here.

Provenance

The following attestation bundles were made for lark_doc_exporter-0.3.0.tar.gz:

Publisher: publish-pypi.yml on spencercjh/lark-doc-exporter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lark_doc_exporter-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for lark_doc_exporter-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f0f7b13a9c1da2beb1078a3e55b8a9b8e7c506c77325daafbc15e3ba8e172725
MD5 fb330418634b4a3793aea1c6e2e44d7b
BLAKE2b-256 a3fb92c61cd735499b7b7f56f8bc477dee72a5f43e3d2b422203c3ded3015384

See more details on using hashes here.

Provenance

The following attestation bundles were made for lark_doc_exporter-0.3.0-py3-none-any.whl:

Publisher: publish-pypi.yml on spencercjh/lark-doc-exporter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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