#!/bin/bash

# Set the path to the content folder
CONTENT_DIR="../content"

# Loop through all markdown files in the content folder
find "$CONTENT_DIR" -type f -name "*.md" | while read -r file; do
  # Use sed to replace the old format with the new format while preserving the YouTube ID
  sed -i '' -E 's|{% include video id="([a-zA-Z0-9_-]+)" provider="youtube" %}|{{ youtube(id="\1") }}|g' "$file"
  echo "Processed: $file"
done
