1Introduction 2============ 3 4Jinja is a fast, expressive, extensible templating engine. Special 5placeholders in the template allow writing code similar to Python 6syntax. Then the template is passed data to render the final document. 7 8It includes: 9 10- Template inheritance and inclusion. 11- Define and import macros within templates. 12- HTML templates can use autoescaping to prevent XSS from untrusted 13 user input. 14- A sandboxed environment can safely render untrusted templates. 15- AsyncIO support for generating templates and calling async 16 functions. 17- I18N support with Babel. 18- Templates are compiled to optimized Python code just-in-time and 19 cached, or can be compiled ahead-of-time. 20- Exceptions point to the correct line in templates to make debugging 21 easier. 22- Extensible filters, tests, functions, and even syntax. 23 24Jinja's philosophy is that while application logic belongs in Python if 25possible, it shouldn't make the template designer's job difficult by 26restricting functionality too much. 27 28 29Installation 30------------ 31 32We recommend using the latest version of Python. Jinja supports Python 333.6 and newer. We also recommend using a `virtual environment`_ in order 34to isolate your project dependencies from other projects and the system. 35 36.. _virtual environment: https://packaging.python.org/tutorials/installing-packages/#creating-virtual-environments 37 38Install the most recent Jinja version using pip: 39 40.. code-block:: text 41 42 $ pip install Jinja2 43 44 45Dependencies 46~~~~~~~~~~~~ 47 48These will be installed automatically when installing Jinja. 49 50- `MarkupSafe`_ escapes untrusted input when rendering templates to 51 avoid injection attacks. 52 53.. _MarkupSafe: https://markupsafe.palletsprojects.com/ 54 55 56Optional Dependencies 57~~~~~~~~~~~~~~~~~~~~~ 58 59These distributions will not be installed automatically. 60 61- `Babel`_ provides translation support in templates. 62 63.. _Babel: http://babel.pocoo.org/ 64