Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions reference/twig_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -567,14 +567,18 @@ file_excerpt

.. code-block:: twig

{{ file|file_excerpt(line = null) }}
{{ file|file_excerpt(line, srcContext = 3) }}

``file``
**type**: ``string``
``line`` *(optional)*
``line``
**type**: ``integer``
``srcContext`` *(optional)*
**type**: ``integer``

Generates an excerpt of seven lines around the given ``line``.
Generates an excerpt of a code file around the given ``line`` number. The
``srcContext`` argument defines the total number of lines to display around the
given line number (use ``-1`` to display the whole file).

format_file
~~~~~~~~~~~
Expand Down Expand Up @@ -611,12 +615,14 @@ file_link

.. code-block:: twig

{{ file|file_link(line = null) }}
{{ file|file_link(line) }}

``line`` *(optional)*
``file``
**type**: ``string``
``line``
**type**: ``integer``

Generates a link to the provided file (and optionally line number) using
Generates a link to the provided file and line number using
a preconfigured scheme.

.. _reference-twig-tags:
Expand Down