#!/bin/bash # HTML structure html_start=' ' html_end=' ' # Iterate over each markdown file in the current directory for file in *.md; do # Read markdown content from file markdown_content=$(cat "$file") # Convert markdown to HTML html_content=$(gh api \ --method POST \ -H "Accept: application/vnd.github+json" \ -H "X-GitHub-Api-Version: 2022-11-28" \ /markdown \ -f text="$markdown_content" ) # Write HTML content to a new file html_file="./html/${file%.md}.html" echo "$html_start$html_content$html_end" > "$html_file" echo "Conversion completed. HTML content written to $html_file" done