]> git.proxmox.com Git - ceph.git/blame - ceph/doc/dev/documenting.rst
update sources to v12.1.2
[ceph.git] / ceph / doc / dev / documenting.rst
CommitLineData
7c673cae
FG
1==================
2 Documenting Ceph
3==================
4
c07f9fc5
FG
5User documentation
6==================
7
8The documentation on docs.ceph.com is generated from the restructuredText
9sources in ``/doc/`` in the Ceph git repository.
10
11Please make sure that your changes are written in a way that is intended
12for end users of the software, unless you are making additions in
13``/doc/dev/``, which is the section for developers.
14
15All pull requests that modify user-facing functionality must
16include corresponding updates to documentation: see
17`Submitting Patches`_ for more detail.
18
19Check your .rst syntax is working as expected by using the "View"
20button in the github user interface when looking at a diff on
21an .rst file, or build the docs locally using the ``admin/build-doc``
22script.
23
24For more information about the Ceph documentation, see
25:doc:`/start/documenting-ceph`.
26
7c673cae
FG
27Code Documentation
28==================
29
30C and C++ can be documented with Doxygen_, using the subset of Doxygen
31markup supported by Breathe_.
32
33.. _Doxygen: http://www.stack.nl/~dimitri/doxygen/
34.. _Breathe: https://github.com/michaeljones/breathe
35
36The general format for function documentation is::
37
38 /**
39 * Short description
40 *
41 * Detailed description when necessary
42 *
43 * preconditons, postconditions, warnings, bugs or other notes
44 *
45 * parameter reference
46 * return value (if non-void)
47 */
48
49This should be in the header where the function is declared, and
50functions should be grouped into logical categories. The `librados C
51API`_ provides a complete example. It is pulled into Sphinx by
52`librados.rst`_, which is rendered at :doc:`/rados/api/librados`.
53
54.. _`librados C API`: https://github.com/ceph/ceph/blob/master/src/include/rados/librados.h
31f18b77 55.. _`librados.rst`: https://github.com/ceph/ceph/raw/master/doc/rados/api/librados.rst
7c673cae
FG
56
57Drawing diagrams
58================
59
60Graphviz
61--------
62
63You can use Graphviz_, as explained in the `Graphviz extension documentation`_.
64
65.. _Graphviz: http://graphviz.org/
66.. _`Graphviz extension documentation`: http://sphinx.pocoo.org/ext/graphviz.html
67
68.. graphviz::
69
70 digraph "example" {
71 foo -> bar;
72 bar -> baz;
c07f9fc5 73 bar -> th
7c673cae
FG
74 }
75
76Most of the time, you'll want to put the actual DOT source in a
77separate file, like this::
78
79 .. graphviz:: myfile.dot
80
81
82Ditaa
83-----
84
85You can use Ditaa_:
86
87.. _Ditaa: http://ditaa.sourceforge.net/
88
89.. ditaa::
90
91 +--------------+ /=----\
92 | hello, world |-->| hi! |
93 +--------------+ \-----/
94
95
96Blockdiag
97---------
98
99If a use arises, we can integrate Blockdiag_. It is a Graphviz-style
100declarative language for drawing things, and includes:
101
102- `block diagrams`_: boxes and arrows (automatic layout, as opposed to
103 Ditaa_)
104- `sequence diagrams`_: timelines and messages between them
105- `activity diagrams`_: subsystems and activities in them
106- `network diagrams`_: hosts, LANs, IP addresses etc (with `Cisco
107 icons`_ if wanted)
108
109.. _Blockdiag: http://blockdiag.com/
110.. _`Cisco icons`: http://pypi.python.org/pypi/blockdiagcontrib-cisco/
111.. _`block diagrams`: http://blockdiag.com/en/blockdiag/
112.. _`sequence diagrams`: http://blockdiag.com/en/seqdiag/index.html
113.. _`activity diagrams`: http://blockdiag.com/en/actdiag/index.html
114.. _`network diagrams`: http://blockdiag.com/en/nwdiag/
115
116
117Inkscape
118--------
119
120You can use Inkscape to generate scalable vector graphics.
121http://inkscape.org for restructedText documents.
122
123If you generate diagrams with Inkscape, you should
124commit both the Scalable Vector Graphics (SVG) file and export a
125Portable Network Graphic (PNG) file. Reference the PNG file.
126
127By committing the SVG file, others will be able to update the
128SVG diagrams using Inkscape.
129
130HTML5 will support SVG inline.
c07f9fc5
FG
131
132.. _Submitting Patches: /SubmittingPatches.rst