MakerFLOSS/build-slides.sh

41 lines
1.2 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
OUTPUT_DIR="$REPO_ROOT/slides"
mkdir -p "$OUTPUT_DIR"
# Find all markdown files with marp: true frontmatter
SLIDES=()
while IFS= read -r f; do
SLIDES+=("$f")
done < <(grep -rl "^marp: true" "$REPO_ROOT/docs" --include="*.md" 2>/dev/null || true)
if [ ${#SLIDES[@]} -eq 0 ]; then
echo "No marp presentations found in docs/."
exit 0
fi
echo "Found ${#SLIDES[@]} presentation(s):"
printf ' %s\n' "${SLIDES[@]}"
2026-05-10 12:18:02 +02:00
CONFIG="$REPO_ROOT/marp.config.mjs"
if command -v npx &>/dev/null && [ -f "$CONFIG" ]; then
npx @marp-team/marp-cli --config "$CONFIG" --html --output "$OUTPUT_DIR/" "${SLIDES[@]}"
elif command -v marp &>/dev/null; then
marp --html --output "$OUTPUT_DIR/" "${SLIDES[@]}"
else
echo "marp not found locally — using Docker (marpteam/marp-cli)..."
REL_SLIDES=()
for f in "${SLIDES[@]}"; do
REL_SLIDES+=("${f#"$REPO_ROOT"/}")
done
docker run --rm \
-v "$REPO_ROOT":/home/marp/app:ro \
-v "$OUTPUT_DIR":/home/marp/output \
marpteam/marp-cli --html --output /home/marp/output "${REL_SLIDES[@]}"
fi
echo "Done — slides in $OUTPUT_DIR/"