Skip to content

Latest commit

 

History

History
43 lines (33 loc) · 933 Bytes

README.md

File metadata and controls

43 lines (33 loc) · 933 Bytes

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