You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/wiki/Element-Reference.md
+135-1Lines changed: 135 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ For rendering options (antialiasing, format settings), see [[Render-Options]].
12
12
13
13
## Common Properties (TemplateElement)
14
14
15
-
All 10 element types (`flex`, `text`, `image`, `svg`, `qr`, `barcode`, `separator`, `table`, `each`, `if`) inherit these properties from the base `TemplateElement` class. You can use any of them on any element.
15
+
All 11 element types (`flex`, `text`, `image`, `svg`, `qr`, `barcode`, `separator`, `table`, `content`, `each`, `if`) inherit these properties from the base `TemplateElement` class. You can use any of them on any element.
16
16
17
17
> **Expression support:** All properties on all element types accept `{{expressions}}`. This includes typed properties like `opacity` (float), `grow`/`shrink` (float), `order` (int), `wrap` (bool on text, FlexWrap on flex), and enum properties like `display`, `position`, `align`. See [[Template-Expressions]] for details.
18
18
@@ -739,13 +739,16 @@ Renders text content with font styling, alignment, wrapping, overflow handling,
| Content | `content` | string | `""` | Any string, may contain `{{variable}}` expressions | No | The text to render. |
741
741
| Font | `font` | string | `"main"` | Any key defined in the `fonts` section | No | Font reference name. Falls back to `"default"` if `"main"` is not defined. |
742
+
| FontFamily | `fontFamily` or `font-family` | string | `""` | Any font family name | No | CSS-like font family name. Searches registered fonts by FamilyName metadata, then system fonts. |
742
743
| Size | `size` | string | `"1em"` | px, em, % | No | Font size. |
743
744
| Color | `color` | string | `"#000000"` | Hex color (#rgb or #rrggbb) | No | Text color. |
744
745
| Align | `align` | TextAlign | `left` | left, center, right, start (logical), end (logical) | No | Horizontal text alignment within the element. `start`/`end` resolve based on text direction. |
745
746
| Wrap | `wrap` | bool | `true` | true, false | No | Whether text wraps to multiple lines when exceeding width. |
746
747
| Overflow | `overflow` | TextOverflow | `ellipsis` | ellipsis, clip, visible | No | How overflowing text is handled when `maxLines` is reached or `wrap` is `false`. |
747
748
| MaxLines | `maxLines` | int? | `null` | Any positive integer, or null for unlimited | No | Maximum number of lines. Text beyond this limit is truncated per `overflow`. |
748
749
| LineHeight | `lineHeight` | string | `""` | Multiplier, px, em, or empty string | No | Line spacing for multi-line text. |
750
+
| FontWeight | `fontWeight` or `font-weight` | FontWeight | `Normal` | `thin` (100), `extra-light` (200), `light` (300), `normal` (400), `medium` (500), `semi-bold` (600), `bold` (700), `extra-bold` (800), `black` (900), or numeric 100-900 | No | Font weight for selecting font variant. CSS-compatible values. |
751
+
| FontStyle | `fontStyle` or `font-style` | FontStyle | `Normal` | `normal`, `italic`, `oblique` | No | Font style for selecting font variant. |
749
752
750
753
```yaml
751
754
# Font size in pixels
@@ -834,6 +837,30 @@ Renders text content with font styling, alignment, wrapping, overflow handling,
834
837
wrap: true
835
838
```
836
839
840
+
**fontWeight and fontStyle examples:**
841
+
842
+
```yaml
843
+
# Font weight and style variants
844
+
- type: text
845
+
content: "Bold text"
846
+
fontWeight: bold
847
+
848
+
- type: text
849
+
content: "Italic text"
850
+
fontStyle: italic
851
+
852
+
- type: text
853
+
content: "Light italic"
854
+
fontWeight: light
855
+
fontStyle: italic
856
+
857
+
- type: text
858
+
content: "Semi-bold"
859
+
fontWeight: 600
860
+
```
861
+
862
+
> **Font resolution priority:** `font` (registered name) > `fontFamily` (family name lookup) > fallback (default). When `fontFamily` is set, FlexRender searches registered fonts by FamilyName metadata, then system fonts. When `fontWeight` or `fontStyle` is set, FlexRender automatically scans the same directory as the resolved font file for sibling files with matching family name and weight/style (within +/-100 units). See [[Template-Syntax#fonts]] for details. Variable fonts are not supported -- use separate static `.ttf`/`.otf` files per weight.
@@ -1283,6 +1310,9 @@ Renders tabular data with configurable columns, optional header row, and support
1283
1310
| Columns | `columns` | column[] | -- | Array of column definitions | **Yes** | Column definitions. Must have at least one column. |
1284
1311
| Rows | `rows` | row[] | `[]` | Array of static row definitions | No | Static rows. Alternative to `array` for fixed data. |
1285
1312
| HeaderFont | `headerFont` or `header-font` | string? | `null` | Any font name from `fonts` section | No | Font for the header row. |
1313
+
| HeaderFontWeight | `headerFontWeight` or `header-fontWeight` | string? | `null` | Font weight name or 100-900 | No | Font weight for the header row. |
1314
+
| HeaderFontStyle | `headerFontStyle` or `header-fontStyle` | string? | `null` | normal, italic, oblique | No | Font style for the header row. |
1315
+
| HeaderFontFamily | `headerFontFamily` or `header-fontFamily` | string? | `null` | Any font family name | No | CSS-like font family for the header row. |
1286
1316
| HeaderColor | `headerColor` or `header-color` | string? | `null` | Hex color | No | Text color for the header row. |
1287
1317
| HeaderSize | `headerSize` or `header-size` | string? | `null` | px, em, % | No | Font size for the header row. |
1288
1318
| HeaderBackground | `headerBackground` or `header-background` | string? | `null` | Hex color | No | Background color for the header row. |
@@ -1419,6 +1449,110 @@ Renders tabular data with configurable columns, optional header row, and support
1419
1449
1420
1450
---
1421
1451
1452
+
## Content Element (Control Flow)
1453
+
1454
+
Embeds dynamically formatted text (Markdown, HTML, etc.) from template data. The `source` text is parsed at render time into a subtree of FlexRender elements using pluggable content parsers.
1455
+
1456
+
This is a **control-flow element** — like `each` and `if`, it is expanded during template processing and does not appear in the final render tree.
1457
+
1458
+
```yaml
1459
+
- type: content
1460
+
source: "{{body}}"
1461
+
format: markdown
1462
+
```
1463
+
1464
+
### Properties
1465
+
1466
+
| Property | YAML Name | Type | Default | Valid Values | Expression | Description |
| Source | `source` | string | `""` | Any string, typically `{{variable}}` | Yes | The formatted text to parse. Usually bound to a data variable. |
1469
+
| Format | `format` | string | `""` | `markdown`, `html`, or any registered parser name | Yes | The content format. Must match a registered `IContentParser.FormatName`. |
The `content` element is expanded at render time (like `each` and `if`), so parsed templates can be safely cached and rendered with different data.
1553
+
1554
+
---
1555
+
1422
1556
## each (Control Flow)
1423
1557
1424
1558
Iterates over an array in the template data, rendering the `children` template once for each array item. This is the primary mechanism for dynamic, data-driven lists.
0 commit comments