{"id":22687903,"url":"https://github.com/rinja-rs/askama","last_synced_at":"2025-03-04T21:14:49.681Z","repository":{"id":14811726,"uuid":"77144276","full_name":"rinja-rs/askama","owner":"rinja-rs","description":"Type-safe, compiled Jinja-like templates for Rust","archived":false,"fork":false,"pushed_at":"2025-01-27T04:29:39.000Z","size":3742,"stargazers_count":3638,"open_issues_count":132,"forks_count":227,"subscribers_count":24,"default_branch":"main","last_synced_at":"2025-03-01T14:50:06.535Z","etag":null,"topics":["custom-derive","jinja2","rust","rust-library","templating"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rinja-rs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["djc"],"patreon":"dochtman"}},"created_at":"2016-12-22T12:50:45.000Z","updated_at":"2025-03-01T14:03:48.000Z","dependencies_parsed_at":"2023-10-12T21:24:52.397Z","dependency_job_id":"89a07aee-b786-4447-a94b-d17f54ebb09a","html_url":"https://github.com/rinja-rs/askama","commit_stats":{"total_commits":1185,"total_committers":110,"mean_commits":"10.772727272727273","dds":0.3687763713080169,"last_synced_commit":"4c98685b81509a59bf7719321eb2136d7dccca38"},"previous_names":["rinja-rs/askama"],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rinja-rs%2Faskama","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rinja-rs%2Faskama/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rinja-rs%2Faskama/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rinja-rs%2Faskama/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rinja-rs","download_url":"https://codeload.github.com/rinja-rs/askama/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241661421,"owners_count":19998950,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["custom-derive","jinja2","rust","rust-library","templating"],"created_at":"2024-12-10T00:02:05.873Z","updated_at":"2025-03-04T21:14:49.656Z","avatar_url":"https://github.com/rinja-rs.png","language":"Rust","funding_links":["https://github.com/sponsors/djc","https://patreon.com/dochtman","https://www.patreon.com/dochtman"],"categories":["Rust","Libraries","Recently Updated"],"sub_categories":["Template engine","[Dec 17, 2024](/content/2024/12/17/README.md)"],"readme":"# Askama\n\n[![Documentation](https://docs.rs/askama/badge.svg)](https://docs.rs/askama/)\n[![Latest version](https://img.shields.io/crates/v/askama.svg)](https://crates.io/crates/askama)\n[![Build Status](https://github.com/djc/askama/workflows/CI/badge.svg)](https://github.com/djc/askama/actions?query=workflow%3ACI)\n[![Chat](https://img.shields.io/discord/976380008299917365?logo=discord)](https://discord.gg/ZucwjE6bmT)\n\nAskama implements a template rendering engine based on [Jinja](https://jinja.palletsprojects.com/).\nIt generates Rust code from your templates at compile time\nbased on a user-defined `struct` to hold the template's context.\nSee below for an example, or read [the book][docs].\n\n**\"Pretty exciting. I would love to use this already.\"** --\n[Armin Ronacher][mitsuhiko], creator of Jinja\n\nAll feedback welcome. Feel free to file bugs, requests for documentation and\nany other feedback to the [issue tracker][issues] or [tweet me][twitter].\n\nAskama was created by and is maintained by Dirkjan Ochtman. If you are in a\nposition to support ongoing maintenance and further development or use it\nin a for-profit context, please consider supporting my open source work on\n[Patreon][patreon].\n\n### Feature highlights\n\n* Construct templates using a familiar, easy-to-use syntax\n* Benefit from the safety provided by Rust's type system\n* Template code is compiled into your crate for [optimal performance][benchmarks]\n* Optional built-in support for Actix, Axum, Rocket, and warp web frameworks\n* Debugging features to assist you in template development\n* Templates must be valid UTF-8 and produce UTF-8 when rendered\n* IDE support available in [JetBrains products](https://plugins.jetbrains.com/plugin/16591-askama-template-support)\n* Works on stable Rust\n\n### Supported in templates\n\n* Template inheritance\n* Loops, if/else statements and include support\n* Macro support\n* Variables (no mutability allowed)\n* Some built-in filters, and the ability to use your own\n* Whitespace suppressing with '-' markers\n* Opt-out HTML escaping\n* Syntax customization\n\n[docs]: https://djc.github.io/askama/\n[fafhrd91]: https://github.com/fafhrd91\n[mitsuhiko]: http://lucumr.pocoo.org/\n[issues]: https://github.com/djc/askama/issues\n[twitter]: https://twitter.com/djco/\n[patreon]: https://www.patreon.com/dochtman\n[benchmarks]: https://github.com/djc/template-benchmarks-rs\n\n\nHow to get started\n------------------\n\nFirst, add the Askama dependency to your crate's `Cargo.toml`:\n\n```sh\ncargo add askama\n```\n\nNow create a directory called `templates` in your crate root.\nIn it, create a file called `hello.html`, containing the following:\n\n```\nHello, {{ name }}!\n```\n\nIn any Rust file inside your crate, add the following:\n\n```rust\nuse askama::Template; // bring trait in scope\n\n#[derive(Template)] // this will generate the code...\n#[template(path = \"hello.html\")] // using the template in this path, relative\n                                 // to the `templates` dir in the crate root\nstruct HelloTemplate\u003c'a\u003e { // the name of the struct can be anything\n    name: \u0026'a str, // the field name should match the variable name\n                   // in your template\n}\n\nfn main() {\n    let hello = HelloTemplate { name: \"world\" }; // instantiate your struct\n    println!(\"{}\", hello.render().unwrap()); // then render it.\n}\n```\n\nYou should now be able to compile and run this code.\n\nReview the [test cases] for more examples.\n\n[test cases]: https://github.com/djc/askama/tree/main/testing\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frinja-rs%2Faskama","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frinja-rs%2Faskama","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frinja-rs%2Faskama/lists"}