Skip to content

Commit 2276cf7

Browse files
committed
Update ContentLink documentation with stripStega details
Clarify that stripStega works with any data type (strings, objects, arrays, primitives) by converting to JSON, removing stega encodings with VERCEL_STEGA_REGEX, and parsing back. Add examples for different data types.
1 parent 8cb34b1 commit 2276cf7

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

docs/content-link.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -524,15 +524,27 @@ if (decoded) {
524524

525525
### `stripStega`
526526

527-
Removes stega encoding from text, returning clean text:
527+
Removes stega encoding from any data type (strings, objects, arrays, primitives) by converting to JSON, removing all stega-encoded segments using the global VERCEL_STEGA_REGEX, and parsing back to the original type:
528528

529529
```typescript
530530
import { stripStega } from 'react-datocms';
531531

532-
const text = "Hello, world!"; // Contains invisible stega data
533-
const clean = stripStega(text);
532+
// Works with strings
533+
stripStega("Hello‎World") // "HelloWorld"
534+
535+
// Works with objects
536+
stripStega({ name: "John‎", age: 30 })
537+
538+
// Works with nested structures - removes ALL stega encodings
539+
stripStega({
540+
users: [
541+
{ name: "Alice‎", email: "alice‎.com" },
542+
{ name: "Bob‎", email: "bob‎.co" }
543+
]
544+
})
534545

535-
console.log(clean); // "Hello, world!" without encoding
546+
// Works with arrays
547+
stripStega(["First‎", "Second‎", "Third‎"])
536548
```
537549

538550
These utilities are useful when you need to:

0 commit comments

Comments
 (0)