extract_markdown
Extract markdown text from PDF or image files, with optional saving to disk as content.md and embedded images.
Instructions
Extract markdown text from a PDF or image file.
When output_dir is provided, saves the extracted markdown to
content.md inside a named subdirectory. When include_images
is also True, saves embedded images alongside the markdown file.
Otherwise returns the markdown text inline.
Args:
file_path: Absolute path to the input file (PDF or image)
output_dir: Absolute path to an existing output directory (must be
within allowed dir). When set, saves markdown to disk at
<output_dir>/<file_stem>/content.md.
include_images: When True (requires output_dir), save images to
disk and rewrite markdown with relative image links.
Returns: When output_dir is not set: result: Extracted markdown content When output_dir is set (with or without images): output_directory: Absolute path to the output subdirectory markdown_file: Absolute path to the content.md file images: List of saved image filenames (empty if include_images is False)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | ||
| output_dir | No | ||
| include_images | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| images | Yes | ||
| result | Yes | ||
| markdown_file | Yes | ||
| output_directory | Yes |