### Nimja Block Rendering for Dynamic Content (HTMX Example)
Source: https://github.com/enthus1ast/nimja/blob/master/readme.md
Provides an example of using Nimja's `blockToRender` feature in conjunction with HTMX. It shows how to render the entire page initially and then selectively render a specific block (e.g., 'button') for partial updates.
```nimja
{% block content %}
Hello
{% block button %}
{%- if button == 10%}you klicked enough!!{% endif -%}
{%- if button == 10%}you klicked enough!!{% endif -%}
{% endblock %}
```
--------------------------------
### Nimja Syntax Transformation Example
Source: https://github.com/enthus1ast/nimja/blob/master/readme.md
Demonstrates the transformation of Nimja template syntax into equivalent Nim code. It shows how variable access, method calls, and comments are converted.
```text
- `{{ myObj.myVar }}` --transformed-to---> `$(myObj.myVar)`
- {% myExpression.inc() %} --transformed-to---> `myExpression.inc()`
- {# a comment #}
```
--------------------------------
### Nim Example for Rendering Child Template
Source: https://github.com/enthus1ast/nimja/blob/master/readme.md
Demonstrates how to compile and render a Nimja child template using Nim code. This example uses `compileTemplateFile` and specifies the `baseDir`.
```nim
proc renderChild(): string =
compileTemplateFile("child.nimja", baseDir = getScriptDir())
echo renderChild()
```
--------------------------------
### Nimja Macro Definition and Usage
Source: https://github.com/enthus1ast/nimja/blob/master/readme.md
Demonstrates how to define a macro in Nimja using the `macro` keyword and how to invoke it with parameters. The example shows a basic textarea macro.
```nimja
{% macro textarea(name, value="", rows=10, cols=40): string = %}
{% endmacro %}
{{ textarea("name", "value") }}
```
--------------------------------
### Nimja Template Inheritance Example
Source: https://github.com/enthus1ast/nimja/blob/master/readme.md
Illustrates Nimja template inheritance using Jinja2-like syntax. `index.nimja` and `detail.nimja` extend a master layout defined in `_master.nimja`. This demonstrates how to set up a base template and override specific blocks within derived templates for structure and content management.
```html
{% extends "templates/partials/_master.nimja" %}
{% block content %}