11Documentation Format
22====================
33
4- The Symfony2 documentation uses `reStructuredText `_ as its markup language and
5- `Sphinx `_ for building the output (HTML, PDF, ...).
4+ The Symfony documentation uses `reStructuredText `_ as its markup language and
5+ `Sphinx `_ for generating the documentation in the formats read by the end users,
6+ such as HTML and PDF.
67
78reStructuredText
89----------------
910
10- reStructuredText *"is an easy-to-read, what-you-see-is-what-you-get plaintext
11- markup syntax and parser system" *.
11+ reStructuredText is a plaintext markup syntax similar to Markdown, but much
12+ stricter with its syntax. If you are new to reStructuredText, take some time to
13+ familiarize with this format by reading the existing `Symfony documentation `_
1214
13- You can learn more about its syntax by reading existing Symfony2 ` documents `_
14- or by reading the `reStructuredText Primer `_ on the Sphinx website .
15+ If you prefer to learn more about this format, check out the ` reStructuredText Primer `_
16+ tutorial and the `reStructuredText Reference `_ .
1517
1618.. caution ::
1719
@@ -24,14 +26,14 @@ or by reading the `reStructuredText Primer`_ on the Sphinx website.
2426Sphinx
2527------
2628
27- Sphinx is a build system that adds some nice tools to create documentation
28- from reStructuredText documents. As such, it adds new directives and
29- interpreted text roles to the standard reST ` markup `_.
29+ Sphinx is a build system that provides tools to create documentation from
30+ reStructuredText documents. As such, it adds new directives and interpreted text
31+ roles to the standard reST markup. Read more about the ` Sphinx Markup Constructs `_.
3032
3133Syntax Highlighting
3234~~~~~~~~~~~~~~~~~~~
3335
34- All code examples uses PHP as the default highlighted language . You can change
36+ PHP is the default syntax highlight applied to all code blocks . You can change
3537it with the ``code-block `` directive:
3638
3739.. code-block :: rst
@@ -41,7 +43,7 @@ it with the ``code-block`` directive:
4143 { foo: bar, bar: { foo: bar, bar: baz } }
4244
4345 If your PHP code begins with ``<?php ``, then you need to use ``html+php `` as
44- the highlighted pseudo-language :
46+ the name of the highlighted syntax :
4547
4648.. code-block :: rst
4749
@@ -51,16 +53,18 @@ the highlighted pseudo-language:
5153
5254 .. note ::
5355
54- A list of supported languages is available on the `Pygments website `_.
56+ Besides all of the major programming languages, the syntax highlighter
57+ supports all kinds of markup and configuration languages. Check out the
58+ list of `supported languages `_ on the syntax highlighter website.
5559
5660.. _docs-configuration-blocks :
5761
5862Configuration Blocks
5963~~~~~~~~~~~~~~~~~~~~
6064
61- Whenever you show a configuration, you must use the ``configuration-block ``
65+ Whenever you include a configuration sample, use the ``configuration-block ``
6266directive to show the configuration in all supported configuration formats
63- (``PHP ``, ``YAML ``, and ``XML ``)
67+ (``PHP ``, ``YAML ``, and ``XML ``). Example:
6468
6569.. code-block :: rst
6670
@@ -96,32 +100,32 @@ The previous reST snippet renders as follow:
96100
97101 The current list of supported formats are the following:
98102
99- =============== ==============
100- Markup format Displayed
101- =============== ==============
102- html HTML
103- xml XML
104- php PHP
105- yaml YAML
106- jinja Twig
107- html+jinja Twig
108- html+php PHP
109- ini INI
110- php-annotations Annotations
111- php-standalone Standalone Use
112- php-symfony Framework Use
113- =============== ==============
103+ =================== ======================== ==============
104+ Markup format Use it to display
105+ =================== ======================== ==============
106+ `` html `` HTML
107+ `` xml `` XML
108+ `` php `` PHP
109+ `` yaml `` YAML
110+ `` jinja `` Pure Twig markup
111+ `` html+jinja `` Twig markup blended with HTML
112+ `` html+php `` PHP code blended with HTML
113+ `` ini `` INI
114+ `` php-annotations `` PHP Annotations
115+ `` php-standalone `` Pure PHP code
116+ `` php-symfony `` PHP code with special Symfony features
117+ =================== ======================== ==============
114118
115119Adding Links
116120~~~~~~~~~~~~
117121
118- To add links to other pages in the documents use the following syntax:
122+ ** Internal links** to other documentation pages use the following syntax:
119123
120124.. code-block :: rst
121125
122126 :doc:`/path/to/page`
123127
124- Using the path and filename of the page without the extension, for example:
128+ The page name should not include the file extension (`` .rst ``). For example:
125129
126130.. code-block :: rst
127131
@@ -131,14 +135,15 @@ Using the path and filename of the page without the extension, for example:
131135
132136 :doc:`/cookbook/configuration/environments`
133137
134- The link text will be the main heading of the document linked to. You can
135- also specify alternative text for the link :
138+ The title of the linked page will be automaticall used as the text of the link.
139+ If you want to modify that title, use this alternative syntax :
136140
137141.. code-block :: rst
138142
139143 :doc:`Spooling Email </cookbook/email/spool>`
140144
141- You can also add links to the API documentation:
145+ **Links to the API ** follow a different syntax, where you must specify the type
146+ of linked resource (``namespace ``, ``class `` or ``method ``):
142147
143148.. code-block :: rst
144149
@@ -148,7 +153,7 @@ You can also add links to the API documentation:
148153
149154 :method:`Symfony\\Component\\HttpKernel\\Bundle\\Bundle::build`
150155
151- and to the PHP documentation:
156+ ** Links to the PHP documentation** follow a pretty similar syntax :
152157
153158.. code-block :: rst
154159
@@ -158,20 +163,55 @@ and to the PHP documentation:
158163
159164 :phpfunction:`iterator_to_array`
160165
166+ New Features or Behavior Changes
167+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
168+
169+ If you're documenting a brand new feature or a change that's been made in
170+ Symfony2, you should precede your description of the change with a
171+ ``.. versionadded:: 2.X `` directive and a short description:
172+
173+ .. code-block :: text
174+
175+ .. versionadded:: 2.3
176+ The ``askHiddenResponse`` method was introduced in Symfony 2.3.
177+
178+ You can also ask a question and hide the response. This is particularly...
179+
180+ If you're documenting a behavior change, it may be helpful to *briefly * describe
181+ how the behavior has changed.
182+
183+ .. code-block :: text
184+
185+ .. versionadded:: 2.3
186+ The ``include()`` function is a new Twig feature that's available in
187+ Symfony 2.3. Prior, the ``{% include %}`` tag was used.
188+
189+ Whenever a new minor version of Symfony2 is released (e.g. 2.4, 2.5, etc),
190+ a new branch of the documentation is created from the ``master `` branch.
191+ At this point, all the ``versionadded `` tags for Symfony2 versions that have
192+ reached end-of-life will be removed. For example, if Symfony 2.5 were released
193+ today, and 2.2 had recently reached its end-of-life, the 2.2 ``versionadded ``
194+ tags would be removed from the new 2.5 branch.
195+
161196Testing Documentation
162197~~~~~~~~~~~~~~~~~~~~~
163198
164- To test documentation before a commit:
199+ When submitting a new content to the documentation repository or when changing
200+ any existing resource, an automatic process will check if your documentation is
201+ free of syntax errors and is ready to be reviewed.
202+
203+ Nevertheless, if you prefer to do this check locally on your own machine before
204+ submitting your documentation, follow these steps:
165205
166206* Install `Sphinx `_;
167- * Install the Sphinx extensions using git submodules: ``git submodule update --init ``;
168- * (Optionally) Install the bundle docs and CMF docs: ``bash install.sh ``;
169- * Run ``make html `` and view the generated HTML in the ``build `` directory.
170-
171- .. _ reStructuredText : http://docutils.sourceforge.net/rst.html
172- .. _ Sphinx : http://sphinx-doc.org/
173- .. _ documents : https://github.com/symfony/symfony-docs
174- .. _ reStructuredText Primer : http://sphinx-doc.org/rest.html
175- .. _ markup : http://sphinx-doc.org/markup/
176- .. _ Pygments website : http://pygments .org/languages /
177- .. _ Sphinx quick setup : http://sphinx-doc .org/tutorial.html#setting-up-the-documentation-sources
207+ * Install the Sphinx extensions using git submodules: ``$ git submodule update --init ``;
208+ * (Optionally) Install the bundle docs and CMF docs: ``$ bash install.sh ``;
209+ * Run ``make html `` and view the generated HTML in the ``build/ `` directory.
210+
211+ .. _ `reStructuredText` : http://docutils.sourceforge.net/rst.html
212+ .. _ `Sphinx` : http://sphinx-doc.org/
213+ .. _ `Symfony documentation` : https://github.com/symfony/symfony-docs
214+ .. _ `reStructuredText Primer` : http://sphinx-doc.org/rest.html
215+ .. _ `reStructuredText Reference` : http://docutils.sourceforge.net/docs/user/rst/quickref.html
216+ .. _ `Sphinx Markup Constructs` : http://sphinx-doc .org/markup /
217+ .. _ `supported languages` : http://pygments .org/languages/
0 commit comments