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
feat: add create_file_from_elements() to re-create document files from elements (#4259)
## Summary
Adds `create_file_from_elements()` in `unstructured.staging.base` so
users can re-build a document file from a list of elements (reverse of
partition). Supports the workflow: partition -> modify elements (e.g.
replace Image with NarrativeText using alt text) -> write back to file.
Closes#3994.
## Changes
- **`unstructured/staging/base.py`**: New
`create_file_from_elements(elements, format="markdown"|"html"|"text",
filename=None, ...)` that delegates to `elements_to_md`,
`elements_to_html`, or `elements_to_text` and optionally writes to a
file.
- **`test_unstructured/staging/test_base.py`**: Tests for markdown,
text, and HTML output and for unsupported format raising `ValueError`.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,8 @@
1
+
## 0.21.6
2
+
3
+
### Enhancements
4
+
-**Add `create_file_from_elements()` to re-create document files from elements (fixes #3994)**: New staging helper `create_file_from_elements(elements, output_format=..., filename=...)` converts a list of elements back into a document in the given format (`"markdown"`, `"html"`, or `"text"`), optionally writing to a file. Supports the workflow: partition → modify elements (e.g. replace Image with NarrativeText using alt text) → write back to file.
0 commit comments