▼ |  | Pollen: the book is a program

1 | Installation
2 | Quick tour
3 | Backstory
4 | The big picture
5 | First tutorial
6 | Second tutorial
7 | Using raco pollen
8 | File formats
9 | ◊ command overview
10 | Module reference
11 | Acknowledgments
12 | License & source code
| Index

On this page:

Pollen: the book is a program

6.0.1.13
← prev up next →

## Pollen: the book is a program

Matthew Butterick <mb@mbtype.com>

#lang pollen | package: pollen

Pollen is a publishing system that helps authors create beautiful and functional web-based books. Pollen includes tools for writing, designing, programming, testing, and publishing.

I used Pollen to create my book Butterick’s Practical Typography. Sure, go take a look. Is it better than the last digital book you encountered? Yes it is. Would you like your book to look like that? If so, keep reading.

At the core of Pollen is an argument:

- First, that digital books should be the best books we’ve ever had. So far, they’re not even close.

- Second, that because digital books are software, an author shouldn’t think of a book as merely data. The book is a program.

- Third, that the way we make digital books better than their predecessors is by exploiting this programmability.

That’s what Pollen is for.

Not that you need to be a programmer to use Pollen. On the contrary, the Pollen language is markup-based, so you can write & edit text naturally. But when you want to automate repetitive tasks, add cross-references, or pull in data from other sources, you can access a full programming language from within the text.

That language is Racket. I chose Racket because while the idea for Pollen had been with me for several years, it simply wasn’t possible to build it with other languages. So if it’s unfamiliar to you, don’t panic. It was unfamiliar to me. Once you see what you can do with Pollen & Racket, you may be persuaded. I was.

Or, if you can find a better digital-publishing tool, use that. But I’m never going back to the way I used to work.

1 Installation
2 Quick tour
2.1 Creating a source file
2.2 Running a source file
2.3 Naming, saving, and rendering a source file
2.4 The project server
2.5 Intermission
2.6 Pollen as a preprocessor
2.7 Markdown mode
2.8 Markup mode
2.9 Templates
2.10 PS for Scribble users
2.11 The end of the beginning
3 Backstory
3.1 Web development and its discontents
3.2 The better idea: a programming model
3.3 “Now you have two problems”
3.4 Rethinking the solution for digital books
3.5 Enter Racket
3.6 What is Pollen?
4 The big picture
4.1 The book is a program
4.2 One language, multiple dialects
4.3 Development environment
4.4 A special data structure for HTML
4.5 Pollen command syntax
4.6 The preprocessor
4.7 Templated source files
4.8 Pagetrees
5 First tutorial
5.1 Prerequisites
5.2 The relationship of Racket & Pollen
5.3 Starting a new file in DrRacket
5.3.1 Setting the #lang line
5.3.2 Putting in the text of the poem
5.3.3 Saving & naming your source file
5.4 Using the project server
5.4.1 Starting the project server with raco pollen
5.4.2 Using the dashboard
5.4.3 Source files in the dashboard
5.5 Working with the preprocessor
5.5.1 Setting up a preprocessor source file
5.5.2 Creating valid HTML output
5.5.3 Adding commands
5.5.4 Racket basics (if you’re not familiar)
5.5.5 Defining variables with commands
5.5.6 Inserting values from variables
5.5.7 Inserting variables within CSS
5.6 First tutorial complete
6 Second tutorial
6.1 Prerequisites
6.2 Prelude: my principled objection to Markdown
6.3 Markdown in Pollen: two options
6.3.1 Using Markdown with the preprocessor
6.3.2 Authoring mode
6.3.3 X-expressions
6.3.4 Markdown authoring mode
6.4 Templates
6.4.1 The ->html function and the doc variable
6.4.2 Making a custom template
6.4.3 Inserting specific source data into templates
6.4.4 Linking to an external CSS file
6.5 Intermission
6.6 Pagetrees
6.6.1 Pagetree navigation
6.6.2 Using the automatic pagetree
6.6.3 Adding navigation links to the template with here
6.6.4 Handling navigation boundaries with conditionals
6.6.5 Making a pagetree file
6.6.6 index.ptree & the project server
6.7 Second tutorial complete
7 Using raco pollen
7.1 Making sure raco pollen works
7.2 raco pollen
7.3 raco pollen help
7.4 raco pollen start
7.5 raco pollen render
7.6 raco pollen clone
8 File formats
8.1 Source formats
8.1.1 Command syntax using ◊
8.1.2 Any command is valid
8.1.3 Standard exports
8.1.4 Custom exports
8.1.5 The project-require.rkt file
8.1.6 Preprocessor (.pp extension)
8.1.7 Markdown (.pmd extension)
8.1.8 Markup (.pm extension)
8.1.9 Pagetree (.ptree extension)
8.2 Utility formats
8.2.1 Scribble (.scrbl extension)
8.2.2 Null (.p extension)
9 ◊ command overview
9.1 The golden rule
9.2 The lozenge glyph (◊)
9.3 The two command modes: text mode & Racket mode
9.3.1 The command name
9.3.1.1 Invoking tag functions
9.3.1.2 Invoking other functions
9.3.1.3 Inserting the value of a variable
9.3.1.4 Inserting a comment
9.3.2 The Racket arguments
9.3.3 The text argument
9.4 Further reading
10 Module reference
10.1 Cache
10.2 Decode
10.2.1 Block
10.2.2 Typography
10.3 File
10.4 Pagetree
10.4.1 Navigation
10.4.2 Utilities
10.5 Render
10.6 Template
10.7 Tag
10.8 Top
10.9 World
11 Acknowledgments
12 License & source code
Index

← prev up next →