Implemented markdown support in the post body to enhance text formatting capabilities. This change allows users to enter markdown in the create/update interface and have it rendered as HTML in the main blog interface. The markdown library was imported and utilized to convert markdown text to HTML in the blog index view. Additionally, updated the form labels to indicate markdown support and ensured safe rendering of HTML content in the blog index template. Issue ID: FLAS-67
28 lines
806 B
HTML
28 lines
806 B
HTML
{% extends 'base.html' %}
|
|
|
|
{% block header %}
|
|
<h1>{% block title %}Today in history{% endblock %}</h1>
|
|
{% if g.user %}
|
|
<a class="action" href="{{ url_for('blog.create') }}">New</a>
|
|
{% endif %}
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
{% for post in posts %}
|
|
<article class="post">
|
|
<header>
|
|
<div>
|
|
<h1>{{ post['title'] }}</h1>
|
|
<div class="about">by {{ post['username'] }} on {{ post['created'].strftime('%Y-%m-%d') }}</div>
|
|
</div>
|
|
{% if g.user['id'] == post['author_id'] %}
|
|
<a class="action" href="{{ url_for('blog.update', id=post['id']) }}">Edit</a>
|
|
{% endif %}
|
|
</header>
|
|
<p class="body">{{ post['body']|safe }}</p>
|
|
</article>
|
|
{% if not loop.last %}
|
|
<hr>
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endblock %}
|