1 @title Diviner User Guide
4 Using Diviner, a documentation generator.
9 Diviner is an application for creating technical documentation.
11 This article is maintained in a text file in the Phabricator repository and
12 generated into the display document you are currently reading using Diviner.
14 Beyond generating articles, Diviner can also analyze source code and generate
15 documentation about classes, methods, and other primitives.
18 Generating Documentation
19 ========================
21 To generate documentation, run:
23 phabricator/ $ ./bin/diviner generate --book <book>
29 Diviner documentation books are configured using JSON `.book` files, which
35 "title" : "Example Documentation",
36 "short" : "Example Docs",
38 "uri.source" : "http://example.com/diffusion/X/browse/master/%f$%l",
40 "(\\.diviner$)" : "DivinerArticleAtomizer"
49 "name" : "Doing Stuff"
52 "name" : "Undoing Stuff"
57 The properties in this file are:
59 - `name`: Required. Short, unique name to identify the documentation book.
60 This will be used in URIs, so it should not have special characters. Good
61 names are things like `"example"` or `"libcabin"`.
62 - `root`: Required. The root directory (relative to the `.book` file) which
63 documentation should be generated from. Often this will be a value like
64 `"../../"`, to specify the project root (for example, if the `.book` file
65 is in `project/src/docs/example.book`, the value `"../../"` would generate
66 documentation from the `project/` directory.
67 - `title`: Optional. Full human-readable title of the documentation book. This
68 is used when there's plenty of display space and should completely describe
69 the book. Good titles are things like `"Example Documentation"`, or
70 `"libcabin Developer Documentation"`.
71 - `short`: Optional. Shorter version of the title for use when display space
72 is limited (for example, in navigation breadcrumbs). If omitted, the full
73 title is used. Good short titles are things like `"Example Docs"` or
74 `"libcabin Dev Docs"`.
75 - `uri.source`: Optional. Diviner can link from the documentation to a
76 repository browser so that you can quickly jump to the definition of a class
77 or function. To do this, it uses a URI pattern which you specify here.
78 Normally, this URI should point at a repository browser like Diffusion.
79 For example, `"http://repobrowser.yourcompany.com/%f#%l"`. You can use these
80 conversions in the URI, which will be replaced at runtime:
81 - `%f`: Replaced with the name of the file.
82 - `%l`: Replaced with the line number.
83 - `%%`: Replaced with a literal `%` symbol.
84 - `rules`: Optional. A map of regular expressions to Atomizer classes which
85 controls which documentation generator runs on each file. If omitted,
86 Diviner will use its default ruleset. For example, adding the key
87 `"(\\.diviner$)"` to the map with value `"DivinerArticleAtomizer"` tells
88 Diviner to analyze any file with a name ending in `.diviner` using the
90 - `exclude`: Optional. A list of regular expressions matching paths which
91 will be excluded from documentation generation for this book. For example,
92 adding a pattern like `"(^externals/)"` or `"(^vendor/)"` will make Diviner
93 ignore those directories.
94 - `groups`: Optional. Describes top level organizational groups which atoms
95 should be placed into.