HTML to RichText (Slate.js)

default discord avatar
7 months ago

Hi everyone!,

I can try to import some posts from WP through local API but I have a problem with the content.

I don’t understand how can I convert HTML to RichText using slate.js. Someone could help me?

  • default discord avatar
    7 months ago

    Hey @stfn7777 checkout the Payload github, they have a ton of good examples of Payload in action alongside Next.

    This is a pretty good example for the RichText Serializer

  • default discord avatar
    7 months ago

    Ok thank you but this is for "frontend" part, at the moment I try to import posts from WP so I have HTML and I need to transform into the RichText... Is there a way to do that?

  • discord user avatar
    Payload Team
    7 months ago

    It looks like you might be able to use this to do what you are asking:

    Obviously you will want to test the input/output before running it on all of your data - but I think this would be an excellent starting point.

  • default discord avatar
    7 months ago

    Ok thank! you I will try it

    if you are interested, this serializer works:

    It works in each convertion html to slate and slate to html

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!


Connect with the Payload Community on Discord



Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.