Skip to main content Svelte Highlight v7.21.1

Jinja language preview

1. Macro with filter

macro/endmacro and the e filter
horizon-dark
{# greeting #}
{% macro hello(name) %}
  <p>Hello {{ name | e }}</p>
{% endmacro %}
{{ hello("Ada") }}
atom-one-dark
{# greeting #}
{% macro hello(name) %}
  <p>Hello {{ name | e }}</p>
{% endmacro %}
{{ hello("Ada") }}
github-dark
{# greeting #}
{% macro hello(name) %}
  <p>Hello {{ name | e }}</p>
{% endmacro %}
{{ hello("Ada") }}
dracula
{# greeting #}
{% macro hello(name) %}
  <p>Hello {{ name | e }}</p>
{% endmacro %}
{{ hello("Ada") }}
nord
{# greeting #}
{% macro hello(name) %}
  <p>Hello {{ name | e }}</p>
{% endmacro %}
{{ hello("Ada") }}
github
{# greeting #}
{% macro hello(name) %}
  <p>Hello {{ name | e }}</p>
{% endmacro %}
{{ hello("Ada") }}

2. For loop

for/endfor over a list
horizon-dark
{% for item in items %}
  <li>{{ item | join(",") }}</li>
{% endfor %}
atom-one-dark
{% for item in items %}
  <li>{{ item | join(",") }}</li>
{% endfor %}
github-dark
{% for item in items %}
  <li>{{ item | join(",") }}</li>
{% endfor %}
dracula
{% for item in items %}
  <li>{{ item | join(",") }}</li>
{% endfor %}
nord
{% for item in items %}
  <li>{{ item | join(",") }}</li>
{% endfor %}
github
{% for item in items %}
  <li>{{ item | join(",") }}</li>
{% endfor %}

3. Include and comments

hash-brace comments and string paths
horizon-dark
{# page chrome #}
{% include "header.html" %}
<p>{{ title }}</p>
{% include "footer.html" %}
atom-one-dark
{# page chrome #}
{% include "header.html" %}
<p>{{ title }}</p>
{% include "footer.html" %}
github-dark
{# page chrome #}
{% include "header.html" %}
<p>{{ title }}</p>
{% include "footer.html" %}
dracula
{# page chrome #}
{% include "header.html" %}
<p>{{ title }}</p>
{% include "footer.html" %}
nord
{# page chrome #}
{% include "header.html" %}
<p>{{ title }}</p>
{% include "footer.html" %}
github
{# page chrome #}
{% include "header.html" %}
<p>{{ title }}</p>
{% include "footer.html" %}