Skip to content
Merged

Code #28

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion blog/post/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
from blog.user.models import User


MARKDOWN_EXTENSIONS = ["markdown.extensions.fenced_code"]


class Post(db.Model):
"""orm model for blog post."""

Expand All @@ -42,7 +45,7 @@ class Post(db.Model):

@property
def markdown(self):
return markdown.markdown(self.content)
return markdown.markdown(self.content, extensions=MARKDOWN_EXTENSIONS)

def __str__(self):
return f"{self.pagetitle}"
1 change: 0 additions & 1 deletion blog/templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
<link rel="stylesheet" href="/static/src/global/vars.css">
<link rel="stylesheet" href="/static/src/global/reboot.css">
<link rel="stylesheet" href="/static/src/global/global.css">

<link rel="stylesheet" href="/static/src/components/header.css">
<link rel="stylesheet" href="/static/src/components/minipost.css">
<link rel="stylesheet" href="/static/src/components/postGroup.css">
Expand Down
11 changes: 7 additions & 4 deletions blog/templates/post.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{% extends "layout.html" %}

{% block styles %}
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.2.0/styles/default.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/styles/github-dark.min.css">

<!-- and it's easy to individually load additional languages -->
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/languages/go.min.js"></script> -->

{% endblock %}

{% block content %}
Expand Down Expand Up @@ -30,7 +34,6 @@ <h1 class="post__title">{{post.pagetitle}}</h1>
{% endblock %}

{% block scripts %}
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.2.0/highlight.min.js"></script>
<script>
hljs.initHighlightingOnLoad(); </script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/highlight.min.js"></script>
<script>hljs.highlightAll();</script>
{% endblock %}