summaryrefslogtreecommitdiff
path: root/doc/markup/code.rst
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2014-01-19 11:04:12 +0100
committerGeorg Brandl <georg@python.org>2014-01-19 11:04:12 +0100
commit2458e5731afbc1eda73548b8b0945fa38c73f517 (patch)
treeaa235cc5ff5232c4db1f153b5c5470151af5ede1 /doc/markup/code.rst
parent883b960cb1c8e2abc6407dd373f57c0b0fef711c (diff)
downloadsphinx-git-2458e5731afbc1eda73548b8b0945fa38c73f517.tar.gz
Add :filename: also for literalinclude. Changelog entry.
Diffstat (limited to 'doc/markup/code.rst')
-rw-r--r--doc/markup/code.rst19
1 files changed, 19 insertions, 0 deletions
diff --git a/doc/markup/code.rst b/doc/markup/code.rst
index 6e707e007..e9f8f1da4 100644
--- a/doc/markup/code.rst
+++ b/doc/markup/code.rst
@@ -188,6 +188,25 @@ Includes
The ``prepend`` and ``append`` options, as well as ``tab-width``.
+Showing a file name
+^^^^^^^^^^^^^^^^^^^
+
+.. versionadded:: 1.3
+
+A ``filename`` option can be given to show that name before the code block. For
+example::
+
+ .. code-block:: python
+ :filename: this.py
+
+ print 'Explicit is better than implicit.'
+
+
+:rst:dir:`literalinclude` also supports the ``filename`` option, with the
+additional feature that if you leave the value empty, the shown filename will be
+exactly the one given as an argument.
+
+
.. rubric:: Footnotes
.. [1] There is a standard ``.. include`` directive, but it raises errors if the