Skip to main content

No project description provided

Project description

dir2md

dir2md is a command-line tool that converts directories of files into Markdown code blocks. It also provides a reverse function, md2dir, which converts Markdown code blocks back into their original files.

Installation

Install dir2md using pip:

pip install dir2md 

Usage

dir2md can be used as a command-line tool or imported as a module.

Command-Line Tool

To convert a directory of files to Markdown code blocks, run:

dir2md [files...]

This will print the resulting Markdown to the console.

To convert Markdown code blocks back into their original files, run:

md2dir [options] <input_file>

This will create the files in the current working directory.

For more options and usage details, use the --help flag.

Module

import dir2md

# Convert a directory of files to Markdown code blocks
markdown = dir2md.dir2md("file1.py", "file2.py")

# Convert Markdown code blocks back into their original files
dir2md.md2dir_save(markdown, output_dir="output/")

Wildcard support

You can use wildcards (*) to pass multiple files at once.

For example, to include all Python files in the current directory:

dir2md *.py

To do so recursively, use **:

dir2md **/*.py

Note that the wildcard statement only works if it is expanded by the shell before the command is run. This means that you must use it in the command line or in a shell script, and it will not work if you pass it as a string to a function that runs the command.

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

dir2md-0.2.6.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dir2md-0.2.6-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file dir2md-0.2.6.tar.gz.

File metadata

  • Download URL: dir2md-0.2.6.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.11.0 Darwin/22.2.0

File hashes

Hashes for dir2md-0.2.6.tar.gz
Algorithm Hash digest
SHA256 f39b80a5365f38dd4f4b32ee118fd8adc92c9fa5b5b9c5cf9ba90b3fb6e26898
MD5 a4ff81672c3921c98ca905e6d21cfef4
BLAKE2b-256 aa74f2ed8a06c09a6b9a6e6988b15fdeeb063449517560d317e8404b6875f414

See more details on using hashes here.

File details

Details for the file dir2md-0.2.6-py3-none-any.whl.

File metadata

  • Download URL: dir2md-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.11.0 Darwin/22.2.0

File hashes

Hashes for dir2md-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 a9b3bb03d64dd03b0e5217f9331fa99fe0177384220985277d08dc1cdb179e3a
MD5 b6b46cfe78a840477a971c445bcf1e11
BLAKE2b-256 1b7d8c38e2fe0de4bd5672edae807f55484a75fe9843797b8ee5fda5b6d92414

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page