CodeMD v0.0.3 🚀
Transform code files and repositories into markdown-formatted strings ready for LLM prompting and automatically copy to your clipboard. Perfect for seamless code-to-prompt workflow with ChatGPT, Claude, and other LLMs.
✨ Key Features
📝 Core Functionality
- Process single files or entire repositories into markdown format optimized for LLM prompting
- Smart scanning with recursive directory support and single file processing
- Cross-platform clipboard integration (Windows, macOS, Linux)
- Configurable output display with file saving options
🎯 Customization Options
- Relative Path Support: Options for relative/absolute paths in output
codemd /path/to/code --relative-paths
- Extended File Support: Process any text-based files
codemd /path/to/code -e md,txt,log
- Pattern Exclusion: Enhanced pattern matching
codemd /path/to/code --exclude-patterns "test_,debug_,tmp_"
- Extension Exclusion: Multiple extension formats
codemd /path/to/code --exclude-extensions ".test.js,.spec.ts,_test.py"
📊 Enhanced Output Control
- Built-in token counting via
tiktoken
- Support for both GPT-4 and GPT-3.5 encodings
- Optional line numbers in code blocks
- Customizable markdown formatting
🚀 Quick Start
# Install latest version from PyPI
pip install codemd
# Process files with relative paths
codemd . --relative-paths
# Add line numbers to code blocks
codemd /path/to/code --line-numbers
# Process with custom markdown format
codemd /path/to/code --no-structure --minimal
💡 New in This Release
- ✨ NEW: Relative path support
- Switch between absolute and relative paths
- Better for sharing and documentation
- Configurable base directory
- ✨ NEW: Line number support
- Optional line numbers in code blocks
- Configurable starting number
- Toggle for specific file types
- ✨ NEW: Enhanced pattern matching
- More flexible exclude patterns
- Support for complex file patterns
- Improved wildcard handling
- ✨ IMPROVED: Output formatting
- Minimal output option
- Customizable headers
- Better whitespace handling
- ✨ IMPROVED: File extension handling
- Support for compound extensions (.test.js)
- Better text file detection
- Automatic language detection
🔧 Requirements
- Python 3.8+
- pathspec: Required for pattern matching
- Optional:
tiktoken
for token estimation - Optional:
xclip
orxsel
for Linux clipboard support
📝 Notes
- Token counting requires
tiktoken
:pip install tiktoken
- Linux users need
xclip
orxsel
for clipboard support - Line numbers might affect token count
- Relative paths are relative to current directory by default
🐛 Bug Fixes
- Fixed path handling in Windows environments
- Corrected token counting for files with line numbers
- Improved handling of binary files
- Better error messages for inaccessible files
🔄 Breaking Changes
- Changed default path handling to absolute (use --relative-paths for relative)
- Modified exclude pattern syntax for better glob support
- Adjusted output formatting for better LLM compatibility
For detailed usage and examples, please visit our GitHub Repository.