0024578: Typos in Developer Guide "Building OCCT from sources"
[occt.git] / dox / dev_guides / documentation / documentation.md
CommitLineData
ba06f8bb 1 Documentation System {#occt_dev_guides__documentation}
e5bd0d98 2======================
3
4@tableofcontents
72b7576f 5
6@section OCCT_DM_SECTION_1 Introduction
7
3d68eaf5 8This document provides practical guidelines for generation and editing of OCCT user documentation.
72b7576f 9
10@section OCCT_DM_SECTION_2 Prerequisites
11
3d68eaf5 12You need to have the following software installed to generate the documentation.
e8181411 13
3d68eaf5 14**Tcl/Tk**
e5bd0d98 15Version 8.5 or 8.6: http://www.tcl.tk/software/tcltk/download.html
72b7576f 16
3d68eaf5 17**Doxygen**
e5bd0d98 18Version 1.8.4 or above: http://www.stack.nl/~dimitri/doxygen/download.html
72b7576f 19
77906c4c 20**Dot**
21Part of Graphviz software, used by Doxygen for generation of class diagrams in Reference Manual: http://www.graphviz.org/Download..php
22
3d68eaf5 23**MiKTeX** or other package providing **pdflatex** command (only needed for generation of PDF documents): http://miktex.org/download
72b7576f 24
3d68eaf5 25**Inkscape** (only needed for generation of PDF documents containing SVG images): http://www.inkscape.org/download
e5bd0d98 26
3d68eaf5 27When generating PDF documentation, **pdflatex** and **inkscape** executables should be accessible by PATH variable.
28You can use *custom.bat* file to add necessary paths to the *PATH* variable.
e5bd0d98 29
3d68eaf5 30Note that in the process of PDF generation MiKTeX may need some packages not installed by default.
31We recommend setting option "Install missing packages on-the-fly" to "Ask me first" (default) during MiKTeX installation:
dba69de2 32
3d68eaf5 33@figure{/dev_guides/documentation/images/documentation_miktex.png}
e8181411 34
3d68eaf5 35On the first run of **pdflatex** it will open a dialog window prompting for installation of missing packages.
36Follow the instructions to proceed (define proxy settings if needed, select a mirror site to download from, etc.).
37
38**MathJax** is used for rendering math formulas in browser (HTML and CHM outputs): http://www.mathjax.org.
39
40By default MathJAX scripts and fonts are taken from http://cdn.mathjax.org/mathjax/latest and no installation of MathJAX is necessary if Internet is accessible.
41If you need to use OCCT documentation while off-line, you can install a local copy of MatJAX, see http://www.mathjax.org/download/.
42See \ref OCCT_DM_SECTION_A_9 for more details on inserting mathematical expressions.
e8181411 43
72b7576f 44@section OCCT_DM_SECTION_2_1 Documentation Generation
45
ba06f8bb 46Run command *gendoc* from command prompt (with OCCT directory as current one) to generate OCCT documentation.
47The synopsis is:
72b7576f 48
ba06f8bb 49 gendoc \[-h\] {-refman|-overview} \[-html|-pdf|-chm\] \[-m=<list of modules>|-ug=<list of docs>\] \[-v\] \[-s=<search_mode>\] \[-mathjax=<path>\]
50
51Here the options are:
72b7576f 52
ba06f8bb 53* Choice of documentation to be generated:
54 * <i>-overview</i>: To generate Overview and User Guides (cannot be used with -refman)
55 * <i>-refman</i>: To generate class Reference Manual (cannot be used with -overview)
72b7576f 56
ba06f8bb 57* Choice of output format:
58 * <i>-html</i>: To generate HTML files (default, cannot be used with -pdf or -chm)
59 * <i>-pdf</i>: To generate PDF files (cannot be used with -refman, -html, or -chm)
60 * <i>-chm</i>: To generate CHM files (cannot be used with -html or -pdf)
61
62* Additional options:
63 * <i>-m=\<modules_list\></i>: List of OCCT modules (separated with comma), for generation of Reference Manual
64 * <i>-ug=\<docs_list\></i>: List of MarkDown documents (separated with comma), to use for generation of Overview / User Guides
65 * <i>-mathjax=\<path\></i>: To use local or alternative copy of MathJax
66 * <i>-s=\<search_mode\></i>: Specifies the Search mode of HTML documents; can be: none | local | server | external
67 * <i>-h</i>: Prints this help message
68 * <i>-v</i>: Enables more verbose output
72b7576f 69
3d68eaf5 70**Note**
72b7576f 71
ba06f8bb 72* In case of PDF output the utility generates a separate PDF file for each document;
73* In case of HTML output the utility generates a common Table of contents containing references to all documents.
74* In case of CHM output single CHM file is generated
75
76**Examples**
72b7576f 77
3d68eaf5 78To generate the output for a specific document specify the path to the corresponding MarkDown file (paths relative to *dox* sub-folder can be given), for instance:
72b7576f 79
3d68eaf5 80~~~~
ba06f8bb 81 > gendoc -overview -ug=dev_guides/documentation/documentation.md
3d68eaf5 82~~~~
72b7576f 83
ba06f8bb 84To generate Reference Manual for the whole Open CASCADE Technology library, run:
3d68eaf5 85~~~~
ba06f8bb 86 > gendoc -refman
3d68eaf5 87~~~~
72b7576f 88
ba06f8bb 89To generate Reference Manual for Foundation Classes and Modeling Data modules only, with search option, run:
3d68eaf5 90~~~~
ba06f8bb 91 > gendoc -refman -m=FoundationClasses,ModelingData,ModelingAlgorithms -s=local
3d68eaf5 92~~~~
72b7576f 93
94@section OCCT_DM_SECTION_3 Documentation Conventions
95
3d68eaf5 96This section contains information about file format conventions, directories structure, etc.
72b7576f 97
98@subsection OCCT_DM_SECTION_3_1 File Format
99
79d580f2 100The format used for documentation is MarkDown with Doxygen extensions.
3d68eaf5 101The MarkDown files have a <i>*.md</i> extension and are based on rules described in \ref OCCT_DM_SECTION_A section.
72b7576f 102
103@subsection OCCT_DM_SECTION_3_2 Directory Structure
104
3d68eaf5 105@figure{/dev_guides/documentation/images/documentation_folders.png}
72b7576f 106
3d68eaf5 107Each document has its own folder if there are any images used in it. These images are stored in *images* subfolder.
108
109If you want to use the same image for several documents, you can place it in *dox/resources* folder.
110
111**Note**: To avoid incorrect image display, use a relative path to the image (starting from *dox* folder). For instance:
72b7576f 112
72b7576f 113
72b7576f 114@verbatim
3d68eaf5 115@figure{/dev_guides/documentation/images/documentation_test_image.svg}
72b7576f 116@endverbatim
117
72b7576f 118
3d68eaf5 119The documentation is generated in subfolder *doc* :
120* *html* - a directory for generated HTML pages;
121* *pdf* - a directory for generated PDF files.
122
123@section OCCT_DM_SECTION_4 Adding a New Document
124
125Place a new document in the folder taking into account its logical position in the documentation hierarchy. For instance, the document *svn.md* about the use of SVN to work with OCCT source code can be placed into <i>/dox/dev_guides/</i>.
72b7576f 126
3d68eaf5 127If there are images in the document, it should be placed in its own folder containing a subfolder for images. For instance:
128* <i> /dox/dev_guides/svn/ </i> - for *svn.md* file;
129* <i> /dox/dev_guides/svn/images/ </i> - for images.
72b7576f 130
3d68eaf5 131Add a relative path to *svn.md* in file <i>dox/FILES.txt</i>. For instance
72b7576f 132
72b7576f 133@verbatim
3d68eaf5 134dev_guides/svn/svn.md
72b7576f 135@endverbatim
136
3d68eaf5 137**Note** that the order of paths to documents in *FILES.txt* is reproduced in the Table of Contents in the HTML output. Please, place them logically.
72b7576f 138
3d68eaf5 139**Note** that you should specify a file tag, not the document name. See <a href="#OCCT_DM_SECTION_A_1">Header section</a> for details.
72b7576f 140
141@section OCCT_DOC_SECTION_5 Additional Resources
142
143More information about OCCT can be found at http://www.opencascade.org
144
145The information on formula syntax can be found at:
146http://en.wikipedia.org/wiki/Help:Displaying_a_formula
147
148More information on MarkDown and Doxygen syntax can be found at:
149http://www.stack.nl/~dimitri/doxygen/manual
e5bd0d98 150
151@section OCCT_DM_SECTION_A Appendix 1: Document Syntax
152
3d68eaf5 153A document file in *.md format must start with a proper header defining a caption and a unique tag.
154
155@verbatim
156Documentation System {#dev_guides__documentation}
157=====================
158@endverbatim
e5bd0d98 159
3d68eaf5 160The document structure is formed by sections that must be defined consistently.
e5bd0d98 161
3d68eaf5 162The document can contain plain text, lists, tables, code snippets, images, math, etc.
163Any specific text elements can be introduced by Markdown language tags or by usual HTML tags.
e5bd0d98 164
3d68eaf5 165The table of contents, page numbers (in PDF), and figure numbers (in PDF) are generated automatically.
e5bd0d98 166
3d68eaf5 167@subsection OCCT_DM_SECTION_A_1 Headers and hierarchic document structure
e5bd0d98 168
3d68eaf5 169Headers of different levels can be specified with the following tags:
170* <i>\@section</i> - for the first-level headers;
171* <i>\@subsection</i> - for the second level headers;
172* <i>\@subsubsection</i> - for the third level headers.
173
174For example:
e5bd0d98 175
176@verbatim
3d68eaf5 177 @section occt_ocaf_1 Basic Concepts
178 @subsection occt_ocaf_1_1 Applications and Documents
179 @subsubsection occt_ocaf_1_1_1 The document and the data framework
e5bd0d98 180@endverbatim
181
3d68eaf5 182Please, note that section names can be used for references within the document and in other documents, so it is necessary to use the common prefix indicative of the document name for all section names in the given document.
183For example, *occt_ocaf* for sections in Open CASCADE Application Framework manual.
e5bd0d98 184
3d68eaf5 185The remaining part of section names in most documents consists only of numbers, for example *1_1*. Actually, the hierarchical structure of the output table of contents is not based on these numbers and is generated automatically.
e5bd0d98 186
3d68eaf5 187The numbers are only indicative of a section location in the body of the document. However, duplicate section names in a document inevitably cause errors during generation.
e5bd0d98 188
3d68eaf5 189If you insert a section in the middle of a big document, do not renumber the document to the end (which is inefficient and error prone), but choose an arbitrary number or letter, not yet used in the document section naming, and base the naming in this section on it.
e5bd0d98 190
3d68eaf5 191The section hierarchy is limited to three levels and further levels cannot be presented in the Table of Contents.
e5bd0d98 192
3d68eaf5 193However, the fourth and fifth level headers can be tagged with <i>####</i> and <i>#####</i> correspondingly.
e5bd0d98 194
3d68eaf5 195It is also possible to use tags <i>##</i> and <i>###</i> for second and third level headers if you do not wish to show them in the table of contents or make references to them.
e5bd0d98 196
197@subsection OCCT_DM_SECTION_A_2 Plain Text
198
3d68eaf5 199A plain text is organized in paragraphs, separated by empty lines in MarkDown source.
200The length of lines is not restricted; it is recommended to put each sentence on a separate line -- this is optimal for easier comparison of different versions of the same document.
201
202To insert special symbols, like \< , \> or \\, prepend them with \\ character: \\\<, \\\>, \\\\, etc.
203To emphasize a word or a group of words, wrap the text with one pair of asterisks (*) or underscores (_) to make it *italic* and two pairs of these symbols to make it **Bold**.
204
205**Note** that if your emphasized text starts or ends with a special symbol, the asterisks may not work. Use explicit HTML tags \<i\>\</i\> and \<b\>\</b\> instead.
206
e5bd0d98 207
208@subsection OCCT_DM_SECTION_A_3 Lists
209
210To create a bulleted list, start each line with a hyphen or an asterisk,
211followed by a space. List items can be nested. This code:
212
213@verbatim
79d580f2 214* Bullet 1
215* Bullet 2
216 - Bullet 2a
217 - Bullet 2b
218* Bullet 3
e5bd0d98 219@endverbatim
220
79d580f2 221produces this list:
e5bd0d98 222
79d580f2 223* Bullet 1
224* Bullet 2
225 * Bullet 2a
226 * Bullet 2b
227* Bullet 3
e5bd0d98 228
79d580f2 229To create a numbered list, start each line with number and a period,
230then a space. Numbered lists can also be nested. Thus this code
e5bd0d98 231
232@verbatim
79d580f2 2331. List item 1
234 1. Sub-item 1
235 2. Sub-item 2
2362. List item 2
3d68eaf5 2374. List item 3
e5bd0d98 238@endverbatim
239
79d580f2 240produces this list:
e5bd0d98 241
79d580f2 2421. List item 1
243 1. Sub-item 1
244 2. Sub-item 2
2452. List item 2
2463. List item 3
e5bd0d98 247
3d68eaf5 248**Note** that numbers of list items in the output are generated so they do not necessarily follow the numbering of source items.
249
250In some cases automatic generation adversely restarts the numbering, i.e. you get list items 1. 1. 1. instead of 1. 2. 3. in the output.
251The use of explicit HTML tags \<ol\>\</ol\> and \<li\>\</li\> can help in this case.
252
79d580f2 253Each list item can contain several paragraphs of text; these paragraphs must
254have the same indentation as text after bullet or number in the numbered list
255item (otherwise numbering will be broken).
256
257Code blocks can be inserted as paragraphs with additional indentation
258(4 spaces more). Note that fenced code blocks do not work within numbered lists
259and their use may cause numeration to be reset.
260
261
3d68eaf5 262Example of a complex nested list:
79d580f2 263
2641. List item 1
265
266 Additional paragraph
267
268 code fragment
269
270 One more paragraph
271
272 1. Sub-item 1
273
274 code fragment for sub-item 1
275
276 2. Sub-item 2
277
278 Paragraph for sub-item 2
279
280 Yet one more paragraph for list item 1
281
2822. List item 2
283
e5bd0d98 284
285@subsection OCCT_DM_SECTION_A_4 Tables
286
287A table consists of a header line, a separator line, and at least one row line.
288Table columns are separated by the pipe (|) character. The following example:
289
290@verbatim
291First Header | Second Header
292------------- | -------------
293Content Cell | Content Cell
294Content Cell | Content Cell
295@endverbatim
296
297 will produce the following table:
298
299First Header | Second Header
300------------ | -------------
301Content Cell | Content Cell
302Content Cell | Content Cell
303
304Column alignment can be controlled via one or two colons at the header separator line:
305
306@verbatim
307| Right | Center | Left |
308| ----: | :----: | :---- |
309| 10 | 10 | 10 |
310| 1000 | 1000 | 1000 |
311@endverbatim
312
313which will looks as follows:
314
315| Right | Center | Left |
316| ----: | :----: | :---- |
317| 10 | 10 | 10 |
318| 1000 | 1000 | 1000 |
319
3d68eaf5 320Note that each table row should be contained in one line of text; complex tables can be created using HTML tags.
79d580f2 321
e5bd0d98 322@subsection OCCT_DM_SECTION_A_5 Code Blocks
323
3d68eaf5 324Paragraphs indented with 4 or more spaces are considered as code fragments and rendered using Courier font.
325Example:
326
327 This line is indented by 4 spaces and rendered as a code block.
328
e5bd0d98 329A fenced code block does not require indentation, and is defined by a pair of "fence lines".
330Such line consists of 3 or more tilde (~) characters on a line.
3d68eaf5 331The end of the block should have the same number of tildes.
332Thus it is strongly advised to use only three or four tildes.
e5bd0d98 333
334By default the output is the same as for a normal code block.
335To highlight the code, the developer has to indicate the typical file extension,
336which corresponds to the programming language, after the opening fence.
337For highlighting according to the C++ language, for instance, write the following code (the curly braces and dot are optional):
338
339@verbatim
3d68eaf5 340~~~{.cpp}
bb27b807 341int func(int a,int b) { return a*b; }
3d68eaf5 342~~~
e5bd0d98 343@endverbatim
344
345which will produce:
3d68eaf5 346~~~{.cpp}
bb27b807 347int func(int a,int b) { return a*b; }
3d68eaf5 348~~~
e5bd0d98 349
3d68eaf5 350Smaller code blocks can be inserted by wrapping with tags <i>\@code</i> and <i>\@endcode</i>.
bb27b807 351
3d68eaf5 352Verbatim content (same as code but without syntax highlighting) can be inserted by wrapping with tags <i>\@verbatim</i> and <i>\@endverbatim</i>.
e5bd0d98 353
354@subsection OCCT_DM_SECTION_A_6 References
355
3d68eaf5 356To insert a reference to a website, it is sufficient to write an URL.
357For example: http://en.wikipedia.org
e5bd0d98 358
3d68eaf5 359To insert a reference to a document or its subsection, use command <i>\@ref</i> followed by the document or section tag name.
360For instance, @code @ref OCCT_DM_SECTION_A @endcode will be rendered as @ref OCCT_DM_SECTION_A.
e5bd0d98 361
3d68eaf5 362Note that links between documents will not work in PDF output if each document is generated independently.
363Hence it is recommended to add a name of the referenced section after the tag name in the <i>\@ref</i> command (in quotes): this will guarantee that the reference is recognizable for the reader even if the cross-link is not instantiated.
364For instance: @code @ref occt_modat_1 "Geometry Utilities" @endcode will be rendered as @ref occt_modat_1 "Geometry Utilities".
e5bd0d98 365
366@subsection OCCT_DM_SECTION_A_7 Images
367
3d68eaf5 368For inserting images into the document use the command <i>\@figure</i>, as follows:
bb27b807 369
bb27b807 370@verbatim
3d68eaf5 371 @figure{/relative/path/to/image/image_file_name.png,"Image caption"}
bb27b807 372@endverbatim
373
3d68eaf5 374The first argument is a path to the image file, relative to the *dox* folder.
375The supported formats for images are PNG, JPG, and SVG.
376The file extension must be lowercase and correspond to the file format.
377The image file name should have no dots except for the one before extension (names with more than one dot confuse **pdflatex**).
378
379The second argument is optional, it defines the caption for the image to be inserted.
380The caption argument, if given, should be quoted, even if it is a single word.
381Captions are included below the image; in PDF output the images with caption are numbered automatically.
382
383Example:
bb27b807 384
e5bd0d98 385@verbatim
3d68eaf5 386 @figure{/dev_guides/documentation/images/documentation_test_image.svg,"Test SVG image"}
e5bd0d98 387@endverbatim
388
3d68eaf5 389is rendered as:
390
391@figure{/dev_guides/documentation/images/documentation_test_image.svg,"Test SVG image"}
392
393We recommend using **Inkscape** for creation and edition of vector graphics.
394The graphics created in MS Word Draw and some other vector editors can be copy-pasted to Inkscape and saved as SVG images.
395
396Note that the image that will be included in documentation is the whole page of the Inkscape document; use option "Resize page to content" in menu **File -> Document properties** of Inkscape to fit page dimensions to the picture (adding margins as necessary).
397
398Note that the *figure* command is an alias to the standard Doxygen command *image* repeated twice: once for HTML and then for Latex output (used for PDF generation). Thus if HTML and PDF outputs should include different images or captions, command "image" can be used:
399
e5bd0d98 400@verbatim
3d68eaf5 401 @image html /relative/path/to/image/occ_logo.png
402 @image latex /relative/path/to/image/occ_logo.png "OCC logo"
e5bd0d98 403@endverbatim
404
3d68eaf5 405@image html /resources/occ_logo.png
406@image latex /resources/occ_logo.png "OCC logo"
e5bd0d98 407
408@subsection OCCT_DM_SECTION_A_8 Table Of Contents
409
3d68eaf5 410Use \@tableofcontents tag to get the table of contents at the beginning of the document.
411
412Actually, it is not strictly necessary now because TreeView option for HTML is used.
e5bd0d98 413The TOC in the PDF document will be generated automatically.
414
415@subsection OCCT_DM_SECTION_A_9 Formulas
416
e8181411 417Formulas within MarkDown documents can be defined using LaTeX syntax.
e5bd0d98 418
419Equations can be written by several ways:
420
4211.Unnumbered displayed formulas that are centered on a separate line.
422These formulas should be put between \@f\[ and \@f\] tags. An example:
423
424@verbatim
dd21889e 425@f[
e5bd0d98 426 |I_2|=\left| \int_{0}^T \psi(t)
427 \left\{
428 u(a,t)-
429 \int_{\gamma(t)}^a
430 \frac{d\theta}{k(\theta,t)}
431 \int_{a}^\theta c(\xi)u_t(\xi,t)\,d\xi
432 \right\} dt
433 \right|
dd21889e 434@f]
e5bd0d98 435@endverbatim
436
437gives the following result:
438
439 @f$
440 |I_2|=\left| \int_{0}^T \psi(t)
441 \left\{
442 u(a,t)-
443 \int_{\gamma(t)}^a
444 \frac{d\theta}{k(\theta,t)}
445 \int_{a}^\theta c(\xi)u_t(\xi,t)\,d\xi
446 \right\} dt
447 \right|
448 @f$
449
3d68eaf5 4502.Formulas can also be put between @verbatim \begin{align} @endverbatim and @verbatim \end{align} @endverbatim tags.
e5bd0d98 451
3d68eaf5 452 For example:
453
e5bd0d98 454@verbatim
455 \begin{align}
456 \dot{x} & = \sigma(y-x) \\
457 \dot{y} & = \rho x - y - xz \\
458 \dot{z} & = -\beta z + xy
459 \end{align}
460@endverbatim
461
462 gives the following result:
463@latexonly
464 \begin{align}
465 \dot{x} & = \sigma(y-x) \\
466 \dot{y} & = \rho x - y - xz \\
467 \dot{z} & = -\beta z + xy
468 \end{align}
469@endlatexonly
470
471@htmlonly
472 \begin{align}
473 \dot{x} & = \sigma(y-x) \\
474 \dot{y} & = \rho x - y - xz \\
475 \dot{z} & = -\beta z + xy
476 \end{align}
477@endhtmlonly
478
4793.Inline formulas can be specified using this syntax:
480
481@verbatim
482 @f$ \sqrt{3x-1}+(1+x)^2 @f$
483@endverbatim
484
485 that leads to the following result: @f$ \sqrt{3x-1}+(1+x)^2 @f$
486