A command-line utility written in Rust that combines multiple .mdx files from a directory (and its subdirectories) into a single output file.
- Recursively scans directories for
.mdxfiles - Preserves original file names as comments in the combined output
- Follows symbolic links
- Handles errors gracefully with detailed messages
- Rust and Cargo installed on your system
Clone the repository and build the project:
git clone [repository-url]
cd md-generator
cargo build --releaseRun the program with a directory path as an argument:
cargo run [directory-path]Or after building:
./target/release/md-generator [directory-path]The program will:
- Scan the specified directory and its subdirectories for
.mdxfiles - Create a new file named
combined.mdxin the current directory - Combine all found
.mdxfiles into this single output file - Add file path comments to indicate the source of each section
If you have a directory structure like:
docs/
├── intro.mdx
├── guide/
│ ├── getting-started.mdx
│ └── advanced.mdx
└── api/
└── reference.mdx
Running:
cargo run docsWill create a combined.mdx file containing all the .mdx content with file markers like:
<!-- File: docs/intro.mdx -->
[content of intro.mdx]
<!-- File: docs/guide/getting-started.mdx -->
[content of getting-started.mdx]
...walkdir: For recursive directory traversalanyhow: For error handling