angrybeanie_wagtail/env/lib/python3.12/site-packages/wagtail/utils/text.py

8 lines
233 B
Python
Raw Permalink Normal View History

2025-07-25 21:32:16 +10:00
from bs4 import BeautifulSoup
from django.utils.encoding import force_str
def text_from_html(val):
# Return the unescaped text content of an HTML string
return BeautifulSoup(force_str(val), "html.parser").getText().strip()