jinja README

The project's README from github.com/pallets/jinja. As one markdown file: README.md.

Jinja

Jinja is a fast, expressive, extensible templating engine. Special placeholders in the template allow writing code similar to Python syntax. Then the template is passed data to render the final document.

It includes:

Jinja's philosophy is that while application logic belongs in Python if possible, it shouldn't make the template designer's job difficult by restricting functionality too much.

In A Nutshell

{% extends "base.html" %}
{% block title %}Members{% endblock %}
{% block content %}
  <ul>
  {% for user in users %}
    <li><a href="{{ user.url }}">{{ user.username }}</a></li>
  {% endfor %}
  </ul>
{% endblock %}

Donate

The Pallets organization develops and supports Jinja and other popular packages. In order to grow the community of contributors and users, and allow the maintainers to devote more time to the projects, please donate today.

Contributing

See our detailed contributing documentation for many ways to contribute, including reporting issues, requesting features, asking or answering questions, and making PRs.

jinja (pallets/jinja)

Searching Database…

11.8K ·GitHub
What is this?Jinja is a fast, expressive, extensible template engine for Python: you write placeholders in a template using Python-like syntax, then pass it data to render a final document such as HTML.
Is this a standalone app or a library I import into Python code?It's a Python library (pip-installable as Jinja2) that you import and use inside your own application, not a standalone program. It's maintained by the Pallets organization, the same team behind Flask.
How do I start using Jinja in a project?Install the Jinja2 package, create an Environment, load a template, and call render() with your data to get the final document.
Do I need anything extra for translating templates?Core templating needs nothing beyond Jinja itself, but internationalization (I18N) support relies on the Babel library.
Is it safe to render templates written by untrusted users out of the box?Not automatically — you have to deliberately use Jinja's sandboxed environment to safely render untrusted templates, and HTML autoescaping to prevent XSS has to be enabled for the context you're using.
Who typically uses Jinja?Python web developers rendering HTML (notably Flask apps) and anyone generating text output — configs, emails, code — from templates with Python-like logic.
Can templates share layout or reusable snippets?Yes, Jinja supports template inheritance and inclusion, plus defining and importing macros within templates.
Does Jinja support async Python code?Yes, it has AsyncIO support for generating templates and calling async functions.
How fast is Jinja compared to just formatting strings in Python?Templates are compiled to optimized Python code just-in-time and cached, or can be compiled ahead-of-time, which is why Jinja is described as a very fast engine.
What happens when a template has a bug?Jinja points exceptions to the correct line inside the template file itself, making debugging template errors easier than with typical compiled output.
What are similar projects?flask, starlette, click, loguru, moejs, celery, uvloop, reactionview
Creator
pallets
Size
6.8 MB
Stars
11.8K
Age
16y
Commits · 90 Days