docs(adr): ADR-0001: Use Tera as Default Template Engine
@aRustyDev đang làm issue này rồi.
Từ ngày 5/1/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
ADR-0001: Use Tera as Default Template Engine
Status
Accepted
Context
The mdbook-htmx backend needs a template engine to render HTMX-enhanced HTML pages. The skeleton files indicated support for multiple engines:
- Nunjucks (JavaScript)
- Handlebars (Rust/JS)
- Liquid (Ruby/Rust)
- Tera (Rust-native)
The backend is written in Rust to align with MDBook's ecosystem and ensure seamless integration via the mdbook-renderer crate.
Decision Drivers
- Language Consistency - Backend is Rust; prefer Rust-native engines
- Performance - Compile-time template validation, no FFI overhead
- Feature Parity - Must support: includes, extends, filters, conditionals
- Ecosystem Fit - Used by other Rust documentation tools (Zola)
- Maintenance - Active development, good documentation
Options Considered
Option A: Tera
Pros:
- Pure Rust, compiles with the backend
- Jinja2-compatible syntax (familiar to Python/Django developers)
- Template inheritance (
{% extends %},{% block %}) - Custom filters and functions
- Used by Zola (similar documentation use case)
- Compile-time syntax validation
Cons:
- Less feature-rich than full Jinja2
- Smaller community than Handlebars
Option B: Handlebars (handlebars-rs)
Pros:
- Rust implementation available
- Wide adoption across languages
- Logic-less philosophy (simpler templates)
Cons:
- No template inheritance (only partials)
- Verbose for complex layouts
- Logic-less can be limiting for HTMX patterns
Option C: Liquid (liquid-rust)
Pros:
- Rust implementation available
- Simple syntax
- Used by Jekyll
Cons:
- Limited control flow
- No template inheritance
- Less expressive for component-based layouts
Option D: Nunjucks (via wasm or subprocess)
Pros:
- Full Jinja2 compatibility
- Rich feature set
Cons:
- JavaScript runtime dependency
- Performance overhead (subprocess or WASM)
- Complicates build/distribution
Decision
Use Tera as the default template engine.
Rationale:
- Pure Rust eliminates external dependencies
- Template inheritance is essential for
layout.html→page.htmlpattern - Jinja2 syntax is widely known
- Zola uses Tera for similar documentation purposes, proving suitability
- Custom filters enable
{{ asset('path') }}helper for hashed filenames
Consequences
Positive
- Single-binary distribution (no runtime dependencies)
- Fast template compilation and rendering
- Familiar syntax for most developers
- Strong typing integration with Rust structs
Negative
- Users familiar with Handlebars/Liquid need to learn Tera
- Some advanced Jinja2 features not available
Mitigation
- Document Tera syntax in SPEC
- Provide example templates
- Consider optional Handlebars support in future (via feature flag)
References
- Ngôn ngữ chính
- Rust
- Star
- 0
- Fork
- 1
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của aRustyDev/mdbook-htmx
-
feat(ci): Implement cross-repo-validate compliance for docs syncCó thể làm lại được @aRustyDev đã nhận 286 ngày trước và không có pull request nào đang mở. Đang mởci enhancement
aRustyDev/mdbook-htmx#58 · 1 bình luận · 1 người được giao ·
-
docs(htmx): Explain how HTMX worksCó thể làm lại được @aRustyDev đã nhận 289 ngày trước và không có pull request nào đang mở. Đang mở
aRustyDev/mdbook-htmx#48 · 3 bình luận · 1 người được giao ·
-
docs(mdbook-htmx): Parent Issue for documentationCó thể làm lại được @aRustyDev đã nhận 289 ngày trước và không có pull request nào đang mở. Đang mởdocumentation
aRustyDev/mdbook-htmx#47 · 1 người được giao ·
-
docs(examples): Secure Self-Hosted Meilisearch via CloudflareCó thể làm lại được @aRustyDev đã nhận 289 ngày trước và không có pull request nào đang mở. Đang mởdocumentation
aRustyDev/mdbook-htmx#46 · 1 người được giao ·
-
docs(examples): Kubernetes with MeilisearchCó thể làm lại được @aRustyDev đã nhận 289 ngày trước và không có pull request nào đang mở. Đang mởdocumentation
aRustyDev/mdbook-htmx#45 · 1 người được giao ·
Tất cả issue của aRustyDev/mdbook-htmx
Issue tương tự
-
documentation priority:p2 type:chore
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
Maintainer thường phản hồi trong vòng 1 ngày
-
dispatch:sol-high documentation
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 85/100
carrick-sh/carrick#768 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
correctness postgres tursopg
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
tursodatabase/turso#10442 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Incorrect "Share Decks" linkĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
ankitects/anki#5864 · 1 reaction ·
Maintainer thường phản hồi trong vòng 2 ngày
-
area: config effort: S good first issue P3 type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
ferenyl/azuredevopstui#63 ·