Chapter 3: Document Structure - The Art of the Outline
You’ve mastered the basics: headings, folding, moving things around. Now let’s explore the full power of Org-Mode’s document structure. This is where you’ll learn to think in outlines.
1. Headings: More Than Meets the Asterisk
We’ve established that asterisks create headings:
#+begin_example
2. One asterisk = Level 1
2.1. Two asterisks = Level 2
2.1.1. Three asterisks = Level 3
#+end_example
But headings in Org-Mode are more than visual organization—they’re structural containers with their own properties, metadata, and behaviors.
2.2. The Anatomy of a Heading
A complete heading can include several components:
#+begin_example
3. TODO Write documentation work urgent
This is the heading body. Everything until the next heading belongs to this section. #+end_example
Let’s break this down:
*- The level indicatorTODO- A state keyword (we’ll cover this deeply in Chapter 6)Write documentation- The heading text itself:work:urgent:- Tags (Chapter 7)SCHEDULED:- A planning keyword with timestamp:PROPERTIES:- A property drawer with metadata- The body content below
Each component is optional. A heading can be just * Simple or a metadata-rich container. The choice is yours.
4. Text Formatting: Yes, It’s Still Plain Text
Org-Mode supports rich text formatting using simple markup:
*bold text* /italic text/ _underlined text_ =verbatim text= (displayed in monospace) ~code~ (also monospace) +strikethrough text+
When Org-Mode displays these, they render beautifully, but open the file in any text editor and it’s still human-readable. This is the plain-text philosophy in action.
4.1. Escaping Special Characters
Need to write an actual asterisk without creating a heading? Precede it with a comma or use a zero-width space:
* This is not a heading
5. Lists: Bullets, Numbers, and Checkboxes
Org-Mode has sophisticated list support. Simple to start, powerful when you need it.
5.1. Unordered Lists
#+begin_example
6. Shopping List
- Milk
- Eggs
- Free range if possible
- Brown eggs preferred
- Coffee
- Dark roast
- Bread
#+end_example
Start a line with -, +, or * (if not at the start of the line) to create a list item. Press M-RET on a list item to create another at the same level.
6.1. Ordered Lists
#+begin_example
7. Recipe Steps
- Preheat oven to 350°F
- Mix dry ingredients
- Flour
- Sugar
- Baking powder
- Add wet ingredients
- Bake for 25 minutes
#+end_example
Org-Mode automatically renumbers lists when you add or remove items. Move an item with M-up/down and the numbers update automatically. It’s the little things.
7.1. Description Lists
#+begin_example
8. Git Commands
- git add
- Stage changes for commit
- git commit
- Save staged changes to history
- git push
- Send commits to remote repository
- git pull
- Fetch and merge remote changes
#+end_example
The :: separator creates description lists—perfect for glossaries, definitions, or any term/description pairs.
8.1. Checkbox Lists
Here’s where lists get seriously useful:
#+begin_example
9. Project Tasks
[ ]Design mockups[ ]Get client approval[X]Set up development environment[ ]Write tests[ ]Implement features[X]User authentication[ ]Dashboard[ ]Reports
[ ]Deploy to staging
#+end_example
[ ] creates an unchecked box, [X] is checked. Press C-c C-c (Control-c twice) on a checkbox to toggle it.
The magic: parent items show completion statistics:
#+begin_example
10. Project Tasks [1/5]
[ ]Task 1[X]Task 2[ ]Task 3[ ]Task 4[ ]Task 5
#+end_example
Or as a percentage:
#+begin_example
11. Project Tasks [20%]
#+end_example
Add [/] or [%] after the heading text, and Org-Mode calculates it automatically when you toggle child checkboxes. This is phenomenal for tracking progress in nested task lists.
12. Structural Editing: Your Outline Swiss Army Knife
You’ve learned the basic movement commands. Let’s expand your toolkit.
12.1. Creating and Promoting Headings
M-RET- New heading at same levelM-S-RET- New TODO heading at same level (Shift-Alt-Enter)C-RET- New heading after current subtreeM-left/right- Promote/demote heading (changes level)M-S-left/right- Promote/demote subtree (heading + all children)
12.2. Moving Things Around
M-up/down- Move heading/list item up or downM-S-up/down- Move entire subtree up or downC-c C-w- Refile heading to another location (powerful—we’ll revisit this)
12.3. Marking and Narrowing
C-c @- Mark subtree (select the whole thing)C-x n s- Narrow to subtree (hide everything else—pure focus)C-x n w- Widen back to full document
Narrowing is underrated. Working on one section of a large document? Narrow to it and eliminate all distractions. The rest of the file temporarily ceases to exist.
13. Drawers: Hidden Storage
Drawers are collapsible sections for metadata that you don’t need to see all the time:
#+begin_example
14. Project Meeting Notes
The actual meeting notes go here. #+end_example
The :PROPERTIES: drawer stores key-value pairs. The :LOGBOOK: drawer (auto-created) stores notes and state changes. Press TAB on a drawer to collapse/expand it.
You can create custom drawers too:
#+begin_example
15. Project
#+end_example
16. Blocks: Special Sections
Blocks are regions with special formatting or behavior:
16.1. Quote Blocks
#+BEGIN_QUOTE The best way to predict the future is to invent it. — Alan Kay #+END_QUOTE
16.2. Example Blocks
#+BEGIN_EXAMPLE This text is displayed in monospace and preserves spacing exactly.
#+end_example
16.3. Source Code Blocks
#+BEGIN_SRC python
def fibonacci(n):
if n <= 1:
return n
return fibonacci(n-1) + fibonacci(n-2)
#+end_src
We’ll dive deep into code blocks in Chapter 11 (spoiler: they’re executable).
16.4. Center Blocks
#+BEGIN_CENTER This text will be centered when exported. #+END_CENTER
Press C-c ' (Control-c single-quote) inside a code block to edit it in a dedicated buffer with full syntax highlighting and language-specific features. Edit, then C-c ' again to return. It’s magical.
17. Comments and Comment Blocks
Sometimes you need notes that don’t export:
#+begin_example
18. A Regular Heading
This exports.
This also exports. #+end_example
You can also comment entire subtrees:
#+begin_example
19. Footnotes: Academic Precision
20. Horizontal Rules
Sometimes you need a visual separator:
#+begin_example
21. Section One
Content here.
22. Section Two
More content. #+end_example
Five or more dashes on a line creates a horizontal rule.
23. Archiving Old Content
Documents grow. Eventually you’ll want to move completed or outdated items without deleting them:
#+begin_example
24. Active Projects
24.1. TODO Current work
24.2. DONE Old project
#+end_example
C-c C-x C-a archives the current subtree, moving it to your archive file (or archive location) while preserving its structure and metadata.
Think of it as a “soft delete” that maintains history without cluttering your active workspace.
25. The Sparse Tree: X-Ray Vision for Your Document
Here’s a killer feature: sparse trees let you filter your document to show only matching items.
C-c / r- Show headings matching a regexpC-c / t- Show TODO itemsC-c / p- Show items with specific propertiesC-c / T- Show items with specific tags
The document folds to show only matches and their context. Everything else disappears. When you’re done, C-c C-c clears the sparse tree.
Working on a specific tag across a 5000-line document? Sparse tree it. Need to see all TODO items? Sparse tree. This feature alone justifies the plain-text approach.
26. Your Document Structure Philosophy
Here’s the thing about outlines: there’s no “correct” structure. Some people organize by project. Others by time (daily/weekly notes). Some by area of responsibility. Many combine approaches.
Org-Mode doesn’t care. It provides the tools; you provide the structure. Experiment. Reorganize. Your .org files should evolve as you do.
27. Practical Exercise
Create a document that uses:
- At least three levels of headings
- Both ordered and unordered lists
- A checkbox list with nested items
- A few formatted text elements (bold, italic, code)
- At least one block (quote, example, or code)
- A comment that won’t export
- Practice using sparse trees to filter your content
Play with structural editing. Move things around. Feel the outline become an extension of your thought process.
28. Next Up: Tables
You’ve mastered document structure. In the next chapter, we’ll tackle one of Org-Mode’s most surprisingly powerful features: tables that act like spreadsheets, all in plain text. You’re going to love it.
Footnotes:
Various blogs and tutorials exist, though quality varies. #+end_example
Or use inline footnotes:
Org-Mode was created in 2003[fn::Though it built on earlier work in Outline mode].
Press C-c C-c on a footnote reference to jump to its definition. Press it again to jump back. Org-Mode handles numbering automatically.