sanity-io / block-content-to-react

Deprecated in favor of @portabletext/react
https://github.com/portabletext/react-portabletext
MIT License
161 stars 25 forks source link

How can i use Katex? #55

Closed thebosph closed 1 year ago

thebosph commented 2 years ago

Hello everyone. I try to using Sanity Latex Input. Sanity studio ok but in frontend(nextjs) i cant show latex content with @sanity/block-content-to-react. How can i do this?

Error: Unknown block type "latex", please specify a serializer for it in the serializers.types prop. and

Unknown block type "undefined", please specify a serializer for it in the serializers.types prop

how can i serialize Latex?

thanks a lot.

runeb commented 2 years ago

Here is an example

A component for rendering katex content:

https://github.com/sanity-io/sanity-template-kitchen-sink/blob/main/template/web/src/components/Latex.js

And registering it as a type in the serializer

https://github.com/sanity-io/sanity-template-kitchen-sink/blob/497290e200af2daa67f61cd7c7f3f71f5f0edb73/template/web/src/components/serializers.js#L24

rexxars commented 1 year ago

Closing this, as the new @portabletext/react library is the successor to this module. Please see https://github.com/portabletext/react-portabletext