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
Let’s walk through a simple example—exporting `.md` files as `.html` using a custom file-based target. This project monitors folder changes and continuously converts markdown to HTML incrementally.
19
-
Check out the full [source code](https://github.com/cocoindex-io/cocoindex/tree/main/examples/custom_output_files).
20
-
21
-
The overall flow is simple:
22
-
This example focuses on
23
-
- how to configure your custom target
24
-
- the flow effortless picks up the changes in the source, recomputes only what's changed and export to the target
18
+
Let’s walk through a simple example—exporting `.md` files as `.html` using a custom file-based target. This project monitors folder changes and continuously converts markdown to HTML incrementally. The overall flow is simple and primarily focuses on how to configure your custom target.
25
19
26
20
27
21
## Ingest files
@@ -33,28 +27,26 @@ Ingest a list of markdown files:
`get_persistent_key()` defines the persistent key,
82
80
which uniquely identifies the target for change tracking and incremental updates. Here, we simply use the target directory as the key (e.g., `./data/output`).
83
81
@@ -180,17 +178,15 @@ def mutate(
180
178
### Use it in the Flow
181
179
182
180
```python
183
-
output_html.export(
184
-
"OutputHtml",
185
-
LocalFileTarget(directory="output_html"),
186
-
primary_key_fields=["filename"],
187
-
)
181
+
output_html.export(
182
+
"OutputHtml",
183
+
LocalFileTarget(directory="output_html"),
184
+
primary_key_fields=["filename"],
185
+
)
188
186
```
189
187
190
188
## Run the example
191
189
192
-
Once your pipeline is set up, keeping your knowledge graph updated is simple:
Copy file name to clipboardExpand all lines: examples/custom_output_files/README.md
+1-2Lines changed: 1 addition & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,4 @@
1
-
# Build text embedding and semantic search 🔍
2
-
[](https://colab.research.google.com/github/cocoindex-io/cocoindex/blob/main/examples/text_embedding/Text_Embedding.ipynb)
1
+
# Export markdown files to local Html with Custom Targets
In this example, we will build index flow to load data from a local directory, convert them to HTML, and save the data to another local directory powered by [CocoIndex Custom Targets](https://cocoindex.io/docs/custom_ops/custom_targets).
0 commit comments