HTML to RichText (Slate.js)

default discord avatar
stfn7777last year

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
    markatomniuxlast year

    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
    stfn7777last year

    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?

  • 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
    stfn7777last year

    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

Star on GitHub


Chat on Discord



Can't find what you're looking for?

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