From 8a2440993ce6e65b8f4b5b71a0feb3b63a9c968e Mon Sep 17 00:00:00 2001 From: Sam Scholten Date: Sun, 19 Oct 2025 21:29:03 +1000 Subject: init --- justfile | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 justfile (limited to 'justfile') diff --git a/justfile b/justfile new file mode 100644 index 0000000..dfe3fe3 --- /dev/null +++ b/justfile @@ -0,0 +1,95 @@ +# Justfile for Marp presentations + +# Default command +default: + just help + +# Show help +help: + @echo "Commands:" + @echo " build - Build HTML" + @echo " watch - Watch and rebuild" + @echo " pdf - Export to PDF" + @echo " new - Create presentation" + @echo " clean - Remove output files" + @echo " demo - Build demo presentations" + @echo "" + @echo "Themes: acarp (16:9), acarp-beamer (4:3)" + @echo "Layouts: title, layout-2col" + +# Install dependencies +install: + npm install + +# Check if dependencies are installed, install if needed +deps: + @if [ ! -d "node_modules" ] || [ ! -f "package-lock.json" ]; then \ + echo "Installing dependencies..."; \ + npm install; \ + fi + +# Build HTML from markdown +build file: deps + npx marp --config .marprc.json --html {{file}} + +# Watch markdown file and rebuild on changes +watch file: deps + npx marp --config .marprc.json --watch {{file}} + +# Convert to PDF +pdf file: deps + npx marp --config .marprc.json --pdf --browser chrome {{file}} + +# Build and open HTML file +build-open file: (build file) + #!/usr/bin/env sh + html_file="$(echo "{{file}}" | sed 's/\.md$/.html/')" + echo "Opening $html_file..." + if command -v xdg-open > /dev/null; then + xdg-open "$html_file" + elif command -v open > /dev/null; then + open "$html_file" + elif command -v start > /dev/null; then + start "$html_file" + else + echo "Could not find a command to open files" + fi + +# Create new presentation from template +new name: + @cp template.md "{{name}}.md" + @echo "Created {{name}}.md" + +# Clean output files +clean: + @rm -f *.html *.pdf *.pptx + +# Build demo presentations +demo: + @echo "Building demo-standard.md..." + npx marp --config .marprc.json --html demo-standard.md + @echo "Building demo-beamer.md..." + npx marp --config .marprc.json --html demo-beamer.md + @echo "Demo files built successfully!" + +build-open-all: + #!/usr/bin/env sh + # Build all files first + for file in *.md; do + if [ -f "$file" ]; then + echo "Building $file..." + theme=$(if echo "$file" | grep -q "beamer"; then echo "acarp-beamer"; else echo "acarp"; fi) + npx marp --theme "$theme" --theme-set acarp.css --theme-set acarp-beamer.css --allow-local-files --html "$file" + fi + done + # Then open all HTML files + echo "Opening all HTML files..." + for file in *.html; do + if [ -f "$file" ]; then + if command -v xdg-open > /dev/null; then + xdg-open "$file" & + elif command -v open > /dev/null; then + open "$file" + fi + fi + done -- cgit v1.2.3