diff --git a/src/small/models/nodes.py b/src/small/models/nodes.py index ce84463..50b5f00 100644 --- a/src/small/models/nodes.py +++ b/src/small/models/nodes.py @@ -5,6 +5,7 @@ from typing import List, Union @dataclass class Text: content: str + type: str @dataclass diff --git a/src/small/services/medium_client.py b/src/small/services/medium_client.py index 493abc1..90444ec 100644 --- a/src/small/services/medium_client.py +++ b/src/small/services/medium_client.py @@ -58,7 +58,7 @@ class MediumClient: ) ] else: - children = [Text(content=p["text"])] + children = [Text(content=p["text"].strip(), type=p["type"])] paragraphs.append(Paragraph(children=children)) return Page( diff --git a/src/small/static/css/style.css b/src/small/static/css/style.css index f0e4aa5..c21ffc9 100644 --- a/src/small/static/css/style.css +++ b/src/small/static/css/style.css @@ -72,6 +72,13 @@ article img { margin: 20px 0; } +pre { + background-color: #f4f4f4; + padding: 10px; + border-left: 3px solid #1a73e8; + overflow-x: auto; +} + /* Error Page Styles */ .error-container { text-align: center; diff --git a/src/small/templates/article.html b/src/small/templates/article.html index c374ca7..e92a035 100644 --- a/src/small/templates/article.html +++ b/src/small/templates/article.html @@ -7,15 +7,17 @@

By {{ page.author }} on {{ page.created_at }}

{% for paragraph in page.content %} -

{% for child in paragraph.children %} {% if child.__class__.__name__ == 'Text' %} + <{{ child.type | lower }}> {{ child.content }} + {% elif child.__class__.__name__ == 'Image' %} +

{{ child.alt }} +

{% endif %} {% endfor %} -

{% endfor %}
{% endblock %}