87c257f0d4765d43497e0e6febbe399198cc8712
[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 \verbatim
185 LAYOUT_FILE = DoxygenLayout.xml
186 \endverbatim
187 To change the layout all you need to do is edit the layout file.
188
189 The toplevel structure of the file looks as follows:
190 \verbatim
191 <doxygenlayout version="1.0">
192   <navindex>
193     ...
194   </navindex>
195   <class>
196     ...
197   </class>
198   <namespace>
199     ...
200   </namespace>
201   <concept>
202     ...
203   </concept>
204   <file>
205     ...
206   </file>
207   <group>
208     ...
209   </group>
210   <directory>
211     ...
212   </directory>
213 </doxygenlayout>
214 \endverbatim
215
216 The root element of the XML file is \c doxygenlayout, it has an attribute named
217 \c version, which will be used in the future to cope with changes that are
218 not backward compatible.
219
220 The first section, identified by the \c navindex element, represents the
221 layout of the navigation tabs displayed at the top of each HTML page. At the
222 same time it also controls the items in the navigation tree in case
223 \ref cfg_generate_treeview "GENERATE_TREEVIEW" is enabled.
224 Each tab is represented by a \c tab element in the XML file.
225
226 You can hide tabs by setting the \c visible attribute to \c no.
227 You can also override the default title of a tab by specifying it as
228 the value of the \c title attribute. If the title field is the empty string
229 (the default) then doxygen will fill in an appropriate language specific title.
230
231 You can reorder the tabs by moving the tab elements in the XML file
232 within the \c navindex element and even change the tree structure.
233 Do not change the value of the \c type attribute however.
234 Only a fixed set of types are supported, each representing a link to a
235 specific index.
236
237 You can also add custom tabs using a type with name "user". Here is an
238 example that shows how to add a tab with title "Google" pointing to
239 www.google.com:
240
241 \verbatim
242   <navindex>
243     ...
244     <tab type="user" url="http://www.google.com" title="Google"/>
245     ...
246   </navindex>
247 \endverbatim
248
249 The url field can also be a relative URL. If the URL starts with \@ref
250 the link will point to a documented entities, such as a class, a function,
251 a group, or a related page. Suppose we have defined a page using \@page with
252 label mypage, then a tab with label "My Page" to this page would look
253 as follows:
254
255 \verbatim
256   <navindex>
257     ...
258     <tab type="user" url="@ref mypage" title="My Page"/>
259     ...
260   </navindex>
261 \endverbatim
262
263 You can also group tabs together in a custom group using a tab with
264 type "usergroup". The following example puts the above tabs in a user
265 defined group with title "My Group":
266
267 \verbatim
268   <navindex>
269     ...
270     <tab type="usergroup" title="My Group">
271       <tab type="user" url="http://www.google.com" title="Google"/>
272       <tab type="user" url="@ref mypage" title="My Page"/>
273     </tab>
274     ...
275   </navindex>
276 \endverbatim
277
278 Groups can be nested to form a hierarchy.
279
280 By default a usergroup entry in the navigation tree is a link to
281 a landing page with the contents of the group. You can link to a
282 different page using the `url` attribute just like you can for the
283 `<tab>` element and prevent any link using `url="[none]"`, i.e.
284
285 \verbatim
286    <tab type="usergroup" title="Group without link" url="[none]">
287    ...
288    </tab>
289 \endverbatim
290
291 The elements after \c navindex represent the layout of the different
292 pages generated by doxygen:
293 - The \c class element represents the layout of all pages generated for
294   documented classes, structs, unions, and interfaces.
295 - The \c namespace element represents the layout of all pages generated for
296   documented namespaces (and also Java packages).
297 - The \c concept element represents the layout of all pages generated for
298   documented concepts.
299 - The \c file element represents the layout of all pages generated for
300   documented files.
301 - The \c group element represents the layout of all pages generated for
302   documented groups (or modules).
303 - The \c directory element represents the layout of all pages generated for
304   documented directories.
305
306 Each XML element within one of the above page elements represents a certain
307 piece of information. Some pieces can appear in each type of page,
308 others are specific for a certain type of page.
309 Doxygen will list the pieces in the order in which they appear
310 in the XML file.
311
312 The following generic elements are possible for each page:
313 <dl>
314 <dt>\c briefdescription
315   <dd>Represents the brief description on a page.
316 <dt>\c detaileddescription
317   <dd>Represents the detailed description on a page.
318 <dt>\c authorsection
319   <dd>Represents the author section of a page (only used for man pages). This is
320       a separate section for man pages with a text like:
321       `Generated automatically by Doxygen for My Project from the source code.`
322       This should not be misinterpreted with the doxygen commands \ref cmdauthor
323       "\\author" or \ref cmdauthors "\\authors" that generate an author paragraph
324       inside a detailed description.
325 </dl>
326 The following generic elements are possible for each page except the concept page:
327 <dl>
328 <dt>\c memberdecl
329   <dd>Represents the quick overview of members on a page (member declarations).
330       This elements has child elements per type of member list.
331       The possible child elements are not listed in detail in the document,
332       but the name of the element should be a good indication of the type
333       of members that the element represents.
334 <dt>\c memberdef
335   <dd>Represents the detailed member list on a page (member definition).
336       Like the \c memberdecl element, also this element has a number of
337       possible child elements.
338 </dl>
339
340 The class page has the following specific elements:
341 <dl>
342 <dt>\c includes
343   <dd>Represents the include file needed to obtain the definition for
344       this class.
345 <dt>\c inheritancegraph
346   <dd>Represents the inheritance relations for a class.
347       Note that the \ref cfg_class_graph "CLASS_GRAPH" option determines
348       if the inheritance relation is a list of base and derived classes or
349       a graph.
350 <dt>\c collaborationgraph
351   <dd>Represents the collaboration graph for a class.
352 <dt>\c allmemberslink
353   <dd>Represents the link to the list of all members for a class.
354 <dt>\c usedfiles
355   <dd>Represents the list of files from which documentation for the class was
356       extracted.
357 </dl>
358
359 The concept page has the following specific elements:
360 <dl>
361 <dt>\c includes
362   <dd>Represents the include file needed to obtain the definition for
363       this class.
364 <dt>\c definition
365   <dd>Represents the definition of the concept
366 </dl>
367
368 The file page has the following specific elements:
369 <dl>
370 <dt>\c includes
371   <dd>Represents the list of \#include statements contained in this file.
372 <dt>\c includegraph
373   <dd>Represents the include dependency graph for the file.
374 <dt>\c includedbygraph
375   <dd>Represents the included by dependency graph for the file.
376 <dt>\c sourcelink
377   <dd>Represents the link to the source code of this file.
378 </dl>
379
380 The group page has a specific \c groupgraph element which represents the
381 graph showing the dependencies between groups.
382
383 Similarly, the directory page has a specific \c directorygraph element
384 which represents the graph showing the dependencies between the directories
385 based on the \#include relations of the files inside the directories.
386
387 Some elements have a \c visible attribute which can be
388 used to hide the fragment from the generated output, by setting the attribute's
389 value to "no". You can also use the value of a configuration option to
390 determine the visibility, by using
391 its name prefixed with a dollar sign, e.g.
392 \verbatim
393   ...
394   <includes visible="$SHOW_INCLUDE_FILES"/>
395   ...
396 \endverbatim
397 This was mainly added for backward compatibility.
398 Note that the \c visible attribute is just a hint for doxygen.
399 If no relevant information is available for a certain piece it is
400 omitted even if it is set to \c yes (i.e. no empty sections are generated).
401
402 Some elements have a \c title attribute. This attribute can be used
403 to customize the title doxygen will use as a header for the piece.
404
405 @warning at the moment you should not remove elements from the layout file
406 as a way to hide information. Doing so can cause broken links in the
407 generated output!
408
409
410 \section xmlgenerator Using the XML output
411
412 If the above two methods still do not provide enough flexibility, you
413 can also use the XML output produced by doxygen as a basis to
414 generate the output you like. To do this set
415 \ref cfg_generate_xml "GENERATE_XML" to \c YES.
416
417 The XML output consists of an index file named \c index.xml which
418 lists all items extracted by doxygen with references to the other XML files
419 for details. The structure of the index is described by a schema file
420 \c index.xsd. All other XML files are described by the schema file
421 named \c compound.xsd. If you prefer one big XML file
422 you can combine the index and the other files using the
423 XSLT file \c combine.xslt.
424
425 You can use any XML parser to parse the files or use the one that can be found
426 in the \c addon/doxmlparser directory of doxygen's source distribution.
427 Look at \c addon/doxmlparser/doxmlparser/index.py and
428 \c addon/doxmlparser/doxmlparser/compound.py for the interface of the
429 parser (it is generated by <a href="https://www.davekuhlman.org/generateDS.html">generatedDS</a>
430 and follows the XML schema files \c index.xsd and \c compound.xsd found in
431 \c templates/xml). Look in \c addon/doxmlparser/examples for examples.
432
433 The advantage of using the doxmlparser is that it
434 allows you to only read the index file into memory and then only those XML
435 files that you implicitly load via navigating through the index. As a
436 result this works even for very large projects where reading all XML
437 files as one big DOM tree would not fit into memory.
438
439 See <a href="https://github.com/michaeljones/breathe">the Breathe project</a> for
440 an example that uses doxygen XML output from Python to bridge it with the
441 <a href="http://www.sphinx-doc.org/en/stable/">Sphinx</a> document generator.
442
443 \htmlonly
444 Go to the <a href="custcmd.html">next</a> section or return to the
445  <a href="index.html">index</a>.
446 \endhtmlonly
447
448  */