mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-11-02 20:30:30 -06:00
Merge branch '2.0'
This commit is contained in:
commit
7ec567b6d0
135 files changed
+5457
-1977
No files matched your search
+8
-1
@@ -334,12 +334,19 @@ into the generated ``.tex`` files. Its ``'sphinxsetup'`` key is described
|
||||
.. versionchanged:: 2.0
|
||||
``'lualatex'`` executes
|
||||
``\defaultfontfeatures[\rmfamily,\sffamily]{}`` to disable TeX
|
||||
ligatures.
|
||||
ligatures transforming `<<` and `>>` as escaping working with
|
||||
``pdflatex/xelatex`` failed with ``lualatex``.
|
||||
.. versionchanged:: 2.0
|
||||
Detection of ``LGR``, ``T2A``, ``X2`` to trigger support of
|
||||
occasional Greek or Cyrillic (``'pdflatex'`` only, as this support
|
||||
is provided natively by ``'platex'`` and only requires suitable
|
||||
font with ``'xelatex'/'lualatex'``).
|
||||
.. versionchanged:: 2.3.0
|
||||
``'xelatex'`` also executes
|
||||
``\defaultfontfeatures[\rmfamily,\sffamily]{}`` in order to avoid
|
||||
contractions of ``--`` into en-dash or transforms of straight quotes
|
||||
into curly ones in PDF (in non-literal text paragraphs) despite
|
||||
:confval:`smartquotes` being set to ``False``.
|
||||
|
||||
``'textgreek'``
|
||||
The default (``'pdflatex'`` only) is
|
||||
|
||||
@@ -453,21 +453,29 @@ __ http://pygments.org/docs/lexers
|
||||
As discussed previously, *language* can be any lexer alias supported by
|
||||
Pygments.
|
||||
|
||||
**Additional options**
|
||||
.. rubric:: options
|
||||
|
||||
Pygments can generate line numbers for code blocks. To enable this, use the
|
||||
``linenothreshold`` option. ::
|
||||
.. rst:directive:option:: linenothreshold: threshold
|
||||
:type: number (optional)
|
||||
|
||||
.. highlight:: python
|
||||
:linenothreshold: 5
|
||||
Enable to generate line numbers for code blocks.
|
||||
|
||||
This will produce line numbers for all code blocks longer than five lines.
|
||||
This option takes an optional number as threshold parameter. If any
|
||||
threshold given, the directive will produce line numbers only for the code
|
||||
blocks longer than N lines. If not given, line numbers will be produced
|
||||
for all of code blocks.
|
||||
|
||||
To ignore minor errors on highlighting, you can specifiy ``:force:`` option.
|
||||
Example::
|
||||
|
||||
.. versionchanged:: 2.1
|
||||
.. highlight:: python
|
||||
:linenothreshold: 5
|
||||
|
||||
``:force:`` option.
|
||||
.. rst:directive:option:: force
|
||||
:type: no value
|
||||
|
||||
If given, minor errors on highlighting are ignored.
|
||||
|
||||
.. versionadded:: 2.1
|
||||
|
||||
.. rst:directive:: .. code-block:: [language]
|
||||
|
||||
@@ -483,72 +491,98 @@ __ http://pygments.org/docs/lexers
|
||||
:rst:dir:`highlight` directive will be used. If not set,
|
||||
:confval:`highlight_language` will be used.
|
||||
|
||||
**Additional options**
|
||||
|
||||
Pygments can generate line numbers for code blocks. To enable this for, use
|
||||
the ``linenos`` flag option. ::
|
||||
|
||||
.. code-block:: ruby
|
||||
:linenos:
|
||||
|
||||
Some more Ruby code.
|
||||
|
||||
The first line number can be selected with the ``lineno-start`` option. If
|
||||
present, ``linenos`` flag is automatically activated::
|
||||
|
||||
.. code-block:: ruby
|
||||
:lineno-start: 10
|
||||
|
||||
Some more Ruby code, with line numbering starting at 10.
|
||||
|
||||
Additionally, an ``emphasize-lines`` option can be given to have Pygments
|
||||
emphasize particular lines::
|
||||
|
||||
.. code-block:: python
|
||||
:emphasize-lines: 3,5
|
||||
|
||||
def some_function():
|
||||
interesting = False
|
||||
print 'This line is highlighted.'
|
||||
print 'This one is not...'
|
||||
print '...but this one is.'
|
||||
|
||||
A ``caption`` option can be given to show that name before the code block.
|
||||
A ``name`` option can be provided implicit target name that can be
|
||||
referenced by using :rst:role:`ref`. For example::
|
||||
|
||||
.. code-block:: python
|
||||
:caption: this.py
|
||||
:name: this-py
|
||||
|
||||
print 'Explicit is better than implicit.'
|
||||
|
||||
A ``dedent`` option can be given to strip indentation characters from the
|
||||
code block. For example::
|
||||
|
||||
.. code-block:: ruby
|
||||
:dedent: 4
|
||||
|
||||
some ruby code
|
||||
|
||||
A ``force`` option can ignore minor errors on highlighting.
|
||||
|
||||
.. versionchanged:: 1.1
|
||||
The ``emphasize-lines`` option has been added.
|
||||
|
||||
.. versionchanged:: 1.3
|
||||
The ``lineno-start``, ``caption``, ``name`` and ``dedent`` options have
|
||||
been added.
|
||||
|
||||
.. versionchanged:: 1.6.6
|
||||
LaTeX supports the ``emphasize-lines`` option.
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
The ``language`` argument becomes optional.
|
||||
|
||||
.. versionchanged:: 2.1
|
||||
.. rubric:: options
|
||||
|
||||
``:force:`` option has been added.
|
||||
.. rst:directive:option:: linenos
|
||||
:type: no value
|
||||
|
||||
Enable to generate line numbers for the code block::
|
||||
|
||||
.. code-block:: ruby
|
||||
:linenos:
|
||||
|
||||
Some more Ruby code.
|
||||
|
||||
.. rst:directive:option:: lineno-start: number
|
||||
:type: number
|
||||
|
||||
Set the first line number of the code block. If present, ``linenos``
|
||||
option is also automatically activated::
|
||||
|
||||
.. code-block:: ruby
|
||||
:lineno-start: 10
|
||||
|
||||
Some more Ruby code, with line numbering starting at 10.
|
||||
|
||||
.. versionadded:: 1.3
|
||||
|
||||
.. rst:directive:option:: emphasized-lines: line numbers
|
||||
:type: comma separated numbers
|
||||
|
||||
Empahsize particular lines of the code block::
|
||||
|
||||
.. code-block:: python
|
||||
:emphasize-lines: 3,5
|
||||
|
||||
def some_function():
|
||||
interesting = False
|
||||
print 'This line is highlighted.'
|
||||
print 'This one is not...'
|
||||
print '...but this one is.'
|
||||
|
||||
.. versionadded:: 1.1
|
||||
.. versionchanged:: 1.6.6
|
||||
LaTeX supports the ``emphasize-lines`` option.
|
||||
|
||||
.. rst:directive:option: force
|
||||
:type: no value
|
||||
|
||||
Ignore minor errors on highlighting
|
||||
|
||||
.. versionchanged:: 2.1
|
||||
|
||||
.. rst:directive:option:: caption: caption of code block
|
||||
:type: text
|
||||
|
||||
Set a caption to the code block.
|
||||
|
||||
.. versionadded:: 1.3
|
||||
|
||||
.. rst:directive:option:: name: a label for hyperlink
|
||||
:type: text
|
||||
|
||||
Define implicit target name that can be referenced by using
|
||||
:rst:role:`ref`. For example::
|
||||
|
||||
.. code-block:: python
|
||||
:caption: this.py
|
||||
:name: this-py
|
||||
|
||||
print 'Explicit is better than implicit.'
|
||||
|
||||
.. versionadded:: 1.3
|
||||
|
||||
.. rst:directive:option:: dedent: number
|
||||
:type: number
|
||||
|
||||
Strip indentation characters from the code block. For example::
|
||||
|
||||
.. code-block:: ruby
|
||||
:dedent: 4
|
||||
|
||||
some ruby code
|
||||
|
||||
.. versionadded:: 1.3
|
||||
|
||||
.. rst:directive:option:: force
|
||||
:type: no value
|
||||
|
||||
If given, minor errors on highlighting are ignored.
|
||||
|
||||
.. versionadded:: 2.1
|
||||
|
||||
.. rst:directive:: .. literalinclude:: filename
|
||||
|
||||
@@ -1017,7 +1051,7 @@ this reason, the following directive exists:
|
||||
cells.
|
||||
|
||||
Sphinx's merged cells interact well with ``p{width}``, ``\X{a}{b}``,
|
||||
``Y{f}`` and tabulary's columns.
|
||||
``\Y{f}`` and tabulary's columns.
|
||||
|
||||
.. note::
|
||||
|
||||
|
||||
@@ -1530,7 +1530,7 @@ These roles are provided to refer to the described objects:
|
||||
The Math Domain
|
||||
---------------
|
||||
|
||||
The math domain (name **math**) provides the following roles::
|
||||
The math domain (name **math**) provides the following roles:
|
||||
|
||||
.. rst:role:: math:numref
|
||||
|
||||
|
||||
Reference in new issue
Block a user