jinja

3 posts tagged “jinja”.

  1. 2025
  2. Turning on Jinja autoescaping when using Template() directly

    Jinja autoescaping is turned off by default. Coming from Django this frequently catches me out. You can turn on autoescaping for your Jinja environment using: But what about if you are using directly?

    1 min read
  3. 2024
  4. Custom Jinja template tags with attributes

    I decided to implement a custom Jinja template block tag for my datasette-render-markdown plugin. I wanted the tag to work like this: A basic Jinja extension After some fiddling around with GitHub…

    2 min read
  5. 2023
  6. Formatting thousands in Jinja

    Here's how to format a number in Jinja with commas for thousands, without needing any custom filters or template functions: {{ "{:,}".format(row count) }} Output looks like this: 179,119 Bonus: here's…

    1 min read