Skip to main content

DTMD (Directory-to-Markdown)

Overview

DTMD (Directory-to-Markdown) is a Python command-line tool, particularly useful for quickly generating and sharing representations of directory structures and their contents in a structured and readable Markdown format. This makes it ideal for documenting project structures, especially for interactions with language models like ChatGPT.

Markdown is the most token efficient manner to interact with LLM's

Example output

dtmd
# /my_project
## main.py
```python
# Main application file
import app

app.run()

app.py

# App module

def run():
    print('Running the app')

/utils

helper.py

# Utility functions

def helper():
    return 'Helper function'

### Features
- Convert directory contents to Markdown format.
- Include or exclude files using patterns (supports fnmatch style, e.g., `*.py`, `data*`).
- Recursive directory parsing.
- Options for output: printing to console, saving to a file, or copying to the clipboard.

## Installation

```bash
pip install dtmd

Usage

Run DTMD from the command line with the following options:

dtmd <target-directory> [options]

If no target directory is specified, DTM will default to the current working directory.

Options:

  • -i or --include: Patterns to include files. Enclose patterns in quotes to avoid shell expansion (e.g., '*.py', 'data*').
  • -e or --exclude: Patterns to exclude files. Enclose patterns in quotes to avoid shell expansion (e.g., '*.xml', 'temp*').
  • -o or --output-file: Set the output Markdown file name.
  • -r or --recursive: Enable recursive search in directories.
  • -p or --print: Print the output using rich formatting.
  • -c or --clipboard: Copy the output to the clipboard.

Example

dtmd myfolder -i '*.py' '*.html' -o output.md -r

This command will parse all .py and .html files in myfolder recursively and save the Markdown output to output.md.

Authors

  • Adrian Galilea - Initial work

Acknowledgments

  • Hat tip to ChatGPT for assistance with project setup and documentation.

Metadata

Release files for dtmd 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dtmd 0.1.0
File Size Uploaded
dtmd-0.1.0.tar.gz 3.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dtmd 0.1.0
File Interpreter ABI Platform
dtmd-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.7 kB

Release files / dtmd-0.1.0.tar.gz

Download URL dtmd-0.1.0.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
28ec1dd4efd40dc0a643964fec68a340e115090f44a5b2498d7aefc15fc8b47b
BLAKE2b-256 checksum
How to use checksums
95a92e094bd67bf15d0a95a300c878e297676980083f02a935123994c3865e1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release files / dtmd-0.1.0-py3-none-any.whl

Download URL dtmd-0.1.0-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d1dfaf5fdc055ec5dc4061ddf523726a36643b9e48fd66fe73675224ff642a24
BLAKE2b-256 checksum
How to use checksums
51fe4d2bbc906413681d5919ca258e256e684d1afe153fa0b1dba2b0d45eb441
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page