Appendix 1 to Chapter 4:

Using @rawfile and @silentfile Trees

An @rawfile tree is a tree whose root headline starts with @rawfile filename. Similarly, an @silentfile tree is a tree whose root headline starts with @silentfile filename.

Leo creates derived files from @rawfile and @silentfile trees by writing the body text of all nodes of the tree in outline order. Leo writes the body text as is, without recognizing section definitions, without expanding section references, and without treating directives specially in any way. In particular, Leo copies all directives, including @space or @c directives, to the derived file as text. Exception: Leo recognizes the @ignore directive in @rawfile or @silentfile nodes, so you may use the @ignore directive as usual to prevent Leo from writing @rawfile and @silentfile trees.

There are several difference between @rawfile and @silentfile trees:

  1. Leo writes no sentinel lines when writing @silentfile trees. When writing @rawfile trees, Leo writes only the @+leo, @-leo, @+node, @-node, @+body and @-body sentinels. Therefore, Leo can update @rawfile trees, but not @silentfile trees, from changes made in derived files. Unlike @file and @rawfile trees, the primary source of information for an @silentfile tree is the outline containing it.
  2. Within @silentfile trees only, if a headline starts with @@, Leo writes everything in the headline following the @@ to the derived file just before the corresponding body text.
  3. Files derived from @silentfile trees contain nothing not contained in body text (or @@ headlines). In particular, if body text does not end in a newline, the first line from the next node will concatenated to the last line of the preceding node.