Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
.DS_Store
public/
public/

# Resume PDF generation artifacts
typst/data/resume-data.json
typst/main.typ
129 changes: 129 additions & 0 deletions RESUME_PDF.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# Resume PDF Generation System

This system automatically generates professional PDF resumes from the markdown content in `content/resume/_index.md` using Typst.

## Features

- **Automatic extraction** of resume data from markdown
- **Multiple layout styles** (default, modern, minimal, classic)
- **Modular configuration** for easy customization
- **Server-side generation** integrated with the build process

## Quick Start

### Generate PDF Only
```bash
# Default style
./scripts/build_resume.sh

# Specific style
./scripts/build_resume.sh modern
./scripts/build_resume.sh minimal
./scripts/build_resume.sh classic
```

### Build Site + PDF
```bash
# Builds both the Zola site and generates the PDF
./scripts/build_site.sh [style]
```

## Directory Structure

```
typst/
├── data/ # Generated JSON data from markdown
├── styles/ # Style configurations
│ └── styles.typ # All style definitions
├── templates/ # Typst templates
│ └── resume.typ # Main resume template
├── config.env # Configuration file
└── main.typ # Generated document entry point

scripts/
├── extract_resume_data.py # Markdown to JSON parser
├── build_resume.sh # PDF generation script
└── build_site.sh # Complete build script
```

## Available Styles

### Default
- Blue accent color (#365590)
- Section lines enabled
- Traditional layout

### Modern
- Blue accent color (#2563eb)
- No section lines
- Clean, minimal design
- Larger name font

### Minimal
- Black accent color
- No section lines
- Compact spacing
- Simple typography

### Classic
- Burgundy accent color (#800020)
- Traditional serif fonts
- Justified text
- Formal layout

## Customization

### 1. Edit Configuration
Modify `typst/config.env` to change basic settings.

### 2. Create New Style
Add a new configuration in `typst/styles/styles.typ`:

```typst
#let my-config = {
let config = default-config
config.colors.accent = rgb("#your-color")
// ... customize other properties
config
}
```

### 3. Modify Template
Edit `typst/templates/resume.typ` to change the layout structure.

## Integration with CI/CD

The build scripts can be integrated into deployment workflows:

```yaml
# Example GitHub Actions step
- name: Build Resume PDF
run: |
./scripts/build_site.sh modern

- name: Deploy
run: |
# Deploy public/ directory
# PDF is available at static/resume.pdf
```

## Dependencies

- **Typst** - Install via cargo: `cargo install typst-cli`
- **Python 3** - For markdown parsing
- **Zola** - For site generation (optional)

## Troubleshooting

### Font Warnings
If you see font warnings, the system will fall back to system fonts. This is normal and doesn't affect functionality.

### Build Errors
- Ensure Typst is in your PATH: `export PATH="$HOME/.cargo/bin:$PATH"`
- Check that all required files exist in the typst/ directory
- Verify the JSON data is being generated correctly

### Style Issues
- Check that your style name matches the config names in styles.typ
- Ensure color values are valid Typst rgb() values
- Verify spacing values include units (pt, em, in, etc.)
65 changes: 65 additions & 0 deletions scripts/build_resume.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/bash
# Build resume PDF using Typst

set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
TYPST_DIR="$PROJECT_ROOT/typst"
CONTENT_DIR="$PROJECT_ROOT/content/resume"
STATIC_DIR="$PROJECT_ROOT/static"

# Configuration
STYLE=${1:-"default"} # default, modern, minimal, classic
OUTPUT_NAME=${2:-"resume.pdf"}

echo "Building resume PDF with style: $STYLE"

# Extract resume data from markdown
echo "Extracting resume data..."
python3 "$SCRIPT_DIR/extract_resume_data.py" \
"$CONTENT_DIR/_index.md" \
"$TYPST_DIR/data/resume-data.json"

# Create main.typ with selected style
echo "Generating Typst document..."
cat > "$TYPST_DIR/main.typ" << EOF
// Main resume document
// Imports resume data and generates PDF

#import "templates/resume.typ": resume
#import "styles/styles.typ": default-config, modern-config, minimal-config, classic-config

// Load resume data from JSON
#let resume-data = json("data/resume-data.json")

// Choose configuration
#let config = ${STYLE}-config

// Generate resume
#resume(
name: resume-data.name,
contact: resume-data.contact,
sections: resume-data.sections,
config: config
)
EOF

# Check if typst is available
if ! command -v typst &> /dev/null; then
echo "Error: typst command not found. Please install Typst."
echo "Trying to use cargo installed version..."
export PATH="$HOME/.cargo/bin:$PATH"
if ! command -v typst &> /dev/null; then
echo "Error: typst still not found even after adding cargo bin to PATH"
exit 1
fi
fi

# Compile to PDF
echo "Compiling PDF..."
cd "$TYPST_DIR"
typst compile main.typ "$STATIC_DIR/$OUTPUT_NAME"

echo "Resume PDF generated: $STATIC_DIR/$OUTPUT_NAME"
echo "Style used: $STYLE"
34 changes: 34 additions & 0 deletions scripts/build_site.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
# Enhanced build script that builds both the Zola site and the PDF resume

set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"

# Configuration
RESUME_STYLE=${1:-"default"} # default, modern, minimal, classic
OUTPUT_NAME="resume.pdf"

echo "Building Zola site with updated resume..."

# Build the resume PDF
echo "1. Generating resume PDF..."
cd "$PROJECT_ROOT"
export PATH="$HOME/.cargo/bin:$PATH"
./scripts/build_resume.sh "$RESUME_STYLE" "$OUTPUT_NAME"

# Check if zola is available
if ! command -v zola &> /dev/null; then
echo "Warning: zola command not found. Skipping site build."
echo "PDF generation complete. Resume available at: static/$OUTPUT_NAME"
exit 0
fi

# Build the Zola site
echo "2. Building Zola site..."
zola build

echo "Build complete!"
echo "- Resume PDF: static/$OUTPUT_NAME (style: $RESUME_STYLE)"
echo "- Site: public/"
32 changes: 32 additions & 0 deletions scripts/example_custom_style.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
# Example: Create a custom style and generate PDF

# This script demonstrates how to create a custom style configuration

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"

# Add a custom style to the styles.typ file
cat >> "$PROJECT_ROOT/typst/styles/styles.typ" << 'EOF'

// Custom teal configuration
#let teal-config = {
let config = default-config
config.colors.accent = rgb("#14b8a6")
config.colors.section = rgb("#14b8a6")
config.section-line = true
config.sizes.name = 26pt
config.spacing.after-header = 18pt
config
}
EOF

# Temporarily update the build script to support the new style
sed -i 's/classic-config/teal-config/' "$PROJECT_ROOT/typst/main.typ"

# Build with the custom style
cd "$PROJECT_ROOT"
export PATH="$HOME/.cargo/bin:$PATH"
./scripts/build_resume.sh teal "resume-teal.pdf"

echo "Custom teal style PDF generated: static/resume-teal.pdf"
Loading