markitdown
markitdown copied to clipboard
feat: extract PDF metadata (title, author, dates) into markdown output
Summary
Closes #1664.
PDF files often carry useful metadata - title, author, subject, keywords, creator, producer, and creation/modification dates - but the current PdfConverter silently discards it. This PR surfaces that information as a Document Properties section at the top of the converted markdown.
What changed
- Added to convert PDF date strings () to readable format
- Added to format the pdfplumber metadata dict as a markdown section
- Wired both into — metadata is prepended to the output when present, skipped entirely when absent or empty
- Added with 16 tests covering unit helpers and end-to-end output via mocks
Example output
For a PDF with title and author set:
Design decisions
- Only fields that are present and non-empty are emitted — no blank lines for missing fields
- Uses 's dict (already imported); no new dependencies
- Falls back gracefully: if pdfplumber raises, metadata is skipped and pdfminer handles the text as before