fix rss feed markdown render

This commit is contained in:
Your Name 2023-01-30 17:15:24 -05:00
parent fc7325580c
commit d116e75d15
2 changed files with 5 additions and 4 deletions

View file

@ -1,5 +1,5 @@
from django.contrib.syndication.views import Feed
from markdown import markdown
from journal.renderers import render_md
import mimetypes
from .models import *
from django.conf import settings
@ -33,7 +33,7 @@ class ReviewFeed(Feed):
target_html = (
f'<p><a href="{item.item.absolute_url}">{item.item.title}</a></p>\n'
)
html = markdown(item.body)
html = render_md(item.body)
return target_html + html
# item_link is only needed if NewsItem has no get_absolute_url method.

View file

@ -1,3 +1,4 @@
from typing import cast
import mistune
import re
@ -18,14 +19,14 @@ _mistune_plugins = [
_markdown = mistune.create_markdown(plugins=_mistune_plugins)
def render_md(s):
def render_md(s) -> str:
# s = "\n".join(
# [
# re.sub(r"^(\u2003+)", lambda s: "&emsp;" * len(s[0]), line)
# for line in s.split("\n")
# ]
# )
return _markdown(s)
return cast(str, _markdown(s))
def render_text(s):