Trans Doc to Markdown for Openclaw

Openclaw Skills converts PDFs, Lexiang links, or prepared Markdown into faithful bilingual Markdown work packages.

ajaxhe
v3.0.1
Jul 15, 2026
0
472
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install trans-doc-to-md

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install trans-doc-to-md using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Trans Doc to Markdown?

Openclaw Skills for trans-doc-to-md turn PDFs, Lexiang document links, and prepared Markdown packages into a normalized bilingual Markdown workflow that preserves source paragraphs, local image paths, tables, and ordering. The skill chooses a generic article profile or a strict pdf-rich profile so the final output matches the structure of the source instead of summarizing it.

It is optimized for document fidelity: source.md becomes the read-only baseline, meta.json carries the canonical metadata, optional images/ is kept in sync, and the final Markdown file is named from the original title. Publishing is intentionally delegated to upload-markdown-to-lexiang, keeping Openclaw Skills focused on extraction, cleanup, translation, and validation.

Trans Doc to Markdown Use Cases

  • Use Openclaw Skills to convert research PDFs, reports, whitepapers, and information-dense decks into bilingual Markdown without flattening structure.
  • Turn a Lexiang document link into a local work package with downloaded assets, normalized metadata, and preserved image order.
  • Process a prepared Markdown package when source.md and meta.json already exist and should be treated as the source of truth.
  • Preserve local image references, tables, lists, code blocks, and figure order for downstream publishing or archiving.
  • Validate whether the document should use the generic profile or the strict pdf-rich profile before release.
  • Hand off the finished package to the shared uploader skill when publishing is required, while keeping this skill extraction-only.

How Trans Doc to Markdown Works

  1. Read the P0 lessons in references/lessons-learned.md and identify the input mode: Lexiang link, local/remote PDF, or prepared Markdown package.
  2. Normalize the input into an isolated work directory containing source.md, meta.json, and optional assets such as images/, images.json, parsed_raw.md, or paper.pdf.
  3. Detect language from the first 500 non-markup characters of source.md and write the BCP 47 result into meta.json.language.
  4. Run generic cleanup without modifying source.md: preserve full source paragraphs, lists, links, tables, code, and local image order while removing clear parsing noise.
  5. If the source is a real PDF-rich document, apply extra handling for page-by-page images, cards, rich elements, TOC fidelity, and strict heading hierarchy reconciliation.
  6. Translate and compose the final bilingual Markdown file using the original title from meta.json.title, keeping headings and list items in single-line bilingual form.
  7. Validate the final output against the appropriate profile (generic or pdf-rich), then optionally delegate publishing to upload-markdown-to-lexiang using the shared work package.

Trans Doc to Markdown Setup

  1. Review the required P0 guidance before processing anything.
sed -n '1,220p' references/lessons-learned.md
  1. Ensure Python 3 and the document-processing dependencies are available. Install them only if your environment does not already provide them.
python3 -m pip install pymupdf Pillow numpy requests
  1. Create or choose a dedicated work directory and preserve source.md as the immutable baseline once it is generated.

  2. Fetch or extract the source into the work directory.

python3 scripts/lexiang_fetch.py "<Lexiang URL or entry_id>" --out-dir out/my-doc
python3 scripts/lexiang_fetch.py "<entry_id>" --out-dir out/my-doc --download-pdf
curl -L -o out/my-doc/paper.pdf "<PDF URL>"
python3 scripts/pdf_extract.py out/my-doc/paper.pdf --text --out-dir out/my-doc
python3 scripts/pdf_extract.py out/my-doc/paper.pdf --thumbs --out-dir out/my-doc
  1. If you plan to use optional Gemini translation, configure the API key before translation begins.
export GEMINI_API_KEY="<your-key>"
python3 scripts/translate_gemini.py draft.md "<Original Title>.md"
  1. Validate the bilingual output with the correct profile.
python3 scripts/bilingual_validate.py source.md "<Original Title>.md" --profile generic --json
python3 scripts/bilingual_validate.py source.md "<Original Title>.md" --profile pdf-rich --raw-source parsed_raw.md --json
  1. If publishing is needed, locate the shared uploader skill and verify its CLI contract first.
python3 "<uploader-root>/scripts/lexiang_upload.py" --version
python3 "<uploader-root>/scripts/lexiang_upload.py" upload --work-dir "out/my-doc" --md "<Original Title>.md" --meta-file meta.json --parent-from-meta --source-from-meta --name-suffix " 中英对照" --pin --json

Trans Doc to Markdown Data Schema & Taxonomy

Openclaw Skills uses a strict work directory contract so every document can be validated, translated, and published deterministically.

Path Required Purpose
source.md Yes Immutable source baseline; all cleanup and validation compare against this file.
meta.json Yes Canonical metadata used to name, route, and publish the document.
images/ Optional Local image assets referenced by source.md; paths must remain stable.
<Original Title>.md Yes Final bilingual Markdown output named from meta.json.title with filesystem-safe substitutions only.
images.json Optional Image manifest produced by Lexiang or extraction workflows.
parsed_raw.md Optional Raw parse artifact used by the pdf-rich validation path.
paper.pdf Optional Local or downloaded PDF source for extraction workflows.

meta.json standard fields:

Field Type Meaning
title string Original title; also the final Markdown file name and default publish title.
source_url string Original source URL, file:// URI, or empty string for local-only sources.
source_title string Display title from the source, usually the same as title.
source_type enum Preserved source type: article, youtube, podcast, pdf, lexiang, or prepared-markdown.
language BCP 47 tag Detected language such as en or zh-CN.
parent_id string optional Parent Lexiang entry ID used during publishing.

Additional artifacts such as entry_id, space_id, images.json, parsed_raw.md, or paper.pdf may be retained, but they never replace the standard fields above. Once source.md is created, it becomes the validation baseline and should not be overwritten by cleanup or translation steps.

Trans Doc to Markdown Advanced Features

  • Non-destructive pipeline design: once source.md exists, later steps write to drafts or final outputs only.
  • Profile-aware validation: standard articles use generic, while dense PDF reports use pdf-rich for TOC, heading hierarchy, and rich-element checks.
  • Stable local asset handling: image references, download counts, and file existence are reconciled so the markdown stays link-safe.
  • Bilingual formatting rules: headings remain single-line bilingual entries and list items stay item-by-item aligned.
  • Optional Gemini translation support: chunked 3,000 to 5,000 character translation is available when GEMINI_API_KEY is set.
  • Delegated publishing: Openclaw Skills hands off release work to upload-markdown-to-lexiang and does not embed upload logic.
  • Machine-readable validation: bilingual_validate.py can emit JSON with status, ok, profile, scope, and error fields for automated pipelines.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*