diff --git a/README.md b/README.md index 31f6ccc..21312bf 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Show off your favorite public threads! $ . .venv/bin/activate # install dependencies - (.venv)$ python -m pip install flask requests + (.venv)$ python -m pip install flask requests markdown # rejoice! ``` diff --git a/templates/threads.html b/templates/threads.html index 42f871d..24a888f 100644 --- a/templates/threads.html +++ b/templates/threads.html @@ -64,6 +64,13 @@ & .body { + & code { + background: rgb(245, 242, 240); + padding: 0.25em 0.3em; + border-radius: 5px; + display: inline; + } + & .media, & .link_card { border: 1px solid rgba(34, 34, 34, 0.15); border-radius: 5px; diff --git a/threads.py b/threads.py index a6dfbe1..faa71d0 100755 --- a/threads.py +++ b/threads.py @@ -1,6 +1,7 @@ from flask import Blueprint, render_template import requests import datetime +import markdown threads = Blueprint('threads', __name__, template_folder='template') @@ -85,6 +86,7 @@ def clean_author(account): def clean_status(status): clean = clean_dict(status, ['id', 'content', 'created_at', 'url', 'media_attachments', 'card']) clean['account'] = clean_author(status['account']) + clean['content'] = markdown.markdown("
"+ clean['content'] +"
", extensions=['md_in_html']) for emoji in status['emojis']: clean['content'] = clean['content'].replace(":" + emoji['shortcode'] + ":", '' + emoji['shortcode'] + ' emoji') return clean