Skip to content

Commit f87b861

Browse files
committed
Update Wagtail and wagtail-markdown
1 parent 737dc62 commit f87b861

3 files changed

Lines changed: 12 additions & 16 deletions

File tree

requirements.txt

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ billiard==4.2.4
4848
# via celery
4949
black==26.5.1
5050
# via -r ./requirements.in
51-
bleach==4.1.0
52-
# via wagtail-markdown
5351
boto3==1.42.41
5452
# via
5553
# -r ./requirements.in
@@ -196,7 +194,7 @@ django-import-export==4.4.0
196194
# via -r ./requirements.in
197195
django-js-asset==3.1.2
198196
# via django-mptt
199-
django-modelcluster==6.4.1
197+
django-modelcluster==6.5
200198
# via wagtail
201199
django-mptt==0.14.0
202200
# via -r ./requirements.in
@@ -341,14 +339,16 @@ mistletoe==1.5.1
341339
# via -r ./requirements.in
342340
model-bakery==1.23.2
343341
# via -r ./requirements.in
344-
modelsearch==1.1.1
342+
modelsearch==1.3.1
345343
# via wagtail
346344
multidict==6.7.1
347345
# via
348346
# aiohttp
349347
# yarl
350348
mypy-extensions==1.1.0
351349
# via black
350+
nh3==0.3.6
351+
# via wagtail-markdown
352352
nodeenv==1.10.0
353353
# via pre-commit
354354
numpy==2.4.2
@@ -367,7 +367,6 @@ openpyxl==3.1.5
367367
packaging==26.0
368368
# via
369369
# black
370-
# bleach
371370
# django-haystack
372371
# django-test-plus
373372
# ghapi
@@ -508,7 +507,6 @@ setuptools==80.10.2
508507
# via fs
509508
six==1.17.0
510509
# via
511-
# bleach
512510
# django-bakery
513511
# fs
514512
# python-dateutil
@@ -590,16 +588,14 @@ vine==5.1.0
590588
# kombu
591589
virtualenv==20.36.1
592590
# via pre-commit
593-
wagtail==7.3
591+
wagtail==7.4.2
594592
# via
595593
# -r ./requirements.in
596594
# wagtail-markdown
597-
wagtail-markdown==0.13.0
595+
wagtail-markdown==0.14.1
598596
# via -r ./requirements.in
599597
wcwidth==0.5.3
600598
# via prompt-toolkit
601-
webencodings==0.5.1
602-
# via bleach
603599
wheel==0.46.3
604600
# via -r ./requirements.in
605601
whitenoise==6.11.0

versions/templatetags/whats_new_extras.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import re
22

3-
import bleach
3+
import nh3
44
from django import template
55
from django.utils.html import escape
66
from django.utils.safestring import mark_safe
@@ -12,7 +12,7 @@
1212
# same position — e.g. `a**b**c` stays a code span, the inner ** is not bolded.
1313
_INLINE_RE = re.compile(r"`([^`]+)`|\*\*([^*]+?)\*\*")
1414

15-
# The only tags inline_markdown is allowed to emit. bleach (already a project
15+
# The only tags inline_markdown is allowed to emit. nh3 (already a project
1616
# dependency via wagtail-markdown) is the source of truth for this allowlist.
1717
_ALLOWED_TAGS = ["code", "strong"]
1818

@@ -30,10 +30,10 @@ def inline_markdown(value):
3030
Scoped to what `WHATS_NEW_SYSTEM_PROMPT` permits in description bullets:
3131
code identifiers in single backticks and double-asterisk bold. The input is
3232
escaped first so raw markup becomes inert text, the two permitted spans are
33-
converted, then `bleach.clean` enforces the allowlist on the result.
33+
converted, then `nh3.clean` enforces the allowlist on the result.
3434
"""
3535
if not value:
3636
return ""
3737
html = _INLINE_RE.sub(_replace_span, escape(value))
38-
cleaned = bleach.clean(html, tags=_ALLOWED_TAGS, attributes={}, strip=True)
38+
cleaned = nh3.clean(html, tags=_ALLOWED_TAGS, attributes={}, strip=True)
3939
return mark_safe(cleaned)

versions/tests/test_templatetags.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def test_inline_markdown_does_not_bold_inside_code_span():
6464
assert inline_markdown("`a**b**c`") == "<code>a**b**c</code>"
6565

6666

67-
def test_inline_markdown_strips_disallowed_tags_via_bleach():
68-
"""bleach enforces the <code>/<strong> allowlist; an unescaped angle
67+
def test_inline_markdown_strips_disallowed_tags_via_nh3():
68+
"""nh3 enforces the <code>/<strong> allowlist; an unescaped angle
6969
bracket inside a bold span is neutralized without dropping content."""
7070
assert inline_markdown("**a<b** test") == "<strong>a&lt;b</strong> test"

0 commit comments

Comments
 (0)