npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

repo2pdf

v2.2.4

Published

A CLI tool for generating a PDF document from a GitHub repository

Downloads

157

Readme

repo2pdf

npm npm NPM GitHub Stars GitHub Forks GitHub issues GitHub pull requests GitHub top language Contributions welcome

NPM: https://www.npmjs.com/package/repo2pdf

Website: https://repo2pdf.vercel.app/

repo2pdf is an innovative and versatile tool designed to seamlessly transform GitHub repositories into well-formatted, visually engaging, and easy-to-navigate PDF files. By automating the process of cloning repositories and parsing code files, repo2pdf serves a variety of use-cases including teaching, code reviews, offline referencing, archiving, AI training, and document embedding. The tool's flexibility expands the horizons of interacting with codebases by bridging the gap between the dynamic world of coding and the static, universally accessible format of PDFs, catering to a multitude of user needs and creative applications.


Installation and Usage

repo2pdf can be installed by either directly using NPX or cloning the repository from GitHub. The steps and prompts vary based on the chosen method.

NEW! Use the webapp here


Installing and Using repo2pdf with NPX

This method downloads and installs the latest version of repo2pdf from the NPM registry.

  1. Install repo2pdf using NPX:
npx repo2pdf
  1. The script will start running. Follow the prompt and provide the necessary information.
    • GitHub repository URL
    • Output file name
    • Decision on whether to keep the cloned repository (Y/N)

Installing and Using repo2pdf by Cloning the Repository

This method involves manually cloning the repo2pdf repository and setting it up on your local machine.

  1. Clone the repository:
git clone https://github.com/BankkRoll/repo2pdf
  1. Navigate to the repo2pdf directory:
cd repo2pdf
  1. Install the dependencies:
npm install
  1. Build the script:
npm run build
  1. Run the script:
npm start
  1. The script will start running. Follow the prompt and provide the necessary information:
    • Decision on whether to clone a repository or use a local repository
      • If using a local repository, provide the path
      • If cloning a repository, provide the URL
    • Features checklist for
      • add line numbers in the PDF
      • add page numbers in the PDF
      • add highlighting in the PDF
      • remove comments from the code
      • remove empty lines from the code
      • one file or one PDF per file
    • Name of the output PDF file or output directory
    • Decision on whether to keep the cloned repository after generating the PDF

Please note that you need to have Node > 18 and git(for non-local repos) installed on your system in order to run repo2pdf.


Configuration

repo2pdf automatically ignores certain file types and directories (e.g., .png, .git). To customize the files and directories to ignore, you can add a repo2pdf.ignore file to the root of your repository.

Please note that if you use a local repository, the repo2pdf.ignore file must be in the root of the repository directory. And you might need to add more directories to the ignore list, as the script does not automatically ignores different build files and directories.

Example of file structure

{
  "ignoredFiles": ["tsconfig.json", "dist", "node_modules"],
  "ignoredExtensions": [".raw"]
}

Troubleshooting / FAQ

npm install [package-name]
// Example: Changing font size in syntax.ts
doc.fontSize(12);
{
  "ignoredFiles": ["tsconfig.json"],
  "ignoredExtensions": [".md"]
}

Contributing to repo2pdf

Your insights, skills, and valuable time can make a huge difference in the evolution of repo2pdf! We're always excited to see the community helping in shaping this tool to be even more efficient and feature-rich.

Reporting Bugs

Encountered a hiccup? We're here to help! Please:

  1. Open an issue on GitHub detailing the bug.
  2. Describe the problem in depth. Share the steps to reproduce the issue and any error messages you received.
  3. If possible, provide information about your operating system and Node.js version.

Suggesting Enhancements

Have a brilliant idea for a new feature or an improvement to an existing one? We're all ears! Please:

  1. Open an issue on GitHub to share your suggestions.
  2. Be as detailed as possible, explaining what you want to achieve and why it would be beneficial to the project.

Writing Code

If you're up for rolling up your sleeves to contribute code to fix a bug or implement a new feature, here's how you can get started:

  1. Fork the repository.
  2. Create a new branch for your changes.
  3. Make your changes in your branch.
  4. Submit a pull request from your branch to the main repo2pdf repository.

In your pull request, please provide a clear description of the changes you've made. We appreciate contributions that adhere to our coding conventions and are consistent with the existing codebase - it helps us maintain the quality of the project and makes the review process more efficient.

Here are some feature ideas and improvements that could be implemented in repo2pdf to enhance its functionality and user experience:

  • Table of Contents Generation: Auto-generate sections based on directories and subsections based on files.
  • Customizable Themes: Enable customizations for fonts, colors, and layout of the generated PDF.
  • Interactive Progress Bar: Show a real-time progress bar in the terminal during the conversion process.
  • Support for Private Repositories: Implement OAuth2 GitHub authentication for private repositories.
  • Enhanced Error Handling: Provide clear error messages when a repository cannot be cloned.
  • Conversion Options Presets: Define presets like 'minimalist': no line numbers, no highlighting, 'full-featured': line numbers, syntax highlighting.
  • Support for Additional VCS: Extend support for other version control systems like GitLab, Bitbucket, and others.
  • Support for Non-Git Repositories: Add support for other version control systems such as Mercurial or SVN.
  • Client-Side Web Application: Develop a user-friendly web application for converting repositories and customizing settings.
  • Text Compression: Use font subsetting and compression techniques to reduce the size of the generated PDF.

Feel free to contribute to the project by implementing any of these ideas or suggesting new ones!


Meet Our Contributors

We're ever grateful for the valuable contributions from our community. Meet the people who're helping shape repo2pdf:

Contributors


License

repo2pdf is open source software, licensed under the MIT License. See the LICENSE file for more information.

Star History