A powerful documentation generator that creates beautiful markdown documentation from source code
Project description
DocGen - Beautiful Documentation Generator
A powerful documentation generator that creates beautiful Markdown documentation from source code.
Table of Contents
- Features
- Requirements
- Installation
- Quick Start
- Command Line Options
- Interactive Wizard Features
- Examples
- Output Customization
- Supported Languages
- Configuration
- Troubleshooting
- Contributing
- License
Features ✨
- 🧙♂️ Interactive wizard mode for easy configuration
- 🌳 Project tree visualization with customizable filters
- 📚 Table of contents with multiple format options
- 🔍 Smart file filtering by extension
- 📊 Detailed file statistics and analytics
- ⚡ Fast project reports for quick insights
- 🎨 Language-aware code blocks for:
- Python, JavaScript, TypeScript
- Swift, Metal
- C, C++
- HTML, CSS
- JSON, YAML, Markdown
- 📋 Optional line numbers in code blocks
- 🔗 Clickable navigation with customizable anchors
- 📦 Large file chunking for better performance
- 🎯 Minimal and full formatting options
- 🔄 CLI command generation for automation
Requirements
- Python 3.7 or higher
- Works on Windows, macOS, and Linux
Dependencies
tqdm: Progress bar visualization for documentation generation- Core Python libraries:
pathlib,typing,dataclasses(for Python < 3.7)
Note
All dependencies will be automatically installed when using pip installation methods.
Installation
Option 1: Simple Installation (Global)
Install directly from PyPI:
pip install py-code-docgen
Option 2: Development Installation (Recommended)
For development or when using a virtual environment:
-
Clone the repository:
git clone https://github.com/ci-psy/DocGen.git cd docgen
-
Create and activate a virtual environment:
# Create virtual environment python3 -m venv venv # Activate on macOS/Linux source venv/bin/activate # Activate on Windows (cmd.exe) venv\Scripts\activate.bat # Activate on Windows (PowerShell) venv\Scripts\Activate.ps1
-
Install dependencies:
pip install -r requirements.txt
Note
Remember to activate the virtual environment each time you work on the project. Your terminal prompt should change to(venv) $when it's active.
Quick Start 🚀
1. Interactive Wizard (Recommended)
Start the interactive configuration wizard:
py-code-docgen -i
The wizard will:
- Offer to show a quick project overview
- Guide you through all configuration options
- Generate a CLI command for future use
- Preview settings before generating documentation
2. Fast Project Report
Get a quick overview of your project:
py-code-docgen --fast-report
3. Direct Command Line Usage
Generate documentation with specific options:
py-code-docgen [project_dir] -o output.md --include "py,js,cpp"
4. View All Options
py-code-docgen --help
Command Line Options
usage: py-code-docgen [-h] [-i] [--fast-report] [-o OUTPUT] [--include INCLUDE]
[--show SHOW] [--show-all] [--no-collapsible]
[--collapsible-level {all,main,subsections,none}]
[--minimal] [--line-numbers] [--no-summary] [--no-tree]
[--no-file-info] [--no-line-count] [--no-file-stats]
[--no-timestamps] [--no-sizes] [--no-toc]
[--toc-format {full,name_ext,name}] [--no-toc-anchors]
[--toc-anchor-style {simple,full_path}] [--path-info]
[--chunk-size CHUNK_SIZE]
[project_dir]
Key Options Explained
--include "ext1,ext2": Specify which file types to document--show "ext1,ext2": Control which files appear in the tree view--chunk-size N: Split large files into N-line chunks for better readability--toc-format: Choose how files are displayed in the table of contents--collapsible-level: Control which sections can be collapsed
Interactive Wizard Features
The -i flag launches an interactive wizard that helps you:
-
Project Overview
- Optional fast report before configuration
- File type detection and statistics
- Quick project insights
-
Smart Configuration
- Step-by-step guided setup
- File type filtering with auto-detection
- Tree view customization
- TOC format selection
- Collapsible section control
-
Output Customization
- Multiple documentation styles
- Line number options
- File information detail levels
- Large file handling settings
-
CLI Command Generation
- Generates equivalent command line
- Perfect for automation or scripting
- Easy to save and reuse settings
Example generated command:
py-code-docgen "my_project" -o "docs.md" --include "py,js" --toc-format full --collapsible-level main --line-numbers
Examples
Basic Documentation
py-code-docgen .
Python-Only Documentation
py-code-docgen --include py --no-toc --minimal
Detailed C++ Documentation
py-code-docgen --include cpp --toc-format full --collapsible-level main --line-numbers
Quick Project Analysis
py-code-docgen --fast-report
Large Project with Chunking
py-code-docgen . --chunk-size 100 --collapsible-level all
Output Customization
Table of Contents Formats
- Full paths:
dir/subdir/file.ext - Name with extension:
file.ext - Just name:
file
Collapsible Sections
- All sections: Everything collapsible
- Main sections: Only file sections collapsible
- Subsections: Only details collapsible
- None: Everything expanded
File Information
- File sizes and line counts
- Last modified timestamps
- File type statistics
- Custom path information
Code Display
- Syntax highlighting
- Optional line numbers
- Customizable chunk sizes
- Multiple formatting styles
Supported Languages
DocGen automatically detects and applies language-specific formatting for:
| Language/Format | Extensions |
|---|---|
| Python | .py |
| JavaScript | .js |
| TypeScript | .ts |
| Swift | .swift |
| Metal | .metal |
| C++ | .cpp, .h |
| C | .c |
| HTML | .html |
| CSS | .css |
| JSON | .json |
| YAML | .yml, .yaml |
| Markdown | .md |
The actual syntax highlighting in the generated documentation depends on your Markdown viewer's capabilities.
Configuration
File Filtering
- Use
.gitignore-style patterns to exclude files/directories:py-code-docgen --exclude "node_modules/,*.test.js"
Large Files
- Control chunk size for better performance:
py-code-docgen --chunk-size 100 # Split files into 100-line chunks
Output Format
-
Minimal Mode: Clean, compact output
py-code-docgen --minimal -
Full Mode: Detailed documentation with all features
py-code-docgen --show-all --line-numbers --path-info
Progress Indicators
- Show progress during generation:
py-code-docgen --show-progress
Troubleshooting
Common Issues
-
Virtual Environment Activation
- Issue:
command not found: py-code-docgen - Solution: Ensure virtual environment is activated:
source venv/bin/activate # macOS/Linux venv\Scripts\activate.bat # Windows
- Issue:
-
Large Files
- Issue: Documentation generation is slow or memory-intensive
- Solution: Adjust chunk size:
py-code-docgen --chunk-size 50 # Smaller chunks
-
Unicode/Encoding
- Issue: Special characters appear garbled
- Solution: Ensure files are UTF-8 encoded
-
Permission Issues
- Issue: Cannot read certain files
- Solution: Check file permissions or run with appropriate privileges
Version Information
Check your installed version:
py-code-docgen --version
Getting Help
-
Run the interactive wizard:
py-code-docgen -i -
View all options:
py-code-docgen --help -
Generate a fast report:
py-code-docgen --fast-report
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
License
This project is licensed under the MIT License.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py_code_docgen-0.1.7.tar.gz.
File metadata
- Download URL: py_code_docgen-0.1.7.tar.gz
- Upload date:
- Size: 17.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c0fade6a5e951616640e78bcd9e9818ff4efba101722969c2c381301e38f9ec
|
|
| MD5 |
04616c7ea417d0524728c10a24f567bc
|
|
| BLAKE2b-256 |
843a4201012c7c14abac18016902fc196a77357fa87634614427d1417f690f70
|
File details
Details for the file py_code_docgen-0.1.7-py3-none-any.whl.
File metadata
- Download URL: py_code_docgen-0.1.7-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5e8a0a36b013c1ce12705fa7fe97ffe67339076f83fa7b9b62afb7d147ecf80
|
|
| MD5 |
afb8d5092af7685295bd2f7c06a48ffb
|
|
| BLAKE2b-256 |
262a7b99283725a1a71997edf3497f7bd592ec1e7055568b7edde8989e0c5ac8
|