I. What Does Leo Do?

A. Kewl Stuff You Can Do

  1. Outlines and Nodes
  2. Clones and Views
  3. External Files

B. In Brief:

  1. Outlines consist of nodes. Nodes consist of headlines, body text and optional user data. Headlines appear in Leo's outline pane, and the selected headline's body text will be in the body pane. User data is available to scripts, but is not visible. Leo's main window also contains an icon area, log pane, and a Emacs-like minibuffer.
  2. A clone is a "live" copy of a node. Using clones, any node may appear in many places in the outline. A view is a node containing other nodes, including clones. Thus, outlines can contain arbitrarily many views of their data in the outline. You never need to choose between different views of your data. You can have them all.
  3. @auto, @file, @shadow and @thin nodes (and their descendants) manage external files. @file and @thin nodes create external files containing special comments called sentinels. Using @thin is recommended whenever possible. External files managed with @shadow and @auto contain no sentinels--Leo automatically imports the external file when reading a .leo file. Leo directives such as @language, @color and @tabwidth control syntax coloring and other settings. Directives may be inherited, and they remain in effect until overridden in descendant nodes.

(See full definitions of undefined terms in the extended sections above.)

C. First Steps for Newbies

D. The rst3 and ipython plugins

II. How Do I Take Charge of and Abuse Leo?

A. Kewl Stuff You Can Do

(The following sections are for power users, programmers and others brave enough to attempt to take command of Leo.)

  1. Commanders, Nodes and Positions
  2. Script Buttons and Node Types
  3. Directives and Sections

B. In Brief:

  1. Nothing in Leo is just text. All data in Leo are true Python objects. Leo's DOM (document object model) consists of commanders, nodes and positions. Saving a .leo files saves these objects. Leo's execute-script command predefines three variables: c is the outline's commander, g is Leo's utility module, leoGlobals.py, and p is the position of the presently selected node. c.allNodes_iter is an iterator returning all nodes of the outline. p.h, p.b and p.u are the headline, body text and user data of the node at position p. Internally, Leo represents nodes using two separate data structures, the vnode p.v and the tnode p.v.t. A position represents a state of a tree traversal: a node may appear at many distinct positions in an outline.
  2. Scripts in @button and @command nodes create new minibuffer commands, with optional key bindings. Applying such scripts bring scripts to data. Headlines can be considered metadata describing the body text. By convention, headlines starting with '@' specify node types. Leo scripts give node types their meaning. Leo's run-unit-tests-locally command converts @test nodes into actual test cases.
  3. Leo directives specify properties of a node and its descendants. Directives may be inherited or overridden in descendant nodes. Leo generates scripts from outlines when running the execute-script command, and in other similar situations. Generating a script is much like macro expansion. The @others directive tells where to place unnamed child nodes. Section references (like <<section name>>) tell where to place named child nodes.