# Path: blog/markup.py
# def markup(text: str) -> str:
#     """
#     Mark up plain text into fancy HTML.
# 
#     """
#     return typogrify(
#         markdown(
#             text,
#             output_format="html5",
#             extensions=["abbr", "codehilite", "fenced_code", "sane_lists"],
#         )
#     )


import datetime
from django.conf import settings
from django.db import models
from django.urls import reverse
from .markup import markup
        (HIDDEN_STATUS, "Hidden"),
    )

    author = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
    pub_date = models.DateTimeField("Date posted", default=datetime.datetime.now)
    updated_date = models.DateTimeField(blank=True, editable=False)
    slug = models.SlugField(unique_for_date="pub_date")
    status = models.IntegerField(choices=STATUS_CHOICES, default=LIVE_STATUS)
    title = models.CharField(max_length=250)

    body = models.TextField()
    body_html = models.TextField(editable=False, blank=True)

    excerpt = models.TextField(blank=True, null=True)
    excerpt_html = models.TextField(editable=False, blank=True, null=True)

    categories = models.ManyToManyField("Category")

    live = LiveEntryManager()
    objects = models.Manager()

    class Meta:
        get_latest_by = "pub_date"
        ordering = ("-pub_date",)
        verbose_name_plural = "Entries"

    def __str__(self) -> str:
        return self.title

    def save(self, *args, **kwargs):

# Path: blog/markup.py
# def markup(text: str) -> str:
#     """
#     Mark up plain text into fancy HTML.
# 
#     """
#     return typogrify(
#         markdown(
#             text,
#             output_format="html5",
#             extensions=["abbr", "codehilite", "fenced_code", "sane_lists"],
#         )
#     )


# Path: blog/models.py
import datetime
from django.conf import settings
from django.db import models
from django.urls import reverse
from .markup import markup

        (HIDDEN_STATUS, "Hidden"),
    )

    author = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
    pub_date = models.DateTimeField("Date posted", default=datetime.datetime.now)
    updated_date = models.DateTimeField(blank=True, editable=False)
    slug = models.SlugField(unique_for_date="pub_date")
    status = models.IntegerField(choices=STATUS_CHOICES, default=LIVE_STATUS)
    title = models.CharField(max_length=250)

    body = models.TextField()
    body_html = models.TextField(editable=False, blank=True)

    excerpt = models.TextField(blank=True, null=True)
    excerpt_html = models.TextField(editable=False, blank=True, null=True)

    categories = models.ManyToManyField("Category")

    live = LiveEntryManager()
    objects = models.Manager()

    class Meta:
        get_latest_by = "pub_date"
        ordering = ("-pub_date",)
        verbose_name_plural = "Entries"

    def __str__(self) -> str:
        return self.title

    def save(self, *args, **kwargs):

        self.body_html = markup(self.body)