Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need help in converting custom block into html #4

Open
mostlycloudysky opened this issue Jan 18, 2023 · 0 comments
Open

Need help in converting custom block into html #4

mostlycloudysky opened this issue Jan 18, 2023 · 0 comments

Comments

@mostlycloudysky
Copy link

Hi Team,

I have been trying to convert the sanity webhook event data (which is portable text into html). However, i have a custom code block and would like to add it to the serializer. What would be the proper way to do it ? any example is really helpful, this is the last part of the webhook data that i stuck with and i am processing it on the server side.

      {
         "_key":"cae3d7fa8a0d",
         "_type":"codeBlock",
         "code":"<PortableText\n  className='prose mx-auto mt-8'\n  content={content}\n  projectId={process.env.PROJECT_ID}\n  dataset={process.env.DATASET}\n  serializers={{\n    code: props => {\n      // console.log('Testing', props)\n      return <pre>{props.children}</pre>\n    },\n    codeBlock: props => {\n      return <CodeBlock code={props.code} language={props.language} />\n    },\n  }}\n/>",
         "language":"html"
      },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant