0023962: Moving OCCT documentation to sources
[occt.git] / dox / dev_guides / documentation / documentation.md
CommitLineData
72b7576f 1 Documentation {#dev_guides__documentation}
2=================
3
4@section OCCT_DM_SECTION_1 Introduction
5
6This document provides practical guidenes for generation and editing of OCCT user documentation.
7
8@section OCCT_DM_SECTION_2 Prerequisites
9
10<b>Tcl/Tk</b>
11The lates version: http://www.tcl.tk/software/tcltk/download.html
12
13<b>Doxygen</b> ( >= 1.8.4 )
14The latest version: http://www.stack.nl/~dimitri/doxygen/download.html
15
16<b>MathJax</b> (used for rendering math formulas in browser). Download it for local installation or use the MathJax Content Delivery Network. \(read
17@htmlonly <a href="#OCCT_DM_SECTION_A_9">Formulas</a> @endhtmlonly paragraph for more detailed description\).
18The latest version: http://www.mathjax.org/download/
19
20<b>MiKTeX</b> or equivalent tool (used for PDF document creation)
21Latest version: http://miktex.org/download
22
23@section OCCT_DM_SECTION_2_1 Documentation Generation
24
25Run gendoc.bat from OCCT directory to generate all articles are defined in FILES.txt:
26
27gendoc.bat options:
28
29 * -html : To generate HTML files (cannot be used with -pdf);
30 * -pdf : To generate PDF files (cannot be used with -html);
31 * -m=<modules_list> : Specifies list of articles to generate. If it is not specified, all files, mentioned in FILES.txt are processed;
32 * -l=<document_name> : Specifies the article caption for a single document;
33 * -h : Prints help message;
34 * -v : Specifies the Verbose mode (info on all script actions is shown).
35
36If you run the command without arguments (like example above) it will generate HTML documentation
37for all articles are defined into FILES.txt.
38
39**Note**: the generation process generates PDF files for each article,
40but in html case it generates common Html page with references to the ones.
41
42For generation of specific article you need:
43 * have it's name with relative path (from \%OCCDIR\%/dox/ to the file) contained in FILES.txt
44 (is located into \%OCCDIR\%/dox/ directory).
45
46@verbatim
47devs_guid/documentation/documentation.md
48@endverbatim
49
50where documentation .md is name of article and devs_guid/documentation/ is relative path of it
51
52 * use this name with -m option in the generation process:
53
54@verbatim
55% gen.bat -html -m=devs_guid/documentation/documentation.md
56@endverbatim
57
58Multiple files are separated with comma:
59
60@verbatim
61% gen.bat -html -m=MD_FILE_1,MD_FILE_2
62@endverbatim
63
64To sepcify a article name with -l option, use tcl list to prevent whitespaces incorrect interpretation:
65
66@verbatim
67% gen.bat -pdf -m=MD_FILE_1 -l=[list MD File 1 Label]
68@endverbatim
69
70@section OCCT_DM_SECTION_3 Documentation Conventions
71
72This section contains information about conventions in the field of OCCT documentation file format,
73structure of documentation directories, etc.
74
75@subsection OCCT_DM_SECTION_3_1 File Format
76
77It is proposed to use MarkDown file format for easy maintainance of generic text documents.
78The MarkDown files have a "*.md" extension and are based on rules desribed in
79@htmlonly <a href="#OCCT_DM_SECTION_A">Document Syntax</a> @endhtmlonly section.
80
81@subsection OCCT_DM_SECTION_3_2 Directory Structure
82
83![](/devs_guide/documentation/images/documentation_image001.png)
84
85Every separate article has own folder if images are used in it. These images
86are stored into "images" subfolder.
87
88If you want to use the same image for several articles, you can place the one into "dox/resources" folder.
89
90**Note**: Every article can use any image that is used by others articles. To avoid incorrect image
91displaying, use relative path to the image (starting from dox folder). For instance
92@verbatim
93![](/devs_guide/snv/images/snv_image001.svg)
94@endverbatim
95
96Result of generation of the documentation is:
97
98%OCCT_DIR% / doc - a folder for generated articles;
99 * html/ - a directory for generated HTML pages;
100 * pdf/ - a directory for generated PDF files.
101
102@section OCCT_DM_SECTION_4 Adding a New Article
103
104 - Place a new article into folder that is chosen taking into account the place of the article
105at the hierarchy of the documentation. For instance the article about "using SVN working with OCCT
106source code" (svn.md - the file of the article) might be placed into /dox/devs_guide/ . If the article has images then you may create
107the own folder of the article and subfolder in it for images. For instance
108*/dox/devs_guide/svn/ - for svn.md file
109*/dox/devs_guide/svn/images/ - for images
110
111 - Update dox/FILES.txt to add relative path to svn.md. For instance
112@verbatim
113devs_guide/snv/svn.md
114@endverbatim
115
116**Note**: the place of the relative path to an article is connected with the place
117into treeview of html version.
118
119
120Note, that you should specify a file tag, not the document name.
121See <a href="#OCCT_DM_SECTION_A_1">Header section</a> for details.
122
123@section OCCT_DOC_SECTION_5 Additional Resources
124
125More information about OCCT can be found at http://www.opencascade.org
126
127The information on formula syntax can be found at:
128http://en.wikipedia.org/wiki/Help:Displaying_a_formula
129
130More information on MarkDown and Doxygen syntax can be found at:
131http://www.stack.nl/~dimitri/doxygen/manual
132
133
134@section OCCT_DM_SECTION_A Appendix 1: Document Syntax
135
136Each OCCT document file in *.md format has a simple structure.
137It can contain:
138
139| Content type | Obligation |
140| :---------------- | :-------------------: |
141| Header | M |
142| Footer | M |
143| Plain text | O |
144| List | O |
145| Table | O |
146| Code | O |
147| Formula | O |
148| Image | O |
149| Page numbers | M (auto generation) |
150| Table of contents | M (auto generation) |
151
152The legend:
153
154 * M is for Mandatory
155 * O is for Optional
156
157@subsection OCCT_DM_SECTION_A_1 Text Caption (a header)
158
159headings of different levels can be specified with the following code:
160
161@verbatim
162Header 1 {#header1}
163=======
164@endverbatim
165
166 to get
167
168 Header 1
169=========
170
171 and with the following code:
172
173@verbatim
174Header 2 {#header2}
175--------
176@endverbatim
177
178to get
179
180Header 2
181---------
182
183Where a word in curly braces is a MarkDown-style reference, which can be used in table of contents.
184If you would like to have the table of contents, it is recommended to use \@section,
185\@subsection and \@subsubsection pages instead of MarkDown headers as follows:
186
187@verbatim
188 @section Section_Name Section Header
189 @subsection SubSection_Name SubSection Header
190 @subsubsection SubSubSection_Name SubSubSection Header
191@endverbatim
192
193@subsection OCCT_DM_SECTION_A_2 Plain Text
194
195Plain text is a text in a notepad-like format. To insert special symbols,
196like \< , \> or \\, prepend them with \\ character: \\\<, \\\>, \\\\
197To emphasize some words, write one pair of asterisks ( * ) or underscores ( _ ) across the word
198to make it *italic* and two pairs of these symbols to make a word **Bold**.
199
200@subsection OCCT_DM_SECTION_A_3 Lists
201
202To create a bulleted list, start each line with a hyphen or an asterisk,
203followed by a space. List items can be nested. This code:
204
205@verbatim
206 * Bullet 1
207 * Bullet 2
208 * Bullet 2a
209 * Bullet 2b
210 * Bullet 3
211@endverbatim
212
213 produces this list:
214
215 * Bullet 1
216 * Bullet 2
217 * Bullet 2a
218 * Bullet 2b
219 * Bullet 3
220
221To create a numbered list, start each line with number and a period, then a space. Thus this code
222
223@verbatim
224 1. ListItem_1
225 2. ListItem_2
226 3. ListItem_3
227@endverbatim
228
229 produces this list:
230
231 1. ListItem_1
232 2. ListItem_2
233 3. ListItem_3
234
235It is recommended to indent lists with 2 spaces.
236
237@subsection OCCT_DM_SECTION_A_4 Tables
238
239A table consists of a header line, a separator line, and at least one row line.
240Table columns are separated by the pipe (|) character. The following example:
241
242@verbatim
243First Header | Second Header
244------------- | -------------
245Content Cell | Content Cell
246Content Cell | Content Cell
247@endverbatim
248
249 will produce the following table:
250
251First Header | Second Header
252------------ | -------------
253Content Cell | Content Cell
254Content Cell | Content Cell
255
256Column alignment can be controlled via one or two colons at the header separator line:
257
258@verbatim
259| Right | Center | Left |
260| ----: | :----: | :---- |
261| 10 | 10 | 10 |
262| 1000 | 1000 | 1000 |
263@endverbatim
264
265which will looks as follows:
266
267| Right | Center | Left |
268| ----: | :----: | :---- |
269| 10 | 10 | 10 |
270| 1000 | 1000 | 1000 |
271
272@subsection OCCT_DM_SECTION_A_5 Code Blocks
273
274It is recommended to indent a code lines with 4 spaces.
275A fenced code block does not require indentation, and is defined by a pair of "fence lines".
276Such line consists of 3 or more tilde (~) characters on a line.
277The end of the block should have the same number of tildes. Here is an example:
278
279~~~~~~~~~~~~~~~~~~~~~~~
280 a one-line code block
281~~~~~~~~~~~~~~~~~~~~~~~
282
283By default the output is the same as for a normal code block.
284To highlight the code, the developer has to indicate the typical file extension,
285which corresponds to the programming language, after the opening fence.
286For highlighting according to the C++ language, for instance, write the following code (the curly braces and dot are optional):
287
288@verbatim
289~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
290 int func(int a,int b) { return a*b; }
291~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
292@endverbatim
293
294which will produce:
295~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
296 int func(int a,int b) { return a*b; }
297~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
298
299Verbatim content can be written by using framing \@verbatim \@endverbatim . For instance
300
301@verbatim
302 verbatim text
303@endverbatim
304
305@subsection OCCT_DM_SECTION_A_6 References
306
307To insert a reference to a website, it is proposed to write a URL. For example: http://en.wikipedia.org
308To insert a reference to another part of the same document, the developer can write:
309
310@verbatim
311 @htmlonly
312 <a href="#OCCT_DOC_SECTION_5">Doxygen Configuration file</a>
313 @endhtmlonly
314@endverbatim
315
316to get a link to paragraph : @htmlonly <a href="#OCCT_DOC_SECTION_5">Doxygen configuration</a> @endhtmlonly
317
318@subsection OCCT_DM_SECTION_A_7 Images
319
320To insert image into document the developer can write the following code(in Doxygen-style):
321@verbatim
322![alt-caption](relative/path/to/image/image001.svg "Image Caption")
323@endverbatim
324
325This code tells Doxygen to insert a picture right in the place this code was written. Like this:
326@verbatim
327![](/resources/occt_logo.png "OCCT logo")
328@endverbatim
329
330![](/resources/occt_logo.png "OCCT logo")
331
332@subsection OCCT_DM_SECTION_A_8 Table Of Contents
333
334To get the table of contents at the beginning of the document, write \@tableofcontents tag.
335But it is not needed now because TreeView option for HTML is used.
336The TOC in the PDF document will be generated automatically.
337
338@subsection OCCT_DM_SECTION_A_9 Formulas
339
340Formulas within documents will be generated using MathJax tool.
341
342A developer has to specify these parameters in Doxyfile to enable support of MathJax in Doxygen:
343
344 USE_MATHJAX = YES
345 MATHJAX_FORMAT = HTML-CSS
346 MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
347 MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
348
349To use MathJax tool with the HTML page, it's \<head\> block has to contain
350
351~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.html}
352 <script type="text/x-mathjax-config">
353 MathJax.Hub.Config({
354 tex2jax: {inlineMath: [["$","$"],["\\(","\\)"]]},
355 displayAlign: "left"
356 });
357 </script>
358
359 <script type="text/javascript"
360 src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
361 </script>
362~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
363
364First script configures MathJax to understand separator types and to left allign formulas.
365The second script inserts reference to MathJax tool.
366This tool will always be used when the HTML output will be shown.
367
368Equations can be written by several ways:
369
3701.Unnumbered displayed formulas that are centered on a separate line.
371These formulas should be put between \@f\[ and \@f\] tags. An example:
372
373@verbatim
374@f$[
375 |I_2|=\left| \int_{0}^T \psi(t)
376 \left\{
377 u(a,t)-
378 \int_{\gamma(t)}^a
379 \frac{d\theta}{k(\theta,t)}
380 \int_{a}^\theta c(\xi)u_t(\xi,t)\,d\xi
381 \right\} dt
382 \right|
383@f$]
384@endverbatim
385
386gives the following result:
387
388 @f$
389 |I_2|=\left| \int_{0}^T \psi(t)
390 \left\{
391 u(a,t)-
392 \int_{\gamma(t)}^a
393 \frac{d\theta}{k(\theta,t)}
394 \int_{a}^\theta c(\xi)u_t(\xi,t)\,d\xi
395 \right\} dt
396 \right|
397 @f$
398
3992.Formulas can also be put between @verbatim \begin{align} @endverbatim and @verbatim \end{align} @endverbatim tags. An example:
400
401@verbatim
402 \begin{align}
403 \dot{x} & = \sigma(y-x) \\
404 \dot{y} & = \rho x - y - xz \\
405 \dot{z} & = -\beta z + xy
406 \end{align}
407@endverbatim
408
409 gives the following result:
410@latexonly
411 \begin{align}
412 \dot{x} & = \sigma(y-x) \\
413 \dot{y} & = \rho x - y - xz \\
414 \dot{z} & = -\beta z + xy
415 \end{align}
416@endlatexonly
417
418@htmlonly
419 \begin{align}
420 \dot{x} & = \sigma(y-x) \\
421 \dot{y} & = \rho x - y - xz \\
422 \dot{z} & = -\beta z + xy
423 \end{align}
424@endhtmlonly
425
4263.Inline formulas can be specified using this syntax:
427
428@verbatim
429 @f$ \sqrt{3x-1}+(1+x)^2 @f$
430@endverbatim
431
432 that leads to the following result: @f$ \sqrt{3x-1}+(1+x)^2 @f$
433
434@section OCCT_DM_SECTION_B Appendix 2: Doxygen Configuration
435
436@subsection OCCT_DM_SECTION_B_1 Doxygen Configuration File
437
438To generate documentation from "source" *.md files a developer can use file OCCT.doxyfile,
439which is located in /docs directory of OCCT (more information can be found at @htmlonly
440<a href="#OCCT_DM_SECTION_X_X_X">Directory Structure</a> @endhtmlonly paragraph)
441or create his own configuration file, called "Doxyfile". The configuration file may look as follows:
442
443@verbatim
444 DOXYFILE_ENCODING = UTF-8
445 PROJECT_NAME = "OCCT User's Guides"
446 PROJECT_NUMBER = 1.0.1
447 PROJECT_LOGO = "D:/OS/OCCT/docs/OCCT_logo.png"
448 OUTPUT_LANGUAGE = English
449 TAB_SIZE = 4
450 MARKDOWN_SUPPORT = YES
451 AUTOLINK_SUPPORT = NO
452 SHOW_FILES = NO
453 WARNINGS = YES
454 WARN_IF_UNDOCUMENTED = YES
455 WARN_IF_DOC_ERROR = YES
456 WARN_NO_PARAMDOC = NO
457 WARN_FORMAT = "$file:$line: $text"
458 INPUT = "D:/OS/OCCT/docs/"
459 INPUT_ENCODING = UTF-8
460 FILE_PATTERNS = *.md
461 RECURSIVE = YES
462 IMAGE_PATH = tmp
463 GENERATE_HTML = YES
464 SEARCHENGINE = NO
465 HTML_OUTPUT = html
466 HTML_FILE_EXTENSION = .html
467 HTML_HEADER = "static/header.html"
468 HTML_FOOTER = "static/footer.html"
469 HTML_STYLESHEET = "static/general.css"
470 HTML_EXTRA_STYLESHEET = "static/styles.css"
471 HTML_COLORSTYLE_HUE = 220
472 HTML_COLORSTYLE_SAT = 100
473 HTML_COLORSTYLE_GAMMA = 80
474 HTML_TIMESTAMP = YES
475 HTML_DYNAMIC_SECTIONS = NO
476 HTML_INDEX_NUM_ENTRIES = 100
477 GENERATE_LATEX = YES
478 GENERATE_RTF = YES
479@endverbatim
480
481@subsection OCCT_DM_SECTION_B_2 Doxygen Output Customization
482
483The customization of the output files, produced by Doxygen, can be made by using different Doxyfile parameters,
484like HTML_COLORSTYLE_SAT, which specifies one of HSV color component of HTML page header, and also by using DoxygenLayout xml file.
485A developer can use default file from /docs directory or generate his own with doxygen -l command. It may looks as follows:
486
487~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.xml}
488<doxygenlayout version="1.0">
489 <!-- Generated by doxygen 1.8.3.1 -->
490 <!-- Navigation index tabs for HTML output -->
491 <navindex>
492 <tab type="mainpage" visible="yes" title="Introduction"/>
493 <tab type="pages" visible="yes" title="Documents" intro=
494 "This section contains links to all OCCT documents that are available at the moment"/>
495 <tab type="modules" visible="no" title="" intro=""/>
496 <tab type="namespaces" visible="no" title="">
497 <tab type="namespacelist" visible="no" title="" intro=""/>
498 <tab type="namespacemembers" visible="no" title="" intro=""/>
499 </tab>
500 <tab type="classes" visible="no" title="">
501 <tab type="classlist" visible="no" title="" intro=""/>
502 <tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/>
503 <tab type="hierarchy" visible="no" title="" intro=""/>
504 <tab type="classmembers" visible="no" title="" intro=""/>
505 </tab>
506 <tab type="files" visible="yes" title="Files">
507 <tab type="filelist" visible="yes" title="" intro=""/>
508 <tab type="globals" visible="yes" title="" intro=""/>
509 </tab>
510 <tab type="examples" visible="no" title="" intro=""/>
511 </navindex>
512 ...
513</doxygenlayout>
514~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
515
516The tag \<tab\> specifies tabs which appear at the head of each html page. For the OCCT user documentation
517 "mainpage" and "pages" tabs are usually needed and their visible parameter should always be "yes".
518The visibility of other tabs should be set to "no".
519
520Developers can find more information about Doxygen configuration in the help file
521or at http://www.stack.nl/~dimitri/doxygen/manual/
522
523@subsection OCCT_DM_SECTION_B_3 Doxywizard Usage
524
525The easiest way of applying and modification of Doxyfile is to use a Doxywizard application,
526which is usually a part of the Doxygen tool. To apply a configuration file, the developer should
527select "Open..." item of the File menu or press Ctrl + O. Modification of Doxyfile can be made
528using "Wizard" or "Expert" tabs of Doxywizard application.
529
530Developers can find more information about Doxywizard usage in the help file or at
531http://www.stack.nl/~dimitri/doxygen/manual/doxywizard_usage.html.