xref: /Universal-ctags/docs/README.md (revision 755aeae52b7a5e79b2f3ccde0d5e82a66b23d072)
1ae6c053bSMasatake YAMATO# Universal Ctags Documentation #
220ea5985SFrank Fesevur
349e9311eSHiroo HAYASHIGo to https://docs.ctags.io to read formatted version of this documentation.
4caf224afSMasatake YAMATO
5e37d287eSHiroo HAYASHI## reStructuredText (Docutils and Sphinx) ##
6caf224afSMasatake YAMATO
7e37d287eSHiroo HAYASHI* [Docutils](https://docutils.sourceforge.io/docs/index.html) is used to format
8e37d287eSHiroo HAYASHI`man/*.rst.in` for man pages. Only reStructuredText syntaxes described
9e37d287eSHiroo HAYASHI[here](https://docutils.sourceforge.io/rst.html) can be used for the man pages.
10e37d287eSHiroo HAYASHI
11e37d287eSHiroo HAYASHI* [Sphinx Python Documentation Generator](https://www.sphinx-doc.org/en/master/index.html) is used to format `docs/*.rst`.
1249e9311eSHiroo HAYASHISee [here](https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html) for more details of reStructuredText extended by Sphinx.
1344ebcbd0SK.Takata
1444ebcbd0SK.Takata## Rules for writing documents ##
1544ebcbd0SK.Takata
16e37d287eSHiroo HAYASHISee also [Writing Documents](https://docs.ctags.io/en/latest/contributions.html#writing-documents).
1776676929SHiroo HAYASHI
18e37d287eSHiroo HAYASHI### reStructuredText Markup Rules
1976676929SHiroo HAYASHI
20e37d287eSHiroo HAYASHI* put two grave accents around a single-word option, an option usage like
21e37d287eSHiroo HAYASHI  `--langdef=MyLang`, a file path, and so on, as "``` ``--foo`` ```".  For a
22e37d287eSHiroo HAYASHI  single character, add single quotes around it as "``` '``-``' ```".
2376676929SHiroo HAYASHI
24e37d287eSHiroo HAYASHI* put two grave accents and double quotes around a multi-word option and an
25e37d287eSHiroo HAYASHI  example of a command line, as  " ``` "``-f file_name``" ``` " or " ```
26e37d287eSHiroo HAYASHI  "``ctags --help``" ``` ".
2776676929SHiroo HAYASHI
28e37d287eSHiroo HAYASHI* put double quotes around referring a section, e.g. " `` See "Writing
29e37d287eSHiroo HAYASHI  Documents". `` ".
3076676929SHiroo HAYASHI
31e37d287eSHiroo HAYASHI* use one asterisk (emphasis) for a newly-introduced conceptual *word* as
32e37d287eSHiroo HAYASHI  "`*word*`".
3376676929SHiroo HAYASHI
34e37d287eSHiroo HAYASHI* use one asterisk and "`<>`" as "`*<LANG>*`" for an option parameter like
35e37d287eSHiroo HAYASHI  `<LANG>` in `--kind-<LANG>` option.
3676676929SHiroo HAYASHI
37e37d287eSHiroo HAYASHI* To represent a backslash, surround it with double backquote. i.e. "``` ``\`` ```".
3876676929SHiroo HAYASHI  Escaping a backslash with another backslash doesn't work well depending
3976676929SHiroo HAYASHI  on the tools. When converting rst to man, two backslashes are converted
4076676929SHiroo HAYASHI  into one, however when converting to html, four backslashes are converted
4176676929SHiroo HAYASHI  into one.
4276676929SHiroo HAYASHI
4376676929SHiroo HAYASHI### Hyperlinks
4476676929SHiroo HAYASHI
45e37d287eSHiroo HAYASHI* "`` `title`_ ``"  and "`` `string <title>`_ ``" styles are valid only in the same page.
46e37d287eSHiroo HAYASHI  When this is used on `rst2man`, it is shown with underline.
4776676929SHiroo HAYASHI
48e37d287eSHiroo HAYASHI* "`` :ref:`label` ``" and "`` :ref:`string <label>` ``" style can jump across files.
49e37d287eSHiroo HAYASHI  `rst2html` (and sphinx) converts this to a hyperlink.
50e37d287eSHiroo HAYASHI  But this cause error on `rst2man` which is used to format man pages.
51e37d287eSHiroo HAYASHI  Don't use this style in man pages.
5276676929SHiroo HAYASHI
538b80f8f9SHiroo HAYASHI* The titles of man pages (e.g. "``ctags(1)``", "``ctags-optlib(7)``", etc.) in
548b80f8f9SHiroo HAYASHI  ``man/*.[1-9].rst.in`` are replaced to hyperlinks as "`` :ref:`ctags(1)` ``"
558b80f8f9SHiroo HAYASHI  by "``make update-docs``".
568b80f8f9SHiroo HAYASHI
5749e9311eSHiroo HAYASHI### Markers ###
5849e9311eSHiroo HAYASHI
59e37d287eSHiroo HAYASHI- "`NOT REVIEWED YET`" means the section or block is not reviewed yet.
60e37d287eSHiroo HAYASHI- "`IN MAN PAGE`" means the topic is also explained in the man page of ctags.
61e37d287eSHiroo HAYASHI- "`.. TODO: ...`": TODO comments for documents.
62e37d287eSHiroo HAYASHI- "`.. TODO(code): ...`": TODO comments for programming codes.
63*755aeae5SMasatake YAMATO- "`.. TESTCASE: ...`": A test case for the feature documented is at ....
6449e9311eSHiroo HAYASHI
65e37d287eSHiroo HAYASHI##  Generating man pages ###
6649e9311eSHiroo HAYASHI
67e37d287eSHiroo HAYASHIThe files in `docs/man/` directory are generated from the man pages in `man/`
68e37d287eSHiroo HAYASHIdirectory. **Do not edit the files in `docs/man/` directory directly.**
6925d6fad2SHiroo HAYASHI
70648c1a07SHiroo HAYASHIExecute `make` in the top directory to update them. Or
7144ebcbd0SK.Takata
7244ebcbd0SK.Takata```sh
73648c1a07SHiroo HAYASHImake -C man
7444ebcbd0SK.Takata```
7525d6fad2SHiroo HAYASHI
76648c1a07SHiroo HAYASHIwill build the man pages only.
77648c1a07SHiroo HAYASHI
786e1547f1SHiroo HAYASHIDuring this process, hyperlinks to man pages are added as described above, and
79648c1a07SHiroo HAYASHIdelete unnecessary section markups from `docs/man/*.rst`.  See `man/Makefile.am`
806e1547f1SHiroo HAYASHIfor more details.
816e1547f1SHiroo HAYASHI
8249e9311eSHiroo HAYASHITo generate the man pages `rst2man` command is needed.
83e37d287eSHiroo HAYASHI`rst2man` is part of the `python-docutils` package on Ubuntu.
84