Kaydet (Commit) a2b8b5db authored tarafından Muhammed H. Alkan's avatar Muhammed H. Alkan

Support for markdown.

üst 5004b351
......@@ -52,7 +52,7 @@ def add_page_successful():
"""
if request.method == "POST":
diary_content = request.form["diaryContent"]
new_diary = Diary(content=diary_content)
new_diary = Diary(content=markdown(diary_content))
db.session.add(new_diary)
db.session.commit()
return render_template("add_successful.html")
......
......@@ -34,7 +34,7 @@
<div class="card" style="width: 18rem;">
<div class="card-body">
<h5 class="card-title">Diary {{ diary.id }}</h5>
<p class="card-text">{{ diary.content[:20] }}...</p>
<p class="card-text">{{ diary.content[:20]|striptags|title }}...</p>
<a href="/diaries/{{ diary.id }}" class="card-link">Read more</a>
<p class="card-text"><small class="text-muted">Posted at {{ diary.date.strftime('%y/%m/%d') }}</small></p>
</div>
......
......@@ -32,7 +32,7 @@
<div class="center">
<h1>Diary {{ diary.id }}</h1>
<p>{{ diary.content }}</p>
{{ diary.content|safe }}
<a href="/" class="text-decoration-none">← Go Back</a>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment