#!/bin/bash

output="merged_output.md"
> "$output"

for file in *.md; do
    if [ "$file" != "$output" ]; then
        echo "Processing $file..."
        
        # Add the header
        echo "=== $file begin ===" >> "$output"
        
        # Append the content
        cat "$file" >> "$output"
        
        # Add the footer and a spacer
        echo -e "\n=== $file end ===\n" >> "$output"
    fi
done

echo "Finished! Check $output for the results."
