algolia / algolia/react-element-to-jsx-string

Allow children to return HTML

Open
#890 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
518
Forks
87
Avg merge
3h 56m
Merged PRs (30d)
3

Description

I'm trying to generate RSS feed using `reactElementToJSXString` from a React element.

When I try to render the content of the blog post, it should look something like this:

```xml

my para


]]>

```

However, it seems like all the HTML is transformed into a string:

```xml

{`

my para

]]>`}

```

My React code:

```ts
import type { JSONFeed } from "./feed-type";

export const RSS = (feed: JSONFeed) => (


{feed.items?.map((item) => {
return (

{``}

);
})}


);
```

Is it possible to have it rendered without being turned into a string?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the RSS example with reactElementToJSXString and inspect how child text containing HTML and CDATA is serialized. Determine the expected output for HTML children and verify the behavior with a focused regression test; done means the generated JSX preserves the requested child representation without the current string transformation.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.