diff --git a/docker/main/Dockerfile b/docker/main/Dockerfile index 62286c3..4db93cb 100644 --- a/docker/main/Dockerfile +++ b/docker/main/Dockerfile @@ -8,3 +8,5 @@ RUN apt update && apt install -y gettext && rm -rf /var/lib/apt/lists/* COPY requirements.txt /app/ RUN pip install -r requirements.txt COPY . /app/ +RUN mkdir -p /app/static +RUN pygmentize -S nord -f html -a .codehilite > /app/static/codehighlight.css diff --git a/gawa/blog/models.py b/gawa/blog/models.py index eaae681..660e918 100644 --- a/gawa/blog/models.py +++ b/gawa/blog/models.py @@ -14,7 +14,14 @@ EXTENSIONS = [ "meta", "toc" ] -MD = markdown.Markdown(extensions=EXTENSIONS) +EXTENSION_CONFIGS = { + 'codehilite': { + 'linenums': True, + 'pygments_style': 'monokai' + }, +} + +MD = markdown.Markdown(extensions=EXTENSIONS, extension_configs=EXTENSION_CONFIGS) class Category(models.Model): """ @@ -44,6 +51,7 @@ class BlogPost(Searchable): featured = models.BooleanField(default=False) slug = models.SlugField() + # TODO autodiscover new blog posts based on markdown files? def regenerate(self): """ diff --git a/gawa/start/templates/base.html b/gawa/start/templates/base.html index c9b980f..f5105b8 100644 --- a/gawa/start/templates/base.html +++ b/gawa/start/templates/base.html @@ -11,6 +11,8 @@ {% compress css %} + + {% endcompress %}