Wagtail stores RichText (WYSIWYG) data as HTML-like code, but it's not perfect HTML. In this video we'll explore how to serialize Wagtail's RichText data into proper HTML.
from wagtail.core import blocks
from wagtail.core.templatetags.wagtailcore_tags import richtext
class RichtextBlock(blocks.RichTextBlock):
def get_api_representation(self, value, context=None):
return richtext(value.source)