Skip to main content

Your First OSF Document

Learn OSF basics by creating a simple document, slide, and spreadsheet.

Step 1: Create a File

Create a new file with a .osf extension:

touch hello.osf

On Windows: Right-click in folder → New → Text Document → Rename to hello.osf

Step 2: Add Metadata

Open hello.osf and add a metadata block:

@meta {
  title: "My First Document";
  author: "Your Name";
  date: "2025-10-16";
  theme: default;
}

💡 Explanation: The @meta block contains document information. Properties end with semicolons.

Step 3: Add Content

Add a document block with some text:

@doc {
  # Welcome
  
  This is my **first** OSF document!
  
  ## What I've Learned
  
  - OSF uses @ symbols for blocks
  - Markdown syntax works inside @doc
  - It's just plain text
}

Step 4: Parse and Validate

Check that your document is valid:

osf parse hello.osf

You should see:

✓ Parse successful
Blocks: 2 (meta, doc)

Step 5: Export to PDF

Generate a PDF from your OSF file:

osf render hello.osf --format pdf

This creates hello.pdf in the same directory!

Complete Example

Here's a complete OSF document with all basic features:

@meta {
  title: "Complete Example";
  author: "Your Name";
  date: "2025-10-15";
  theme: corporate;
}

@doc {
  # Introduction
  
  This document has **three** sections:
  
  1. This narrative section
  2. A presentation slide
  3. A data table
}

@slide {
  title: "Key Points";
  layout: TitleAndContent;
  
  - OSF is plain text
  - Export to multiple formats
  - Git-friendly and AI-friendly
}

@sheet {
  name: "Data";
  cols: [Item, Value];
  
  A1 = "Item";
  B1 = "Value";
  A2 = "Revenue";
  B2 = 100;
  A3 = "Cost";
  B3 = 60;
  A4 = "Profit";
  B4 = =B2-B3;
}

What's Next?