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
Allow conversion splitters for text extensions (#1778)
* Allow conversion splitters for text extensions
Allow conversion splitters for text extensions
Previously RegisterStreamConverter threw for text extensions, and the
splitter pipeline only handled stream targets, so a converter could not
run against a text extension (eg html).
- Drop the text-extension guard in RegisterStreamConverter
- DoExtensionConversion now takes the Target itself and resolves the
converter input from either a stream or a text (utf8) target, instead
of reconstructing an illegal stream Target for text extensions
- Scrub text targets before they are fed to a converter, so derived
targets (eg rendered images) reflect the scrubbed content
- Move converted-target scrubbing into DoExtensionConversion and pass
already-converted targets through GetTargets untouched, so each text
target is scrubbed exactly once (no double scrub of the re-emitted
source)
Add ExtensionConverterTests.TextSplitter covering a converter registered
against a text extension.
* .
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
A stream converter can also be registered against a text extension. This is useful when a text document needs derived targets, for example rendering html to an image for visual verification.
152
+
153
+
The text target is scrubbed before being passed to the converter, so any derived targets (for example a rendered image) reflect the scrubbed content.
154
+
155
+
For a custom text extension, register it as text via `FileExtensions.AddTextExtension`. Built-in text extensions (for example `html` or `csv`) do not require this.
A stream converter can also be registered against a text extension. This is useful when a text document needs derived targets, for example rendering html to an image for visual verification.
56
+
57
+
The text target is scrubbed before being passed to the converter, so any derived targets (for example a rendered image) reflect the scrubbed content.
58
+
59
+
For a custom text extension, register it as text via `FileExtensions.AddTextExtension`. Built-in text extensions (for example `html` or `csv`) do not require this.
60
+
61
+
snippet: RegisterStreamConverterTextExtension
62
+
63
+
snippet: TextExtensionConverterVerify
64
+
65
+
53
66
### Cleanup
54
67
55
68
If cleanup needs to occur after verification a callback can be passes to `ConversionResult`:
0 commit comments