aboutsummaryrefslogtreecommitdiff
path: root/justfile
diff options
context:
space:
mode:
Diffstat (limited to 'justfile')
-rw-r--r--justfile95
1 files changed, 95 insertions, 0 deletions
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 <file> - Build HTML"
+ @echo " watch <file> - Watch and rebuild"
+ @echo " pdf <file> - Export to PDF"
+ @echo " new <name> - 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