Xpersona
D

document-conversion

CLAWHUB · Unverified

Converts documents and URLs to markdown via tiered fallback (MCP markitdown, native tools, user notice)

62
Rank
84
Safety
1.6k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1.6K downloads reported by the source. Last updated 10/10/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s17emme0e2m3cpf7k2jvp3a84984b8z9:nm-leyline-document-conversion
  1. Install using `clawhub skill install s17emme0e2m3cpf7k2jvp3a84984b8z9:nm-leyline-document-conversion` in an isolated environment before connecting it to live workloads.
  2. No published capability contract is available yet, so validate auth and request/response behavior manually.
  3. Review the upstream CLAWHUB listing at https://clawhub.ai/athola/nm-leyline-document-conversion before using production credentials.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-leyline-document-conversion/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

144,580 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: document-conversion
description: |
  Converts documents and URLs to markdown via tiered fallback (MCP markitdown, native tools, user notice)
version: 1.9.8
triggers:
  - conversion
  - markitdown
  - mcp
  - documents
  - pdf
  - docx
  - a skill must ingest PDF
  - DOCX
  - or URL content
metadata: {"openclaw": {"homepage": "https://github.com/athola/claude-night-market/tree/master/plugins/leyline", "emoji": "\ud83e\udd9e", "requires": {"config": ["night-market.content-sanitization", "night-market.error-patterns"]}}}
source: claude-night-market
source_plugin: leyline
---

> **Night Market Skill** — ported from [claude-night-market/leyline](https://github.com/athola/claude-night-market/tree/master/plugins/leyline). For the full experience with agents, hooks, and commands, install the Claude Code plugin.


# Document Conversion

Convert documents and URLs to markdown using a three-tier
fallback strategy. This skill is infrastructure: consumer
skills reference it via dependency rather than reimplementing
conversion logic.

## When To Use

- Converting PDF, DOCX, PPTX, XLSX, HTML, or images to
  markdown for downstream processing
- Any skill that ingests external documents
- File format is not plain text or markdown

## When NOT To Use

- Content is already markdown or plain text
- You only need to read a small text file (use Read directly)

## Format Detection

Identify the document type from the URI before converting.

| Extension | Format | Tier 1 | Tier 2 |
|-----------|--------|--------|--------|
| `.pdf` | PDF | Yes | Read tool (pages) |
| `.docx`, `.doc` | Word | Yes | None |
| `.pptx`, `.ppt` | PowerPoint | Yes | None |
| `.xlsx`, `.xls` | Excel | Yes | None |
| `.html`, `.htm` | HTML | Yes | WebFetch |
| `.csv` | CSV | Yes | Read tool |
| `.json` | JSON | Yes | Read tool |
| `.xml` | XML | Yes | Read tool |
| `.png`, `.jpg`, `.jpeg`, `.gif`, `.webp` | Image | Yes | Read tool (visual) |
| `.mp3`, `.wav`, `.m4a` | Audio | Yes | None |
| `.zip` | Archive | Yes | None |
| `.epub` | E-book | Yes | None |

See `modules/format-matrix.md` for quality comparison
across tiers.

## Conversion Protocol

To convert a document to markdown:

```
1. DETECT  -- Identify format from URI extension or context
2. TRY     -- Tier 1: MCP markitdown (best quality)
3. DEGRADE -- Tier 2: native Claude Code tools (if Tier 1 fails)
4. INFORM  -- Tier 3: tell user what's needed (if no coverage)
5. SANITIZE -- Apply content-sanitization (external content)
```

### Tier 1: MCP markitdown

Call the `convert_to_markdown` MCP tool with the document URI.
See `modules/uri-construction.md` for URI formatting rules.

If the tool is available and succeeds, you have the best
possible conversion. Proceed to the SANITIZE step.

If the tool is not available (not found, connection error)
or fails, proceed to Tier 2.

### Tier 2: Native Claude Code Tools

Use built-in tools as format-specific fallbacks.
See `modules/fallback-tiers.md` for per-format instructions.

**Supporte

_meta.json

{
  "ownerId": "kn7d107jg9jv602h9ytsegydq184a42s",
  "slug": "nm-leyline-document-conversion",
  "version": "1.9.19",
  "publishedAt": 1787750068679
}

modules/fallback-tiers.md

---
name: fallback-tiers
description: >-
  Per-format instructions for each conversion tier.
  The operational core of the document-conversion skill.
estimated_tokens: 400
---

# Fallback Tier Instructions

## Tier 1: MCP markitdown

For all supported formats, the approach is the same:

1. Construct the URI (see `modules/uri-construction.md`)
2. Call `convert_to_markdown` with the URI
3. If the call succeeds, the result is markdown text
4. Apply `leyline:content-sanitization` to the output

**Detecting Tier 1 availability**: If the MCP tool call
returns an error like "tool not found", "server not
running", or "connection refused", Tier 1 is unavailable.
Proceed to Tier 2.

If the tool exists but returns a conversion error for
the specific file (corrupt file, unsupported variant),
also proceed to Tier 2.

## Tier 2: Native Tool Fallbacks

### PDF

Use the Read tool with the `pages` parameter:

```
Read(file_path="/path/to/file.pdf", pages="1-20")
```

For remote PDFs, first fetch with WebFetch to get a
local path or use the URL directly with Read if supported.

**Chunking strategy for large PDFs:**

- Pages 1-20: first chunk
- Pages 21-40: second chunk
- Continue in 20-page increments
- Concatenate results

**Limitations**: Tables render as plain text. Equations
are lost. Scanned pages produce no text. Images are
not extracted.

### HTML

Use WebFetch with the URL:

```
WebFetch(url="https://example.com/article.html")
```

**Limitations**: Includes navigation, headers, footers,
and boilerplate. Manually identify the main content
section and discard the rest.

### Images (PNG, JPG, GIF, WebP)

Use the Read tool to display the image visually:

```
Read(file_path="/path/to/image.png")
```

Claude sees the image and can describe its contents.

**Limitations**: No OCR text extraction. No EXIF metadata.
Good for visual inspection, not for extracting text from
screenshots or scanned documents.

### CSV

Use the Read tool to get raw comma-separated text:

```
Read(file_path="/path/to/data.csv")
```

Then format the first N rows as a markdown table manually
if needed for presentation.

### JSON and XML

Use the Read tool directly. The structured format is
readable as-is. Summarize or extract relevant sections
rather than converting the entire file.

## Tier 3: User Notification

For formats with no Tier 2 coverage, inform the user.

**Formats requiring Tier 3:**
DOCX, PPTX, XLSX/XLS, MSG, audio (MP3/WAV/M4A),
ZIP archives, EPUB.

**Notification template:**

> This {format} file requires the markitdown MCP server
> for conversion. Without it, I cannot extract the content.
>
> **Option A**: Install markitdown-mcp by adding to
> `.mcp.json`:
> ```json
> {"mcpServers": {"markitdown": {"type": "stdio",
>   "command": "uvx", "args": ["markitdown-mcp"]}}}
> ```
>
> **Option B**: Convert the file to PDF or HTML manually,
> then I can process it with built-in tools.

**Do NOT guess or fabricate content** from a document you
cannot read. Clearly state the limitation

modules/format-matrix.md

---
name: format-matrix
description: >-
  Document format support matrix showing conversion quality
  across the three fallback tiers.
estimated_tokens: 300
---

# Format Support Matrix

Quality ratings: High (preserves structure, tables, images),
Medium (readable but loses some formatting), Low (raw text
or visual only), None (not supported at this tier).

## Office Documents

| Format | Tier 1 (markitdown) | Tier 2 (native) | Notes |
|--------|---------------------|------------------|-------|
| PDF | High: structure, tables, OCR | Medium: Read tool, 20pp chunks | Native loses table formatting |
| DOCX | High: headings, lists, tables | None | Tier 3 only without markitdown |
| PPTX | High: slide-by-slide, speaker notes | None | Tier 3 only |
| XLSX/XLS | High: tables to markdown | None | Tier 3 only |
| MSG | High: email headers and body | None | Outlook format, Tier 3 only |

## Web and Data Formats

| Format | Tier 1 (markitdown) | Tier 2 (native) | Notes |
|--------|---------------------|------------------|-------|
| HTML | High: clean extraction | Medium: WebFetch | WebFetch includes boilerplate |
| CSV | High: formatted tables | Medium: Read (raw) | Native readable but unformatted |
| JSON | High: structured output | Medium: Read (raw) | Native usually sufficient |
| XML | High: structured output | Medium: Read (raw) | Native usually sufficient |

## Media Formats

| Format | Tier 1 (markitdown) | Tier 2 (native) | Notes |
|--------|---------------------|------------------|-------|
| Images | High: OCR, EXIF, and description | Low: Read (visual) | Native shows image, no text |
| Audio | Medium: speech transcription | None | Tier 3 only |

## Archive and Other

| Format | Tier 1 (markitdown) | Tier 2 (native) | Notes |
|--------|---------------------|------------------|-------|
| ZIP | High: extracts and converts contents | None | Tier 3 only |
| EPUB | High: e-book to markdown | None | Tier 3 only |

## Decision Guide

**When Tier 2 is good enough** (skip markitdown if unavailable):

- PDF with mostly text (no complex tables or equations)
- HTML articles (WebFetch handles well)
- CSV/JSON/XML (Read tool is fine for structured data)
- Images where visual inspection suffices

**When Tier 1 matters most** (strongly prefer markitdown):

- PDFs with tables, equations, or scanned content
- Office documents (DOCX, PPTX, XLSX) -- no Tier 2 at all
- Images requiring text extraction (OCR)
- Audio files requiring transcription

modules/uri-construction.md

---
name: uri-construction
description: >-
  Rules for constructing URIs accepted by the markitdown
  MCP convert_to_markdown tool.
estimated_tokens: 200
---

# URI Construction

The `convert_to_markdown` MCP tool accepts a single `uri`
parameter. The URI scheme determines how the document is
located.

## Supported Schemes

### `file://` -- Local Files

Prefix the absolute path with `file://`:

```
file:///home/user/documents/report.docx
file:///tmp/downloaded.pdf
```

**Path resolution rules:**

- Always use absolute paths (start with `/`)
- Expand `~` to the full home directory path first
- Resolve relative paths against the working directory
  before prefixing
- Spaces in paths: encode as `%20` or quote the URI

**Example resolution:**

```
Input:  ~/docs/report.docx
Step 1: /home/user/docs/report.docx
Step 2: file:///home/user/docs/report.docx
```

### `http://` and `https://` -- Remote URLs

Use the URL as-is:

```
https://arxiv.org/pdf/2301.00001v1
https://example.com/slides.pptx
```

No transformation needed. The MCP server fetches the
remote resource.

### `data:` -- Inline Content

For content already in memory (rare):

```
data:application/pdf;base64,JVBERi0xLjQK...
```

Format: `data:<mediatype>;base64,<base64-encoded-data>`

This is mainly useful for programmatic integrations,
not typical skill workflows.

## Common Patterns

| Source | URI Construction |
|--------|-----------------|
| User says "convert ~/file.pdf" | Resolve `~`, prefix `file://` |
| URL from WebSearch result | Use URL directly |
| arXiv PDF link | Use `https://arxiv.org/pdf/...` directly |
| File path from Glob/Read | Prefix with `file://` |
| Google Drive link | Use the URL (may need public sharing) |

## Error Cases

- **File not found**: Verify the path exists with Read
  before constructing the URI
- **Permission denied**: Check file permissions
- **URL unreachable**: Try WebFetch first to confirm
  accessibility
- **Unsupported scheme**: Only `file://`, `http://`,
  `https://`, and `data:` are supported

Sponsored

Ads related to document-conversion and adjacent AI workflows.