Render News.body as Markdown over the public API
Club staff author body as Markdown in the control panel (help_text now explains the syntax); the public API renders it to sanitized HTML on the way out via news/services.py -- markdown for the conversion, nh3 (Rust/ammonia) to strip anything staff's raw Markdown source might smuggle through (script tags, event handler attributes, javascript: URLs) before it reaches someone else's public website. The control panel's own preview is untouched and still shows the raw source. Excerpt is now derived from the rendered HTML's plain text rather than the raw Markdown source, so syntax like ** or [text](url) doesn't leak into what's meant to be a short teaser.
This commit is contained in:
@@ -15,6 +15,8 @@ dependencies = [
|
||||
"django-storages[s3]>=1.14.6",
|
||||
"django-waffle>=5.0.0",
|
||||
"gunicorn>=26.0.0",
|
||||
"markdown>=3.10.3",
|
||||
"nh3>=0.3.6",
|
||||
"openpyxl>=3.1.5",
|
||||
"pillow>=12.3.0",
|
||||
"psycopg[binary]>=3.3.4",
|
||||
|
||||
Reference in New Issue
Block a user