3396c4b0af3e3aa1ffd6b52f728d16bc151c593d
[platform/upstream/doxygen.git] / doc / customize.doc
1 /******************************************************************************
2  *
3  *
4  *
5  * Copyright (C) 1997-2015 by Dimitri van Heesch.
6  *
7  * Permission to use, copy, modify, and distribute this software and its
8  * documentation under the terms of the GNU General Public License is hereby
9  * granted. No representations are made about the suitability of this software
10  * for any purpose. It is provided "as is" without express or implied warranty.
11  * See the GNU General Public License for more details.
12  *
13  * Documents produced by Doxygen are derivative works derived from the
14  * input used in their production; they are not affected by this license.
15  *
16  */
17 /*! \page customize Customizing the output
18
19 \tableofcontents{html,latex}
20
21 Doxygen provides various levels of customization.
22 The section \ref minor_tweaks "Minor Tweaks" discusses what to
23 do if you want to do minor tweaking to the look and feel of the output.
24 The section \ref layout "Layout" show how to reorder and hide certain
25 information on a page.
26 The section \ref xmlgenerator "XML output" show how to generate
27 whatever output you want based on the XML output produced by doxygen.
28
29 \section minor_tweaks Minor Tweaks
30
31 The next subsections describe some aspects that can be tweaked with
32 little effort.
33
34 \subsection minor_tweaks_colors Overall Color
35
36 To change the overall color of the HTML output doxygen provides three options
37 - \ref cfg_html_colorstyle_hue "HTML_COLORSTYLE_HUE"
38 - \ref cfg_html_colorstyle_sat "HTML_COLORSTYLE_SAT"
39 - \ref cfg_html_colorstyle_gamma "HTML_COLORSTYLE_GAMMA"
40
41 to change the hue, saturation, and gamma correction of the colors respectively.
42
43 For your convenience the GUI frontend \ref doxywizard_usage "Doxywizard"
44 has a control that allows you to see the effect of changing the values of these options
45 on the output in real time.
46
47 \subsection minor_tweaks_treeview Navigation
48
49 By default doxygen shows navigation tabs on top of every HTML page,
50 corresponding with the following settings:
51
52 - \ref cfg_disable_index "DISABLE_INDEX" = \c NO
53 - \ref cfg_generate_treeview "GENERATE_TREEVIEW" = \c NO
54
55 \image html layout_index_and_notreeview.png
56 \image latex layout_index_and_notreeview.png width=8cm
57
58 you can switch to an interactive navigation tree as sidebar using
59
60 - \ref cfg_disable_index "DISABLE_INDEX" = \c YES
61 - \ref cfg_generate_treeview "GENERATE_TREEVIEW" = \c YES
62 - \ref cfg_generate_treeview "FULL_SIDEBAR" = \c NO
63
64 \image html layout_noindex_and_treeview.png
65 \image latex layout_noindex_and_treeview.png width=8cm
66
67 you can also make the content span the title area of the screen using
68
69 - \ref cfg_disable_index "DISABLE_INDEX" = \c YES
70 - \ref cfg_generate_treeview "GENERATE_TREEVIEW" = \c YES
71 - \ref cfg_generate_treeview "FULL_SIDEBAR" = \c YES
72
73 \image html layout_noindex_and_sidebar.png
74 \image latex layout_noindex_and_sidebar.png width=8cm
75
76 or even have both forms of navigation:
77
78 - \ref cfg_disable_index "DISABLE_INDEX" = \c NO
79 - \ref cfg_generate_treeview "GENERATE_TREEVIEW" = \c YES
80
81 \image html layout_index_and_treeview.png
82 \image latex layout_index_and_treeview.png width=8cm
83
84 if you already use an external index (i.e. have one of the following
85 options enabled
86 \ref cfg_generate_htmlhelp "GENERATE_HTMLHELP",
87 \ref cfg_generate_eclipsehelp "GENERATE_ECLIPSEHELP",
88 \ref cfg_generate_qhp "GENERATE_QHP", or
89 \ref cfg_generate_docset "GENERATE_DOCSET")
90 then you can also disable all indices, like so:
91
92 - \ref cfg_disable_index "DISABLE_INDEX" = \c YES
93 - \ref cfg_generate_treeview "GENERATE_TREEVIEW" = \c NO
94
95 \image html layout_noindex_and_notreeview.png
96 \image latex layout_noindex_and_notreeview.png width=8cm
97
98 \subsection minor_tweaks_dynsection Dynamic Content
99
100 To make the HTML output more interactive, doxygen provides a number of options
101 that are disabled by default:
102 - enabling \ref cfg_html_dynamic_sections "HTML_DYNAMIC_SECTIONS" will make
103   doxygen hide certain content (like graphs) in the HTML by default,
104   and let the reader expand these sections on request.
105 - enabling \ref cfg_have_dot "HAVE_DOT" along
106   with \ref cfg_interactive_svg "INTERACTIVE_SVG" while setting
107   \ref cfg_dot_image_format "DOT_IMAGE_FORMAT" to \c svg, will make doxygen
108   produce SVG images that will allow the user to zoom and pan (this only
109   happens when the size of the images exceeds a certain size).
110
111 \subsection minor_tweaks_header_css Header, Footer, and Stylesheet changes
112
113 To tweak things like fonts or colors, margins, or other look \& feel
114 aspects of the HTML output in detail, you can create a different
115 <a href="https://www.w3schools.com/css/default.asp">cascading style sheet</a>.
116 You can also let doxygen use a custom header and footer for each HTML
117 page it generates, for instance to make the output conform to the style
118 used on the rest of your web site.
119
120 To do this first run doxygen as follows:
121 \verbatim
122 doxygen -w html header.html footer.html customdoxygen.css
123 \endverbatim
124
125 This will create 3 files:
126 - header.html is a HTML fragment which doxygen normally uses to start
127   a HTML page. Note that the fragment ends with a body tag and that is
128   contains a couple of commands of the form \$word. These will be replaced
129   by doxygen on the fly.
130 - footer.html is a HTML fragment which doxygen normally uses to end
131   a HTML page. Also here special commands can be used. This file contain the
132   link to www.doxygen.org and the body and html end tags.
133 - customdoxygen.css is the default cascading style sheet
134   used by doxygen. It is recommended only to look into this file and overrule
135   some settings you like by putting them in a separate stylesheets and
136   referencing those extra files
137   via \ref cfg_html_extra_stylesheet "HTML_EXTRA_STYLESHEET".
138
139 You should edit these files and then reference them from the configuration file.
140 - \ref cfg_html_header "HTML_HEADER" = \c header.html
141 - \ref cfg_html_footer "HTML_FOOTER" = \c footer.html
142 - \ref cfg_html_extra_stylesheet "HTML_EXTRA_STYLESHEET" = \c my_customdoxygen.css
143
144 \note it is not longer recommended to use \ref cfg_html_stylesheet "HTML_STYLESHEET",
145 as it make it difficult to upgrade to a newer version of doxygen. Use
146 \ref cfg_html_extra_stylesheet "HTML_EXTRA_STYLESHEET" instead.
147
148 See the documentation of the \ref cfg_html_header "HTML_HEADER" tag
149 for more information about the possible meta commands you can use inside
150 your custom header.
151
152 \note You should not put the style sheet in the HTML output directory. Treat
153 it as a source file. Doxygen will copy it for you.
154
155 \note If you use images or other external content in a custom header you
156 need to make sure these end up in the HTML output directory yourself,
157 for instance by writing a script that runs doxygen can then copies the
158 images to the output.
159
160 \warning The structure of headers and footers may change after upgrading to
161 a newer version of doxygen, so if you are using a custom header or footer,
162 it might not produce valid output anymore after upgrading.
163
164 \section layout Changing the layout of pages
165
166 In some cases you may want to change the way the output is structured.
167 A different style sheet or custom headers and footers do not help in such
168 case.
169
170 The solution doxygen provides is a layout file, which you can
171 modify and doxygen will use to control what information is presented,
172 in which order, and to some extent also how information is presented.
173 The layout file is an XML file.
174
175 The default layout can be generated
176 by doxygen using the following command:
177 \verbatim
178 doxygen -l
179 \endverbatim
180 optionally the name of the layout file can be specified, if omitted
181 \c DoxygenLayout.xml will be used.
182
183 The next step is to mention the layout file in the configuration file
184 (see also \ref cfg_layout_file "LAYOUT_FILE")
185 \verbatim
186 LAYOUT_FILE = DoxygenLayout.xml
187 \endverbatim
188 To change the layout all you need to do is edit the layout file.
189
190 The toplevel structure of the file looks as follows:
191 \verbatim
192 <doxygenlayout version="1.0">
193   <navindex>
194     ...
195   </navindex>
196   <class>
197     ...
198   </class>
199   <namespace>
200     ...
201   </namespace>
202   <concept>
203     ...
204   </concept>
205   <file>
206     ...
207   </file>
208   <group>
209     ...
210   </group>
211   <directory>
212     ...
213   </directory>
214 </doxygenlayout>
215 \endverbatim
216
217 The root element of the XML file is \c doxygenlayout, it has an attribute named
218 \c version, which will be used in the future to cope with changes that are
219 not backward compatible.
220
221 The first section, identified by the \c navindex element, represents the
222 layout of the navigation tabs displayed at the top of each HTML page. At the
223 same time it also controls the items in the navigation tree in case
224 \ref cfg_generate_treeview "GENERATE_TREEVIEW" is enabled.
225 Each tab is represented by a \c tab element in the XML file.
226
227 You can hide tabs by setting the \c visible attribute to \c no.
228 You can also override the default title of a tab by specifying it as
229 the value of the \c title attribute. If the title field is the empty string
230 (the default) then doxygen will fill in an appropriate language specific title.
231
232 You can reorder the tabs by moving the tab elements in the XML file
233 within the \c navindex element and even change the tree structure.
234 Do not change the value of the \c type attribute however.
235 Only a fixed set of types are supported, each representing a link to a
236 specific index.
237
238 You can also add custom tabs using a type with name "user". Here is an
239 example that shows how to add a tab with title "Google" pointing to
240 www.google.com:
241
242 \verbatim
243   <navindex>
244     ...
245     <tab type="user" url="http://www.google.com" title="Google"/>
246     ...
247   </navindex>
248 \endverbatim
249
250 The url field can also be a relative URL. If the URL starts with \@ref
251 the link will point to a documented entities, such as a class, a function,
252 a group, or a related page. Suppose we have defined a page using \@page with
253 label mypage, then a tab with label "My Page" to this page would look
254 as follows:
255
256 \verbatim
257   <navindex>
258     ...
259     <tab type="user" url="@ref mypage" title="My Page"/>
260     ...
261   </navindex>
262 \endverbatim
263
264 You can also group tabs together in a custom group using a tab with
265 type "usergroup". The following example puts the above tabs in a user
266 defined group with title "My Group":
267
268 \verbatim
269   <navindex>
270     ...
271     <tab type="usergroup" title="My Group">
272       <tab type="user" url="http://www.google.com" title="Google"/>
273       <tab type="user" url="@ref mypage" title="My Page"/>
274     </tab>
275     ...
276   </navindex>
277 \endverbatim
278
279 Groups can be nested to form a hierarchy.
280
281 By default a usergroup entry in the navigation tree is a link to
282 a landing page with the contents of the group. You can link to a
283 different page using the `url` attribute just like you can for the
284 `<tab>` element and prevent any link using `url="[none]"`, i.e.
285
286 \verbatim
287    <tab type="usergroup" title="Group without link" url="[none]">
288    ...
289    </tab>
290 \endverbatim
291
292 The elements after \c navindex represent the layout of the different
293 pages generated by doxygen:
294 - The \c class element represents the layout of all pages generated for
295   documented classes, structs, unions, and interfaces.
296 - The \c namespace element represents the layout of all pages generated for
297   documented namespaces (and also Java packages).
298 - The \c concept element represents the layout of all pages generated for
299   documented concepts.
300 - The \c file element represents the layout of all pages generated for
301   documented files.
302 - The \c group element represents the layout of all pages generated for
303   documented groups (or modules).
304 - The \c directory element represents the layout of all pages generated for
305   documented directories.
306
307 Each XML element within one of the above page elements represents a certain
308 piece of information. Some pieces can appear in each type of page,
309 others are specific for a certain type of page.
310 Doxygen will list the pieces in the order in which they appear
311 in the XML file.
312
313 The following generic elements are possible for each page:
314 <dl>
315 <dt>\c briefdescription
316   <dd>Represents the brief description on a page.
317 <dt>\c detaileddescription
318   <dd>Represents the detailed description on a page.
319 <dt>\c authorsection
320   <dd>Represents the author section of a page (only used for man pages). This is
321       a separate section for man pages with a text like:
322       `Generated automatically by Doxygen for My Project from the source code.`
323       This should not be misinterpreted with the doxygen commands \ref cmdauthor
324       "\\author" or \ref cmdauthors "\\authors" that generate an author paragraph
325       inside a detailed description.
326 </dl>
327 The following generic elements are possible for each page except the concept page:
328 <dl>
329 <dt>\c memberdecl
330   <dd>Represents the quick overview of members on a page (member declarations).
331       This elements has child elements per type of member list.
332       The possible child elements are not listed in detail in the document,
333       but the name of the element should be a good indication of the type
334       of members that the element represents.
335 <dt>\c memberdef
336   <dd>Represents the detailed member list on a page (member definition).
337       Like the \c memberdecl element, also this element has a number of
338       possible child elements.
339 </dl>
340
341 The class page has the following specific elements:
342 <dl>
343 <dt>\c includes
344   <dd>Represents the include file needed to obtain the definition for
345       this class.
346 <dt>\c inheritancegraph
347   <dd>Represents the inheritance relations for a class.
348       Note that the \ref cfg_class_graph "CLASS_GRAPH" option determines
349       if the inheritance relation is a list of base and derived classes or
350       a graph.
351 <dt>\c collaborationgraph
352   <dd>Represents the collaboration graph for a class.
353 <dt>\c allmemberslink
354   <dd>Represents the link to the list of all members for a class.
355 <dt>\c usedfiles
356   <dd>Represents the list of files from which documentation for the class was
357       extracted.
358 </dl>
359
360 The concept page has the following specific elements:
361 <dl>
362 <dt>\c includes
363   <dd>Represents the include file needed to obtain the definition for
364       this class.
365 <dt>\c definition
366   <dd>Represents the definition of the concept
367 </dl>
368
369 The file page has the following specific elements:
370 <dl>
371 <dt>\c includes
372   <dd>Represents the list of \#include statements contained in this file.
373 <dt>\c includegraph
374   <dd>Represents the include dependency graph for the file.
375 <dt>\c includedbygraph
376   <dd>Represents the included by dependency graph for the file.
377 <dt>\c sourcelink
378   <dd>Represents the link to the source code of this file.
379 </dl>
380
381 The group page has a specific \c groupgraph element which represents the
382 graph showing the dependencies between groups.
383
384 Similarly, the directory page has a specific \c directorygraph element
385 which represents the graph showing the dependencies between the directories
386 based on the \#include relations of the files inside the directories.
387
388 Some elements have a \c visible attribute which can be
389 used to hide the fragment from the generated output, by setting the attribute's
390 value to "no". You can also use the value of a configuration option to
391 determine the visibility, by using
392 its name prefixed with a dollar sign, e.g.
393 \verbatim
394   ...
395   <includes visible="$SHOW_INCLUDE_FILES"/>
396   ...
397 \endverbatim
398 This was mainly added for backward compatibility.
399 Note that the \c visible attribute is just a hint for doxygen.
400 If no relevant information is available for a certain piece it is
401 omitted even if it is set to \c yes (i.e. no empty sections are generated).<br>
402 Not all elements have a \c visible attribute shown in the layout file, though
403 this attribute can be used anyway (the default is `visible="yes"`).
404
405 Some elements have a \c title attribute. This attribute can be used
406 to customize the title doxygen will use as a header for the piece.
407
408
409 \section xmlgenerator Using the XML output
410
411 If the above two methods still do not provide enough flexibility, you
412 can also use the XML output produced by doxygen as a basis to
413 generate the output you like. To do this set
414 \ref cfg_generate_xml "GENERATE_XML" to \c YES.
415
416 The XML output consists of an index file named \c index.xml which
417 lists all items extracted by doxygen with references to the other XML files
418 for details. The structure of the index is described by a schema file
419 \c index.xsd. All other XML files are described by the schema file
420 named \c compound.xsd. If you prefer one big XML file
421 you can combine the index and the other files using the
422 XSLT file \c combine.xslt.
423
424 You can use any XML parser to parse the files or use the one that can be found
425 in the \c addon/doxmlparser directory of doxygen's source distribution.
426 Look at \c addon/doxmlparser/doxmlparser/index.py and
427 \c addon/doxmlparser/doxmlparser/compound.py for the interface of the
428 parser (it is generated by <a href="https://www.davekuhlman.org/generateDS.html">generatedDS</a>
429 and follows the XML schema files \c index.xsd and \c compound.xsd found in
430 \c templates/xml). Look in \c addon/doxmlparser/examples for examples.
431
432 The advantage of using the doxmlparser is that it
433 allows you to only read the index file into memory and then only those XML
434 files that you implicitly load via navigating through the index. As a
435 result this works even for very large projects where reading all XML
436 files as one big DOM tree would not fit into memory.
437
438 See <a href="https://github.com/breathe-doc/breathe">the Breathe project</a> for
439 an example that uses doxygen XML output from Python to bridge it with the
440 <a href="http://www.sphinx-doc.org/en/stable/">Sphinx</a> document generator.
441
442 \htmlonly
443 Go to the <a href="custcmd.html">next</a> section or return to the
444  <a href="index.html">index</a>.
445 \endhtmlonly
446
447  */