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
refactor: unify resource loading through IResourceLoader chain
- ContentSourceResolver now delegates all URI resolution to loaders
- Base64ResourceLoader handles data:, data://, base64:, base64:// schemes
- FileResourceLoader uses generic URI scheme detection instead of blacklist
- FileResourceLoader supports file:, file://, file:/// prefixes
- base64: is a shorthand alias for data:application/octet-stream;base64,...
- Cookbook: add CLI commands and image source recipes
`BytesValue` wraps `ReadOnlyMemory<byte>` and is passed directly to `IBinaryContentParser` without encoding conversion. When only `IContentParser` is registered, binary data is decoded as UTF-8.
Copy file name to clipboardExpand all lines: docs/wiki/Cookbook.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -559,10 +559,10 @@ var render = new FlexRenderBuilder()
559
559
.Build();
560
560
```
561
561
562
-
> **Note:** NDC receipts use binary data (`BytesValue`), so they must be rendered through the C# API. The CLI does not support binary data inputs. For text-based NDC content, you can use `base64:`prefix in the JSON data:
562
+
> **Note:** NDC receipts use binary data (`BytesValue`), so they must be rendered through the C# API. The CLI does not support binary data inputs. For text-based NDC content, you can use `data:`URI format in the JSON data:
> **Important:** For `data:` URIs, the MIME type is **required** (e.g., `data:image/png;base64,...`). For the `base64:`prefix in content sources, MIME type is **not required** (e.g., `base64:SGVsbG8=`).
1316
+
> **Important:** For image `data:` URIs, the MIME type is **required** (e.g., `data:image/png;base64,...`). For content source `data:`URIs, the MIME type is **optional** (e.g., `data:;base64,SGVsbG8=` or `data:application/octet-stream;base64,SGVsbG8=`).
Copy file name to clipboardExpand all lines: docs/wiki/Element-Reference.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1451,7 +1451,7 @@ Renders tabular data with configurable columns, optional header row, and support
1451
1451
1452
1452
## Content Element (Control Flow)
1453
1453
1454
-
Embeds dynamically formatted content (Markdown, HTML, NDC binary data, etc.) from template data. The `source` supports multiple input types: plain text, `base64:`-encoded binary data, `file:` URIs, `text:` prefixed strings, and template variables bound to `string` or `byte[]` (`BytesValue`). The source is parsed at render time into a subtree of FlexRender elements using pluggable content parsers.
1454
+
Embeds dynamically formatted content (Markdown, HTML, NDC binary data, etc.) from template data. The `source` supports multiple input types: plain text, `data:` URI-encoded binary data, `file:` URIs, `text:` prefixed strings, and template variables bound to `string` or `byte[]` (`BytesValue`). The source is parsed at render time into a subtree of FlexRender elements using pluggable content parsers.
1455
1455
1456
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
1457
@@ -1465,7 +1465,7 @@ This is a **control-flow element** — like `each` and `if`, it is expanded duri
1465
1465
1466
1466
| Property | YAML Name | Type | Default | Valid Values | Expression | Description |
| Source | `source` | string | `""` | Any string, typically `{{variable}}` | Yes | The content to parse. Supports plain text, `base64:` binary, `file:` URIs, `text:` prefix, and `{{variable}}` expressions resolving to `string` or `BytesValue` (`byte[]`). See [Content Source Resolution](#content-source-resolution) below. |
1468
+
| Source | `source` | string | `""` | Any string, typically `{{variable}}` | Yes | The content to parse. Supports plain text, `data:` URI binary, `file:` URIs, `text:` prefix, and `{{variable}}` expressions resolving to `string` or `BytesValue` (`byte[]`). See [Content Source Resolution](#content-source-resolution) below. |
1469
1469
| Format | `format` | string | `""` | `markdown`, `html`, or any registered parser name | Yes | The content format. Must match a registered `IContentParser.FormatName`. |
1470
1470
| Options | `options` | dict? | `null` | Key-value dictionary | No | Parser-specific options (e.g., NDC `columns`, `charsets`). Passed to the content parser. |
1471
1471
@@ -1476,7 +1476,7 @@ The `source` property is resolved at render time through `ContentSourceResolver`
1476
1476
| Source Format | Example | Resolved As | Description |
| Template variable (`BytesValue`) | `source: "{{rawData}}"` | Binary (`byte[]`) | When `{{variable}}` resolves to `BytesValue` in the data context, binary data is passed directly to `IBinaryContentParser`. No string encoding overhead. |
1479
-
| `base64:` prefix | `source: "base64:SGVsbG8="` | Binary (`byte[]`) | Base64-encoded payload decoded into bytes. Useful for embedding binary data in JSON/YAML. |
1479
+
| `data:` URI | `source: "data:;base64,SGVsbG8="` | Binary (`byte[]`) | Data URI with base64-encoded payload decoded into bytes. MIME type is optional (e.g., `data:application/octet-stream;base64,...`). Useful for embedding binary data in JSON/YAML. |
1480
1480
| `file:` scheme | `source: "file:receipt.bin"` | Binary (`byte[]`) | Loads content via registered resource loaders (file system, HTTP, embedded). Also supports `file:///` URIs. Throws if file not found. |
1481
1481
| `text:` prefix | `source: "text:# Hello"` | Text (`string`) | Forces text interpretation, skipping file path detection. |
1482
1482
| File path heuristic | `source: "receipt.md"` | Binary (`byte[]`) | If source looks like a file path (contains `/`, `\`, or a file extension), tries resource loaders first. Falls back to text if no loader matches. |
0 commit comments