Usage
python merge.py <folder_path> <output_file> [<exclude_list_file>]
# Example:
python merge.py ./project ./merged.md ./.gitignore
Exclude File
If you provide a file like .gitignore, the script will skip any file whose full path contains any line from .gitignore. You can replace should_exclude() logic with real glob/wildcard checks if that’s preferred. Fenced Code Blocks Inside File Contents
We detect whether your file contents already contain ` ``` or ~~~. If so, we switch to an alternative fence to avoid accidentally “closing” the block. If your files contain both triple-backticks and triple-tilde, we cycle through a few alternatives. Binary Files
If an open operation fails or non-text data triggers decode errors, we continue (skip them). Adjust as needed.