diff --git a/blog/models.py b/blog/models.py index f27cffd6c..10e065a0d 100644 --- a/blog/models.py +++ b/blog/models.py @@ -66,6 +66,7 @@ def to_html(cls, fmt, source): extensions=[ # baselevel matches `initial_header_level` from BLOG_DOCUTILS_SETTINGS TocExtension(baselevel=3, slugify=_md_slugify), + "tables", ], ) raise ValueError(f"Unsupported format {fmt}") diff --git a/blog/tests.py b/blog/tests.py index f67bc7ea1..c4891e1da 100644 --- a/blog/tests.py +++ b/blog/tests.py @@ -159,6 +159,28 @@ def test_pub_date_localized(self): with translation.override("nn"): self.assertEqual(entry.pub_date_localized, "21. juli 2005") + def test_markdown_table_conversion(self): + body = ( + "| Framework | Language |\n" + "|-----------|----------|\n" + "| Django | Python |\n" + "| Flask | Python |" + ) + + entry = Entry.objects.create( + pub_date=self.now, + slug="markdown-table", + body=body, + content_format=ContentFormat.MARKDOWN, + ) + expected_html = ( + "
| Framework | \nLanguage | \n
|---|---|
| Django | \nPython | \n
| Flask | \nPython | \n