lt2md
Convert born-digital, scanned, or mixed PDFs into auditable Markdown while preserving reading order, equations, source-page anchors, and information-bearing images as adjacent non-original text descriptions. Use this skill whenever a user asks to transcribe, OCR, understand, or convert a PDF into Markdown, especially for scanned PDFs, image-heavy pages, formulas, multi-column layouts, page or section ranges, or token-efficient reuse. LT2MD (Long Transcribe to Markdown) is a workflow contract, not a replacement for a PDF parser or OCR/VLM backend.
libnyx · 已有 AI 审核记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add libnyx/LT2MD --skill lt2md技能说明
name: lt2md description: Convert born-digital, scanned, or mixed PDFs into auditable Markdown while preserving reading order, equations, source-page anchors, and information-bearing images as adjacent non-original text descriptions. Use this skill whenever a user asks to transcribe, OCR, understand, or convert a PDF into Markdown, especially for scanned PDFs, image-heavy pages, formulas, multi-column layouts, page or section ranges, or token-efficient reuse. LT2MD (Long Transcribe to Markdown) is a workflow contract, not a replacement for a PDF parser or OCR/VLM backend.
LT2MD — Long Transcribe to Markdown
LT2MD turns observable PDF content into Markdown that an agent or a person can audit later. It is designed for born-digital, scanned, and mixed PDFs. The goal is not merely to obtain text: preserve reading order, formulas, figure meaning, scope boundaries, and a path back to the source page.
The PDF remains the only authority for content. OCR, extracted text, model guesses, and formatting preferences are candidates or transformations, never evidence that can overrule the rendered page.
Read before doing the task
- Read workflow.md for roles, batches, two-pass visual reading, and write permissions.
- Before rendering or reusing pages, read page-cache.md and initialize/recover a local job with
scripts/manage_job.py. - Before creating or changing a candidate Markdown file, read markdown-contract.md; for long documents also read job-state.md and checkpoint-review.md.
- Before a format review, read format-review.md and treat 示范文档.md as a read-only format fixture.
- Use
scripts/validate_markdown.py,scripts/audit_markdown.py, andscripts/manage_job.py verifyas separate final gates. Do not place OCR, model calls, or PDF interpretation inside the static tools.
Non-negotiable principles
- Separate evidence, semantic target, and allowed transformation. Evidence is the rendered page, PDF page number, readable text layer, and Markdown markers. The semantic target is the author's text, mathematics, figure relationships, and reading order. Allowed transformations include merging print line breaks, removing page furniture, and applying the Markdown contract.
- Lock the scope before writing. If no range is specified, process the whole PDF. If a range is specified, do not silently expand it. A range that ends mid-page includes only the requested semantic blocks.
- Reuse page evidence by byte identity. Render through the content-addressed job cache. The same PDF bytes and render configuration must reuse verified page PNGs across chapters, restarts and renamed files; only missing or corrupt pages may be rerendered.
- Use the rendered page as the tie-breaker. Text extraction and OCR are useful candidates. They do not settle reading order, formulas, captions, diagrams, or ambiguous glyphs without visual confirmation.
- Describe every information-bearing figure. Keep the original caption when readable, then place an adjacent description explicitly marked as a LT2MD/transcriber supplement and not original text. Include objects, labels, directions, arrows, sequence, spatial relationships, subfigures, and relationships directly expressed by the figure without inventing outside conclusions.
- Keep provenance local. Put one block-level
SOURCEHTML comment on its own line before every complete paragraph, display equation, figure block, table or example block. Do not insert an anchor inside a word, sentence, inline formula, display-math block, table row, caption or image description. A cross-page block uses one physical-page range before the merged block. - Keep content and format review separate. Content corrections require evidence from the source PDF. A format reviewer may only report or apply style-only changes against the immutable fixture. Only the coordinator writes the final Markdown.
- Mark uncertainty instead of guessing. When a glyph, page boundary, or reading order cannot be uniquely resolved, give the best source-grounded transcription and add a
转录注with the exact page and ambiguity. Never silently normalize an uncertain value into a familiar one.
Operating procedure
- Preflight. Initialize or recover a job. Record the PDF SHA-256, physical page count, requested range, book-page mapping if readable, text-layer availability, render configuration, columns, formula/figure density, output path and task-requirement hash. Render the original pages before trusting OCR. If printed page numbers become visibly clear only after initialization and have a verified linear relation, record it before the first inventory with
manage_job.py set-book-page-offset <job> --offset <N>; otherwise retainunmappedrather than guessing. Once recorded, that mapping is source evidence: the batch scaffold'ssource_print_pagesand everySOURCEBOOK_PAGEmust follow it, and manager review/checkpoint/finalization rejects contradictions. - Batch. Process continuous page ranges adaptively: 1–2 dense/low-quality pages, 2–4 ordinary pages, and at most 6 clear single-column pages. If the user did not choose groups, run
manage_job.py batch-plan <job> --jsonafter initialization, then visually lower any recommendation that contains formulas, tables, multi-column order, dense figures, poor legibility, or a cross-page semantic block. The raster-only plan is a conservative starting point, not visual proof. Prefer complete paragraphs, sections, or examples as cut points; keep a sentence crossing a page boundary with one transcriber. - Inventory and transcribe. Before trusting any existing Markdown candidate, visually inventory each source page's headings, prose, displayed equations, figures/captions, tables, footnotes, examples/exercises and