code2md is a command-line tool that converts code from a specified directory into a Markdown file. It supports multiple programming languages and allows for customization through command-line flags.
For the easiest installation, download a pre-built binary.
Download the Binary:
-
Go to the releases page.
-
Download the latest binary for your operating system.
-
Windows
- Rename the downloaded file to code2md.exe.
- Place the binary in a directory that is included in your system's PATH, such as C:\Windows, or add the directory containing code2md.exe to your PATH environment variable.
-
Linux/Mac:
- Rename the binary based on your architecture:
mv code2md-linux-amd64 code2md # For Linux AMD64 mv code2md-linux-arm64 code2md # For Linux ARM64 mv code2md-darwin-amd64 code2md # For macOS AMD64 mv code2md-darwin-arm64 code2md # For macOS ARM64
- make the binary executable and move it to
/usr/local/binchmod +x code2md sudo mv code2md /usr/local/bin/ sudo chown root:root /usr/local/bin/code2md
- Rename the binary based on your architecture:
-
Requirements: Install the following dependencies
- Git to clone this repository
- Go 1.18 or later
- Make (for build and installation tasks)
-
Clone the repository:
git clone https://github.com/ahoehne/code2md.git cd code2md -
Build the application:
make build
-
Install the application:
sudo make install
To build the application for multiple platforms, run:
make buildallTo run the tests, use:
make testTo convert code from the current directory into a Markdown file named code.md, use the following command:
code2md -i . -o code.md| Flag | Short | Description |
|---|---|---|
--input |
-i |
Input directory to scan (required) |
--output |
-o |
Output Markdown file (optional, defaults to stdout) |
--languages |
-l |
Comma-separated list of allowed languages (extensions or names) |
--ignore |
-I |
Comma-separated ignore patterns |
--help |
-h |
Show help |
--version |
-v |
Show version information |
These commands copy the contents of code.md into the clipboard.
xclip -sel clip < code.mdpbcopy < code.mdclip < code.mdContributions are welcome. Please open an issue or submit a pull request.
This project is licensed under the MIT License.