Skip to main content

Interactive Configuration

repo2pdf uses an interactive prompt system powered by Inquirer.js to guide you through the configuration process. All options are configured at runtime—there’s no config file to maintain.

Available Features

When you run repo2pdf, you’ll be presented with a checkbox prompt to select features:
Use the spacebar to select or deselect each feature.

Add Line Numbers

Adds line numbers to the left side of each line of code in the PDF output.
Implementation Details: The line numbers are automatically padded to align properly based on the total number of lines:

Add Highlighting

Applies syntax highlighting to code using highlight.js. The tool automatically detects the language based on file extensions. Supported Languages: Highlight.js supports 190+ languages. The tool attempts to detect the language from the file extension:
If the language can’t be detected, it falls back to plaintext rendering.
Syntax highlighting adds color to different code elements like keywords, strings, comments, and functions, making the PDF more readable.

Add Page Numbers

Adds page numbers in the format “Page: X of Y” centered at the bottom of each page.
Page numbers are only added when using the single PDF output mode. They are not included when using “One PDF per file” mode.

Remove Comments

Strips comments from source code using the strip-comments library.
This removes:
  • Single-line comments (//, #, etc.)
  • Multi-line comments (/* */, <!-- -->, etc.)
  • Docstring comments

Remove Empty Lines

Removes blank lines from the output to create more compact PDFs.
This feature is useful for reducing PDF size and page count, especially for codebases with heavy whitespace formatting.

One PDF per File

Generates a separate PDF for each file instead of combining everything into a single PDF. When this option is selected:
  • You’ll be prompted for an output folder name instead of a file name
  • Each file gets its own PDF named after its path
  • The default folder is ./output
File Naming Convention: PDFs are named using the file’s relative path with path separators replaced by underscores:
Example:
See Output Options for more details.

Output Configuration

The output configuration depends on whether you select “One PDF per file”:
You’ll be prompted for a filename:
Default: output.pdfThis creates one PDF containing all files in the repository.

Custom Exclusions

You can customize which files and extensions to exclude by creating a repo2pdf.ignore file in the root of your repository.

File Format

The repo2pdf.ignore file uses JSON format:

How It Works

The tool loads the ignore configuration using:
Custom exclusions are merged with the universal exclusions:

Universal Exclusions

These files and extensions are always excluded: Files/Directories:
Extensions:
The repo2pdf.ignore file itself is always excluded from the PDF output.

Example Use Cases

Code Formatting

repo2pdf automatically formats code using Prettier when a supported parser is available.

Supported File Types

If Prettier formatting fails, the tool falls back to plain text:

Repository Cleanup

For remote repositories, you can choose whether to keep the cloned repository:
The tempRepo directory is automatically deleted after a 3-second delay:
This option only appears when converting remote repositories. Local repositories are never deleted.

Next Steps

Output Options

Learn about single vs multiple PDF output modes

Basic Usage

Back to basic usage guide

Local Repositories

Process local repositories