Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / docs / user / userguide / diviner.diviner
blob01484be14c9b4a2595003023839433670be9cd71
1 @title Diviner User Guide
2 @group userguide
4 Using Diviner, a documentation generator.
6 Overview
7 ========
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>
26 Diviner ".book" Files
27 =====================
29 Diviner documentation books are configured using JSON `.book` files, which
30 look like this:
32   name=example.book
33   {
34     "name" : "example",
35     "title" : "Example Documentation",
36     "short" : "Example Docs",
37     "root" : ".",
38     "uri.source" : "http://example.com/diffusion/X/browse/master/%f$%l",
39     "rules" : {
40       "(\\.diviner$)" : "DivinerArticleAtomizer"
41     },
42     "exclude" : [
43       "(^externals/)",
44       "(^scripts/)",
45       "(^support/)"
46     ],
47     "groups" : {
48       "forward" : {
49         "name" : "Doing Stuff"
50       },
51       "reverse" : {
52         "name" : "Undoing Stuff"
53       }
54     }
55   }
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
89     "article" atomizer.
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.