Skip to content

The ultimate online Jinja2 template renderer, editor, and tester - no installation required! A powerful, browser-based Jinja2 template engine that runs Python's official Jinja2 library directly in your web browser using Pyodide.

Notifications You must be signed in to change notification settings

Keshav-Madhav/live_jinja

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

35 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Live Jinja Parser 🐍

The ultimate online Jinja2 template renderer, editor, and tester - no installation required! A powerful, browser-based Jinja2 template engine that runs Python's official Jinja2 library directly in your web browser using Pyodide.

Quickly iterate on templates, then save, share, and reload entire workspaces (template, variables, and UI settings) via local storage or a single compressed link.

Perfect for developers who need to render Jinja2 templates online, test Jinja template syntax, debug template variables, or learn Jinja2 templating without setting up a local Python environment. Whether you're working with Flask templates, Ansible playbooks, or any Jinja2-based templating system, this live renderer provides instant feedback and professional debugging tools.

πŸ” Keywords

Jinja2 online renderer β€’ Jinja template tester β€’ Live Jinja2 editor β€’ Browser-based template engine β€’ Jinja2 debugger β€’ Template variable extractor β€’ Online Python Jinja β€’ Jinja2 playground β€’ Template syntax checker β€’ Real-time Jinja rendering

πŸš€ Features

✨ Core Functionality

  • Live Template Rendering: Real-time Jinja2 template processing using Python's actual Jinja2 library via Pyodide
  • Version Selection: Choose from multiple Jinja2 versions (2.10.x, 2.11.x, 3.0.x, 3.1.x) to match your production environment
  • Auto-Rerender: Automatically updates output as you type (can be toggled on/off)
  • Manual Rerender: Option to disable auto-rendering and manually trigger updates
  • Syntax Highlighting: Full Jinja2 syntax highlighting with CodeMirror
  • Dark/Light Mode: Beautiful dark mode by default with easy theme toggle

πŸ’Ύ Template Management

  • Save Templates Locally: Persist template, variables, output options, and layout preferences in the browser's storage
  • One-Click Share Links: Generate compressed URLs containing the full configuration for quick collaboration
  • Load & Rename: Restore saved setups from the side drawer, rename them in-place, or delete when no longer needed
  • Instant Copy Actions: Copy template or rendered output with a single click

πŸ”§ Variable Management

  • Intelligent Variable Extraction: Automatically detects and extracts variables from your templates
  • Dual Input Modes:
    • JSON Mode: Direct JSON editing with syntax highlighting
    • Form Mode: Dynamic form generation with individual input fields for each variable
  • Smart Structure Detection: Recognizes objects, arrays, loops, and conditional variables
  • Variable Preservation: Maintains existing variable values when extracting new ones

πŸ“ Editor Features

  • Multi-Panel Layout: Split view with template, variables, and output panels
  • Text Wrapping Toggle: Enable/disable line wrapping for better readability
  • Copy Functionality: One-click copying of templates and output
  • Responsive Design: Fully responsive interface that works on all screen sizes

πŸ‘οΈ Visualization & Output Modes

  • Markdown Rendering: Full markdown support with syntax highlighting and formatting
  • Mermaid Diagrams: Create flowcharts, sequence diagrams, and more
    • Embedded Mode: Mix markdown text with Mermaid diagrams
    • Pure Mode: Treat entire output as a single Mermaid diagram
  • Whitespace Visualization: Toggle to show spaces (Β·), tabs (β†’), and newlines (↡)
  • Remove Extra Whitespace: Automatically clean up excessive whitespace in output
    • Collapses 3+ consecutive newlines to maximum 2 blank lines
    • Reduces multiple spaces to single space
    • Reduces multiple tabs to single tab
    • Handles alternating space/newline patterns
    • Enabled by default for cleaner output
  • Error Handling: Clear error messages for template syntax and JSON parsing errors
  • Loading States: Visual feedback during Python environment initialization

πŸŽ›οΈ Layout Customization

  • Resizable Panels: Drag handles to resize template, variables, and output panels
  • Window Resizing: Responsive layout that adapts to window size changes
  • Persistent Layout: Maintains panel proportions during interactions

⚑ Performance & Technology

  • Pyodide Integration: Full Python Jinja2 implementation running in the browser
  • No Server Required: Complete client-side solution
  • Modern JavaScript: ES6+ with efficient event handling and debouncing
  • CodeMirror Integration: Professional code editing experience

πŸ› οΈ Technical Stack

  • Frontend: Vanilla JavaScript (ES6+), HTML5, CSS3
  • Python Runtime: Pyodide v0.25.1
  • Template Engine: Jinja2 (running in browser via Pyodide)
  • Code Editor: CodeMirror v5.65.15
  • Markdown: Marked.js v11.1.0
  • Diagrams: Mermaid v10.6.1
  • Styling: Custom CSS with CSS variables for dynamic theming

🎯 Use Cases

  • Template Development: Rapid prototyping and testing of Jinja2 templates
  • Version Compatibility Testing: Test templates against different Jinja2 versions before deployment
  • Learning Jinja2: Interactive environment for learning template syntax
  • Documentation Generation: Create markdown docs with dynamic content and diagrams
  • Diagram Generation: Build flowcharts and visualizations from template data
  • Debugging: Visualize whitespace and troubleshoot template issues
  • Code Review: Share and review templates without server setup
  • Migration Planning: Test templates when upgrading Jinja2 versions in production

πŸ”§ Jinja2 Version Selector

The Live Jinja Parser now supports multiple Jinja2 versions, allowing you to match your production environment exactly:

Supported Versions

  • Latest (3.1.4) - Default, most recent stable release
  • 3.1.x series - 3.1.3, 3.1.2, 3.1.1, 3.1.0
  • 3.0.x series - 3.0.3, 3.0.2, 3.0.1, 3.0.0
  • 2.11.x series - 2.11.3, 2.11.2, 2.11.1, 2.11.0
  • 2.10.x series - 2.10.3, 2.10.1

Why Use Version Selection?

  1. Compatibility Testing: Ensure your templates work with your production Jinja2 version
  2. Bug Reproduction: Test issues specific to certain versions
  3. Migration Planning: Preview how templates behave in newer versions
  4. Feature Availability: Check which features are available in different versions

How to Find Your Jinja2 Version

import jinja2
print(jinja2.__version__)

Or from the command line:

pip show jinja2

Features

  • Session-Only Selection: Version resets to "Latest" on page reload (intentional design)
  • Included in Templates: Saved templates remember which Jinja2 version was used (shown as badge)
  • Shared in URLs: Share links include the Jinja2 version for reference
  • Dynamic Switching: Change versions on-the-fly without page reload
  • Manual Control: Loading a template shows which version it was created with, but you manually choose if/when to switch versions

For more details, see JINJA_VERSION_SELECTOR.md.

πŸš€ Getting Started

  1. Clone or Download: Get the project files
  2. Open in Browser: Simply open index.html in a modern web browser
  3. Wait for Initialization: The Python environment loads automatically (first load takes ~10-30 seconds)
  4. Start Templating: Begin writing Jinja2 templates in the left panel

Example Templates

Basic Template:

Hello {{ name }}!

{% if user.authenticated %}
Welcome back, {{ user.name }}!
{% else %}
Please log in to continue.
{% endif %}

{% for item in items %}
- {{ item.name }}: ${{ item.price }}
{% endfor %}

Markdown with Diagrams:

# {{ title }}

## Process Flow

{# Embed mermaid diagrams in triple backticks with mermaid keyword #}
graph LR
    A[{{ step1 }}] --> B[{{ step2 }}]
    B --> C[{{ step3 }}]

Generated on {{ date }}

Toggle "Markdown" to render with embedded diagrams

Pure Mermaid:

graph TD
    A[{{ start }}] --> B{{{ decision }}}
    B -->|Yes| C[{{ yes_action }}]
    B -->|No| D[{{ no_action }}]

Enable "Mermaid" toggle for pure diagram rendering

πŸ”§ Key Features Breakdown

Auto Variable Extraction

The tool intelligently analyzes your template and creates appropriate variable structures:

  • Detects simple variables: {{ name }} β†’ creates string input
  • Identifies objects: {{ user.name }} β†’ creates nested object structure
  • Recognizes arrays: {% for item in items %} β†’ creates array input
  • Handles complex patterns: Loop variables with properties, conditional checks, array access

Dual Input Modes

  • JSON Mode: Full control with direct JSON editing, perfect for complex data structures
  • Form Mode: User-friendly individual inputs, ideal for simple variables and quick testing

Responsive Layout System

  • Horizontal Resize: Adjust template vs. variables panel height
  • Vertical Resize: Control left panels vs. output panel width
  • Window Adaptation: Automatically adjusts to browser window changes
  • Minimum Constraints: Prevents panels from becoming too small

Output Modes

Three powerful ways to view your rendered templates:

  • Plain Text: Standard output with optional whitespace visualization (·→↡)
  • Remove Extra: Toggle to clean up excessive whitespace (enabled by default)
  • Markdown: Full markdown rendering with embedded Mermaid diagrams
  • Mermaid: Pure diagram mode - entire output becomes a single diagram

Save, Share, and Reload Workflows

  • Drawer-Based Management: Browse all saved templates in a drawer with metadata and quick actions
  • Configuration Snapshots: Each save captures template source, variable values, rendering toggles (auto-rerender, markdown, mermaid, whitespace, remove extra whitespace, text wrap), and layout state
  • Shareable Links: Compress current state into a URL for teammates to load identical sessions instantly (no backend required)
  • Rename or Delete: Keep collections tidy with inline rename and delete controls

🌐 Browser Compatibility

  • Chrome/Chromium: Full support
  • Firefox: Full support
  • Safari: Full support
  • Edge: Full support

Note: First load requires internet connection to download Pyodide runtime

πŸ“± Mobile Support

While optimized for desktop development, the interface is fully responsive and functional on tablets and mobile devices with appropriate touch interactions for resizing and editing.

🀝 Contributing

Feel free to submit issues, feature requests, or pull requests. This project aims to be a comprehensive tool for Jinja2 development in the browser.

πŸ“„ License

Open source - see individual component licenses for Pyodide, CodeMirror, and other dependencies.


Live Jinja Parser - Making Jinja2 template development fast, visual, and accessible anywhere you have a browser! πŸš€

About

The ultimate online Jinja2 template renderer, editor, and tester - no installation required! A powerful, browser-based Jinja2 template engine that runs Python's official Jinja2 library directly in your web browser using Pyodide.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •