Expand description
§oak-jinja
High-performance incremental Jinja2 parser for the oak ecosystem with flexible configuration, supporting template rendering and syntax analysis.
§Features
- Incremental Parsing: Efficiently parses only changed parts of templates
- Flexible Configuration: Customizable syntax and behavior
- Template Rendering Support: Built-in support for Jinja2 template rendering
- Syntax Analysis: Detailed AST for advanced tooling
- LSP Integration: Supports language server protocol for IDE integration
§Usage
use oak_jinja::{JinjaLexer, JinjaParser, JinjaBuilder};
let source = "Hello, {{ name }}!";
let lexer = JinjaLexer::new();
let tokens = lexer.tokenize(source);
let parser = JinjaParser::new();
let ast = parser.parse(tokens);
let builder = JinjaBuilder::new();
let root = builder.build(ast);§Syntax Support
- Variables:
{{ variable }} - Blocks:
{% block name %}{% endblock %} - Comments:
{# comment #} - Control Structures:
{% if %},{% for %},{% while %} - Macros:
{% macro name() %}{% endmacro %} - Includes:
{% include "template.html" %} - Extensions:
{% extends "base.html" %}
§License
This project is licensed under the MIT License - see the LICENSE file for details.
Re-exports§
pub use ast::JinjaRoot;pub use builder::JinjaBuilder;pub use parser::JinjaParser;pub use parser::element_type::JinjaElementType;pub use crate::lsp::highlighter::JinjaHighlighter;pub use crate::lsp::JinjaLanguageService;pub use crate::lsp::formatter::JinjaFormatter;
Modules§
Structs§
- Jinja
Language - Language definition for Jinja templates
- Jinja
Lexer - Lexer for Jinja templates
Enums§
- Jinja
Token Type - Token types for Jinja templates