Skip to content
Myr

intro.rst

This file

Path

docs/intro.rst

63 lines · 1.9 KiB

Last changed by

drop end of life python versions (#2096)David Lordbefore adoption49c48a0

History of this file

Take it

1Introduction2============34Jinja is a fast, expressive, extensible templating engine. Special5placeholders in the template allow writing code similar to Python6syntax. Then the template is passed data to render the final document.78It includes:910-   Template inheritance and inclusion.11-   Define and import macros within templates.12-   HTML templates can use autoescaping to prevent XSS from untrusted13    user input.14-   A sandboxed environment can safely render untrusted templates.15-   Async support for generating templates that automatically handle16    sync and async functions without extra syntax.17-   I18N support with Babel.18-   Templates are compiled to optimized Python code just-in-time and19    cached, or can be compiled ahead-of-time.20-   Exceptions point to the correct line in templates to make debugging21    easier.22-   Extensible filters, tests, functions, and even syntax.2324Jinja's philosophy is that while application logic belongs in Python if25possible, it shouldn't make the template designer's job difficult by26restricting functionality too much.272829Installation30------------3132We recommend using the latest version of Python. Jinja supports Python333.10 and newer. We also recommend using a `virtual environment`_ in order34to isolate your project dependencies from other projects and the system.3536.. _virtual environment: https://packaging.python.org/tutorials/installing-packages/#creating-virtual-environments3738Install the most recent Jinja version using pip:3940.. code-block:: text4142    $ pip install Jinja2434445Dependencies46~~~~~~~~~~~~4748These will be installed automatically when installing Jinja.4950-   `MarkupSafe`_ escapes untrusted input when rendering templates to51    avoid injection attacks.5253.. _MarkupSafe: https://markupsafe.palletsprojects.com/545556Optional Dependencies57~~~~~~~~~~~~~~~~~~~~~5859These distributions will not be installed automatically.6061-   `Babel`_ provides translation support in templates.6263.. _Babel: https://babel.pocoo.org/