How saikrishna1876/f2md works
f2md is a CLI and library for converting PDFs, DOCX files, and images into Markdown with Gemini. The main workflow accepts a file and output destination, extracts document content (or prepares an image for OCR), sends the material to the model, writes Markdown, and removes unused extracted images. The CLI also supports interactive setup and configuration; the public API exposes the same conversion function. Conversion details and these relationships are based on the excerpts and README; extraction branches are implemented within the sampled conversion module.
Main entry points: convert.ts Conversion workflow · cli.ts Interactive CLI · index.ts Public API
Components 13
Entry and configuration
- Interactive CLI
src/cli.ts - Setup and config
src/cli.ts
Document conversion
- Conversion workflow
src/convert.ts - PDF extraction
src/convert.ts - DOCX extraction
src/convert.ts - Image OCR preparation
src/convert.ts - Gemini model
Output management
- Markdown and image files
src/convert.ts - Unused image cleanup
src/convert.ts
Library API
- Public API
src/index.ts
Other components
- User
- Local filesystem
- Library consumer
Connections 16
- User → Interactive CLI: provides file
README.md - Interactive CLI → Setup and config: resolves config
src/cli.ts - User → Setup and config: runs setup
README.md - Setup and config → Local filesystem: reads or writes config
src/cli.ts - Interactive CLI → Conversion workflow: calls convert
src/cli.ts - Conversion workflow → PDF extraction: extracts PDF
src/convert.ts - Conversion workflow → DOCX extraction: extracts DOCX
src/convert.ts - Conversion workflow → Image OCR preparation: prepares image
src/convert.ts - Conversion workflow → Gemini model: streams request
src/convert.ts - Conversion workflow → Local filesystem: reads input
src/convert.ts - Conversion workflow → Markdown and image files: writes Markdown
src/convert.ts - Conversion workflow → Unused image cleanup: cleans images
src/convert.ts - Unused image cleanup → Local filesystem: deletes unused images
src/convert.ts - Markdown and image files → Local filesystem: stores files
src/convert.ts - Library consumer → Public API: calls API
README.md - Public API → Conversion workflow: exports convert
src/index.ts