Skip to content

HFAiLab/jinja-formatter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jinja Formatter

Implemented using Rust + tree-sitter, by @panrz.

Usage

The codes provided below will be rendered to HTML and served by the server.

<textarea id="input" style="width: 100%; height: 200px;" spellcheck="false">
{% for i in range(10) %}{{ i }}{% endfor %}
</textarea>

Format

<textarea id="output" style="width: 100%; height: 200px;" spellcheck="false"></textarea>
<script> // Generated by copilot function format() { const input = document.getElementById('input').value; fetch('/format', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ input }), }) .then((res) => res.text()) .then((data) => { document.getElementById('output').value = data; }); } </script>

Compile & Run

$ cargo run

And visit localhost:18018

Releases

No releases published

Packages

No packages published

Languages