Skip to content

Update twig_reference.rst #7939

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
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