dir-to-md
v0.0.2
Published
> Convert your project directories into Markdown with a single command — clipboard-ready, file-exportable, and fully customizable with `.gitignore`-like rules.
Readme
📁 dir-to-md
Convert your project directories into Markdown with a single command — clipboard-ready, file-exportable, and fully customizable with
.gitignore-like rules.
📦 Installation
Local Project Use
npm install dir-to-mdGlobal CLI Use
npm install -g dir-to-mdDevelopment Installation
git clone https://github.com/your-username/dir-to-md.git
cd dir-to-md
npm install
npm run build
npm pack
npm install -g ./dir-to-md-*.tgz🚀 Usage
✨ Default Mode (Clipboard)
dir-to-mdCopies all non-ignored files from the current directory to your clipboard as a Markdown snippet.
🧩 Commands
🔹 copy
Copy directory contents to clipboard:
dir-to-md copyWith custom ignore patterns:
dir-to-md copy --ignore "*.tmp" "temp/**"🔹 directory
Export to a Markdown file (default: output.md):
dir-to-md directoryWith custom path:
dir-to-md directory --path notes.mdWith custom ignores:
dir-to-md directory --path notes.md --ignore "*.log" "node_modules/"🔹 ignore
Manage persistent ignore rules stored in ignore.json.
Show current ignore patterns:
dir-to-md ignore --showAdd new patterns:
dir-to-md ignore --add "*.log" "dist/**"Include specific files (override ignore):
dir-to-md ignore --add '!important.log'Remove patterns:
dir-to-md ignore --remove "*.log"💡 Tip: Wrap include patterns (those starting with
!) in quotes to avoid shell issues.
🧰 Global Options
You can use --ignore with any command to apply temporary ignore rules:
dir-to-md directory --ignore "*.test.js" "coverage/**"🎯 Ignore System Explained
This tool supports layered ignoring with the following priority:
.gitignore— automatically respected if foundignore.json— persisted rules, editable via CLI--ignoreCLI flag — per-command override
✔ Supported Syntax
- Wildcards:
*.log,**/temp/*,?ile.txt - Negation:
!keep.mdto include ignored files - Directory match:
node_modules/,dist/**,.git/
✍️ Markdown Output Format
Each file is formatted as a Markdown snippet:
# src/index.ts
\```ts
console.log('Hello World');
\```
# README.md
```md
# Project Title
```
---
## 🛠 Development
### 🔧 Available Scripts
```bash
npm run build # Compile TypeScript
npm start # Run built CLI locally
npm pack # Bundle the CLI for distribution
```🤝 Contributing
We welcome contributions!
- Fork this repo
- Create a new branch
- Make your changes and commit
- Open a pull request
Bonus points for tests and useful examples 🙌
📄 License
This project is licensed under the MIT License. See the LICENSE file for full details.
