document-converter
Convert documents bidirectionally via the pi-doc-engine facade: ingest PDF/DOCX/PPTX/XLSX to provenance-stamped Markdown (with OCR), and produce templated DOCX/PDF from Markdown with diagrams, TOC and round-trip merge. Use on "convert this PDF to markdown", "ingest these docs into kb", "make a DOCX from markdown with our template", "render this spec to PDF", "OCR this scanned PDF".
- License 许可
- MIT
- 最近更新
- 2026-11-12
- Stars
- ★ 348
- Forks
- 56
01 前言 Front Matter
- name
- document-converter
- description
- Convert documents bidirectionally via the pi-doc-engine facade: ingest PDF/DOCX/PPTX/XLSX to provenance-stamped Markdown (with OCR), and produce templated DOCX/PDF from Markdown with diagrams, TOC and round-trip merge. Use on "convert this PDF to markdown", "ingest these docs into kb", "make a DOCX from markdown with our template", "render this spec to PDF", "OCR this scanned PDF".
03 SKILL.md 正文
Document Converter
TypeScript facade (@blackbelt-technology/pi-dashboard-document-converter) over
the Dockerized pi-doc-engine Python engine. Always call the facade — never
Python, docling, pandoc, or the nano-banana CLI directly. The engine is
quarantined in Docker; the facade is the only call surface.
Internals reference: packages/document-converter/README.md (facade API),
packages/document-converter/engine/README.md (JSON docker run contract).
Do NOT read the vendored Python under engine/document_converter/.
Prerequisites
- Docker available; image built:
cd packages/document-converter && npm run build:image. Thepi.toolsmanifest (package root) declarespi-doc-engineas adocker-imageprobe —pi-dashboard-ensure <package-root>/package.jsonreports image presence and the first-party build hint (confirm-gated) via the registry's Settings → Tools row. - Styled diagrams (nano-banana) need
GEMINI_API_KEYat run time; absent or on failure, rendering falls back to mmdc; if the headless browser cannot launch (e.g. wrong architecture) the call fails withMMDC_UNAVAILABLE.
Two directions
Ingest — any format → Markdown for kb
import { createDocumentConverter } from "@blackbelt-technology/pi-dashboard-document-converter";
const dc = createDocumentConverter({
image: "pi-doc-engine:0.2.0",
stagingDir: "/abs/kb-staging",
mounts: ["/docs"], // files outside cwd need a root (mounts or workspaceRoot), else PATH_NOT_ALLOWED
});
await dc.convertToMarkdown("/docs/report.pdf"); // digital PDF (auto: native-first)
await dc.convertToMarkdown("/docs/scan.pdf", { // scanned HU PDF
ocr: { mode: "force", lang: ["hungarian", "english"], engine: "tesseract" },
});
await dc.convertToMarkdown("/docs/huge.pdf", { tables: "off" }); // escape hatch: skip TableFormer
Output .md lands in stagingDir with provenance frontmatter. Feed kb via its
existing filesystem source (kb is NOT modified):
kb index --source /abs/kb-staging
kb search "<query>" --source /abs/kb-staging
OCR lang takes canonical names ("hungarian"); the facade maps to per-engine
codes. A wrong name raises OCR_LANG_UNSUPPORTED — no silent empty OCR. Default
mode: auto skips OCR on digital PDFs.
Produce — Markdown → DOCX/PDF
await dc.renderDocx("/spec.md", { output: "/spec.docx", template: "default" });
await dc.renderDocx("/spec.md", { output: "/spec.docx", nanoBanana: { enabled: true, style: "ros-3d" } });
await dc.renderPdf("/spec.docx", { output: "/spec.pdf", pageSize: "a4" });
const { meta } = await dc.extractForEdit("/in.docx", "/edit.md"); // round-trip
await dc.mergeBack("/in.docx", "/edit.md", { output: "/out.docx", meta });
Template vars come from frontmatter. Diagrams render with mmdc by default; opt in
to styled images per-doc via nanoBanana (md5-cached .mermaid-cache/<md5>.png,
deterministic, mmdc fallback).
Frontmatter tooling (the shared bus)
await dc.fillFrontmatter(["spec/**/*.md"], { language: "hu" }); // defaults + language packs + globs
await dc.profileTables(["spec/**/*.md"]); // inject table_profiles width ratios
All stages read/write one unified schema (./schema): template vars ·
table_profiles · nano_banana · provenance.
Errors
Every method rejects with DocConverterError (.code, .stderr, .exitCode):
UNSUPPORTED_FORMAT, PATH_NOT_ALLOWED, OCR_LANG_UNSUPPORTED, INGEST_FAILED, PRODUCE_FAILED,
MMDC_UNAVAILABLE (mermaid browser cannot launch — rebuild the image on this architecture), DOCKER_UNAVAILABLE, … Surface .code + .stderr; do not retry blindly.
04 同仓库更多 Skills
youtube-srt
Download YouTube subtitles (SRT + timestamped TXT) for a channel, playlist or video via yt-dlp, no media download; optionally mine them into a categorized catalog (e.g. AI models by function, open weights, local runnability, hardware tier). Use on "download the srt of this video", "transcripts of channel X for the last N months", "catalog the models AI Search talked about", "update docs/models".
video-transcription
Transcribe video and audio files to SRT subtitles with speaker diarization using the Soniox (default) or AssemblyAI API. Use when the user wants to transcribe meetings, videos, or audio files. Supports MKV, MP4, MOV, M4A, MP3. Triggers on "/transcribe", "transcribe my meetings", "transcribe videos in ~/Movies", or any request to convert audio/video to text.
speaker-id
Name anonymous diarized SRT speakers from a persistent local voiceprint library and repair speaker drift; local, CPU-only, no API key. Triggers "who is speaker 2", "put names on the transcript", "label the meeting SRT", "the diarization split one person into three", "enroll my voice". Backed by the pi-voiceid CLI.
veo-showreel-production-kit
Turn a video timeline + voiceover into a reproducible, sliceable Veo 3.1 prompt package with a consistency anchor and AI storyboard sketches.
veo-generator
Render a scripted video project into mp4 clips with the Google Veo 3.1 API. Reads a project's shot package (shots/*.md), one clip per camera cut, reusing each shot's prompt and sketch — world anchor only with `--with-reference`, seed unless `--no-seed`. Use on "render the Veo video for <project>", "generate the videos from the shot scripts", "make the clips with Veo".
hyperframes-showreel
Turn real screen and site footage into a rhythmic showreel rendered with HyperFrames: sampling, edit script, redacted clips, a generated composition, Veo only as additive FX, music edit + camera punches, delivery render and export QA. Use on "make a showreel from these recordings", "build the HyperFrames video", "assemble the footage edit", "render and QA the showreel".