Transform code repositories into markdown-formatted strings ready for LLM prompting
Project description
___ _ ___
/ __\ ___ __| | ___ /\/\ / \
/ / / _ \ / _` | / _ \ / \ / /\ /
/ /___ | (_) || (_| || __/ / /\/\ \ / /_//
\____/ \___/ \__,_| \___| \/ \//___,'
Ver. 0.0.3b
CodeMD
🚀 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.
📝 Overview
Tired of copying code files one by one? CodeMD instantly collects all relevant code in Markdown format and copies it to your clipboard - ready for ChatGPT, Claude, or any LLM? CodeMD helps you convert your code files or entire codebase into a format that's optimal for code-related prompts with Large Language Models (LLMs) like GPT-4, Claude, and others. It automatically processes your code files and outputs them in a clean, markdown-formatted structure that's perfect for LLM interactions.
✨ Features
- 🔍 Flexible Processing:
- Single file processing
- Recursive directory scanning
- 🎯 Configurable Options:
- Configurable file extensions
- File and pattern exclusion support
- Custom .gitignore support
- 📊 Smart Output:
- Markdown-formatted code blocks
- Optional directory structure visualization
- Token count estimation (with tiktoken)
- Configurable output display
- 📋 Convenience:
- Simple command-line interface
- Direct copy-to-clipboard support
- Multiple output options
🎉 Recent Updates (0.0.3b)
- ⭐ NEW: Single file processing support
- ⭐ NEW: Configurable output display (use
--printto show output) - ⭐ NEW: Repository structure visualization (auto-disabled for single files, or use
--no-structure) - ⭐ NEW: Automatic .gitignore support
- Uses project's .gitignore by default
- Custom .gitignore files via
--gitignore - Disable with
--ignore-gitignore
🚀 Installation
pip install codemd
or install from source!
git clone https://github.com/dotpyu/codemd.git
cd codemd
pip install -e .
📖 Usage
Command Line Interface
Single File Processing:
# Process a single file (no output by default)
codemd /path/to/script.py
# Process and display output
codemd /path/to/script.py --print
# Save to file
codemd /path/to/script.py -o output.md
Directory Processing:
# Basic directory scanning (no output by default)
codemd /path/to/your/code
# Show output in terminal
codemd /path/to/your/code --print
# Custom extensions and output file
codemd /path/to/your/code -e py,java,sql -o output.md
Pattern Exclusion:
codemd /path/to/your/code \
--exclude-patterns "test_,debug_" \
--exclude-extensions "test.py,spec.js"
.gitignore Configuration:
# Use custom gitignore files
codemd /path/to/your/code --gitignore .gitignore .custom-ignore
# Disable gitignore processing
codemd /path/to/your/code --ignore-gitignore
🤝 Contributing
Contributions are welcome! Feel free to open issues or submit pull requests.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📄 License
Distributed under the Apache 2.0 License. See LICENSE for more information.
Project details
Release history Release notifications | RSS feed
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 codemd-0.0.3b0.tar.gz.
File metadata
- Download URL: codemd-0.0.3b0.tar.gz
- Upload date:
- Size: 15.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9306c8d8be8dfb56d1cb530ead0fb5bd4274cd808cf974296b6ddddf470e8d43
|
|
| MD5 |
5dbcc48518fc7681fa7c02d5fd938b87
|
|
| BLAKE2b-256 |
9bdda0f0f998482045e3e9a135a605285117c496d14305279dba82d0b39aff5c
|
Provenance
The following attestation bundles were made for codemd-0.0.3b0.tar.gz:
Publisher:
publish.yml on dotpyu/codemd
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codemd-0.0.3b0.tar.gz -
Subject digest:
9306c8d8be8dfb56d1cb530ead0fb5bd4274cd808cf974296b6ddddf470e8d43 - Sigstore transparency entry: 150325601
- Sigstore integration time:
-
Permalink:
dotpyu/codemd@8b77541300f1845b7b2589da9650c294de9788b5 -
Branch / Tag:
refs/tags/v0.0.3b - Owner: https://github.com/dotpyu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8b77541300f1845b7b2589da9650c294de9788b5 -
Trigger Event:
release
-
Statement type:
File details
Details for the file codemd-0.0.3b0-py3-none-any.whl.
File metadata
- Download URL: codemd-0.0.3b0-py3-none-any.whl
- Upload date:
- Size: 13.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0fa0d83106ddc91bb4e31250f5212e807ff5c558377dacea497d41bec83d895d
|
|
| MD5 |
95e1e72066623300f6058352d71f107b
|
|
| BLAKE2b-256 |
1b415f92a27abd384036ad7c7fedc4d3deb44625c0820b66aa72b9452535d96c
|
Provenance
The following attestation bundles were made for codemd-0.0.3b0-py3-none-any.whl:
Publisher:
publish.yml on dotpyu/codemd
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codemd-0.0.3b0-py3-none-any.whl -
Subject digest:
0fa0d83106ddc91bb4e31250f5212e807ff5c558377dacea497d41bec83d895d - Sigstore transparency entry: 150325603
- Sigstore integration time:
-
Permalink:
dotpyu/codemd@8b77541300f1845b7b2589da9650c294de9788b5 -
Branch / Tag:
refs/tags/v0.0.3b - Owner: https://github.com/dotpyu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8b77541300f1845b7b2589da9650c294de9788b5 -
Trigger Event:
release
-
Statement type: