Skip to main content

Crate oak_liquid

Crate oak_liquid 

Source
Expand description

§oak-liquid

High-performance incremental Liquid2 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 Liquid2 template rendering
  • Syntax Analysis: Detailed AST for advanced tooling
  • LSP Integration: Supports language server protocol for IDE integration

§Usage

use oak_liquid::{LiquidLexer, LiquidParser, LiquidBuilder};

let source = "Hello, {{ name }}!";
let lexer = LiquidLexer::new();
let tokens = lexer.tokenize(source);
let parser = LiquidParser::new();
let ast = parser.parse(tokens);
let builder = LiquidBuilder::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::LiquidRoot;
pub use builder::LiquidBuilder;
pub use parser::LiquidParser;
pub use parser::element_type::LiquidElementType;
pub use crate::lsp::highlighter::LiquidHighlighter;
pub use crate::lsp::LiquidLanguageService;
pub use crate::lsp::formatter::LiquidFormatter;

Modules§

ast
AST module
builder
Builder module
lsp
LSP module
parser
Parser module

Structs§

LiquidLanguage
Language definition for Liquid templates
LiquidLexer
Lexer for Liquid templates

Enums§

LiquidTokenType
Token types for Liquid templates