Welcome Contributors!
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. Whether you’re fixing a bug, adding a feature, or improving documentation, your contributions are welcome and appreciated.Ways to Contribute
There are many ways to contribute to repo2pdf:Report Bugs
Found an issue? Let us know!
Suggest Features
Have ideas for improvements?
Write Code
Contribute bug fixes or new features
Reporting Bugs
Encountered a hiccup? We’re here to help!Before Submitting a Bug Report
- Check existing issues: Search GitHub Issues to see if the bug has already been reported
- Try the latest version: Make sure you’re using the most recent version of repo2pdf:
- Review the troubleshooting guide: Check the Troubleshooting page for common issues
Submitting a Bug Report
When opening an issue on GitHub, please include:Describe the bug
Provide a clear and concise description of what the bug is.Example: “PDF generation fails when repository contains files with emoji in filenames”
Steps to reproduce
Detail the exact steps to reproduce the issue:
- Run
npx repo2pdf - Enter repository URL:
https://github.com/example/repo - Select features: Line numbers, Highlighting
- Click generate
- Observe error
Expected behavior
Describe what you expected to happen.Example: “PDF should be generated successfully”
Environment information
Provide details about your environment:
- Operating System: macOS 13.0, Ubuntu 22.04, Windows 11, etc.
- Node.js version: Run
node --version - npm version: Run
npm --version - Git version: Run
git --version - repo2pdf version: Check with
npm list -g repo2pdf
Bug Report Template
Suggesting Enhancements
Have a brilliant idea for a new feature or an improvement to an existing one? We’re all ears!Before Submitting an Enhancement
- Check existing issues: Search for similar feature requests
- Review the roadmap: Check if the feature is already planned
- Consider the scope: Make sure the feature aligns with repo2pdf’s core purpose
Submitting a Feature Request
When opening an issue on GitHub, please:Describe the feature
Provide a clear and concise description of the feature.Example: “Add support for exporting to multiple formats (DOCX, HTML)”
Explain the motivation
Why would this feature be useful? What problem does it solve?Example: “Users often need to edit the generated documentation in Word or publish it as HTML. Currently they must manually convert the PDF.”
Describe the solution
How would you like this feature to work?Example: “Add a ‘Output format’ selection in the CLI with options: PDF, DOCX, HTML, Markdown”
Alternatives considered
Have you considered any alternative solutions or workarounds?Example: “Users could use external PDF converters, but this adds an extra step”
Enhancement Template
Writing Code
Ready to contribute code? Here’s how to get started:Getting Started
Fork the repository
Click the “Fork” button on the repo2pdf GitHub page
Create a branch
Create a new branch for your changes:Branch naming conventions:
feature/- New featuresfix/- Bug fixesdocs/- Documentation changesrefactor/- Code refactoringtest/- Adding tests
Make your changes
Edit the code in your branch. Key files:
src/clone.ts- Main PDF generation logicsrc/configHandler.ts- CLI prompts and configurationsrc/syntax.ts- Syntax highlighting and formattingsrc/loadIgnoreConfig.ts- File ignore configurationsrc/universalExcludes.ts- Default exclusion lists
Test your changes
Build and run the project:Test with various repositories and configurations to ensure your changes work correctly.
Commit your changes
feat:- New featurefix:- Bug fixdocs:- Documentation changesstyle:- Code style changes (formatting, etc.)refactor:- Code refactoringtest:- Adding testschore:- Maintenance tasks
Pull Request Guidelines
When submitting a pull request, please:Provide a clear description
Provide a clear description
Explain what your PR does and why. Include:
- Summary: Brief overview of changes
- Motivation: Why is this change needed?
- Changes: List of specific changes made
- Testing: How you tested the changes
Keep changes focused
Keep changes focused
- One PR should address one issue or feature
- Avoid mixing unrelated changes
- If you have multiple improvements, create separate PRs
Follow coding conventions
Follow coding conventions
Maintain consistency with the existing codebase:
- Use TypeScript for all new code
- Follow the existing code style
- Run
npm run formatbefore committing - Add type definitions for new functions
- Use meaningful variable and function names
Update documentation
Update documentation
If your PR changes behavior, update the relevant documentation:
- Update README.md if needed
- Add JSDoc comments for new functions
- Update type definitions
- Add examples for new features
Add tests (if applicable)
Add tests (if applicable)
While repo2pdf doesn’t currently have a comprehensive test suite, consider:
- Testing your changes manually with various repositories
- Documenting test cases in the PR description
- Suggesting test scenarios for reviewers
Be responsive to feedback
Be responsive to feedback
- Respond to review comments promptly
- Be open to suggestions and changes
- Update your PR based on feedback
- Keep the conversation focused and professional
Development Tips
Understanding the codebase
Understanding the codebase
Key files and their purposes:
src/clone.ts- Entry point and main PDF generation logic- Handles CLI initialization
- Orchestrates PDF creation
- Manages file processing
src/configHandler.ts- Interactive CLI prompts- Defines all user prompts
- Handles validation
- Passes configuration to main function
src/syntax.ts- Syntax highlighting- Converts highlight.js output to PDF format
- Handles color mapping
src/loadIgnoreConfig.ts- File filtering- Loads
repo2pdf.ignoreconfiguration - Merges with default exclusions
- Loads
src/universalExcludes.ts- Default exclusions- Lists of always-excluded files and extensions
Working with PDFKit
Working with PDFKit
Working with highlight.js
Working with highlight.js
Debugging
Debugging
Tips for debugging:
-
Use console.log liberally:
-
Test with small repositories first:
- Create a test repo with just a few files
- Easier to track down issues
-
Check the temp directory:
- Cloned repos are in
./tempRepo - Select “Yes” to keep it for inspection
- Cloned repos are in
-
Use the TypeScript compiler:
Publishing Releases
This section is for maintainers with publish access.
v*.*.*) or when manually dispatched.
Release Process
Verify the publish
- Check the Actions tab on GitHub
- Ensure the build succeeds
- Verify the new version on npm
Re-running a Failed Publish
If the publish step needs to be re-run:- Go to the Actions tab on GitHub
- Select Publish Package
- Click Run workflow
- Enter the tag name (e.g.,
v2.3.0) as therelease_taginput - Click Run workflow
Meet Our Contributors
We’re ever grateful for the valuable contributions from our community. Meet the people who are helping shape repo2pdf:Code of Conduct
Our Pledge
We are committed to providing a welcoming and inspiring community for all. We pledge to make participation in our project a harassment-free experience for everyone, regardless of:- Age, body size, disability, ethnicity
- Gender identity and expression
- Level of experience, education, socio-economic status
- Nationality, personal appearance, race, religion
- Sexual identity and orientation
Our Standards
Examples of behavior that contributes to a positive environment:- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members