From ff262f1f02ba6e1658d898b2b776a330b3b66ff0 Mon Sep 17 00:00:00 2001 From: Junwei Zhao Date: Tue, 5 Nov 2024 22:45:33 +1100 Subject: [PATCH] Update style for newsletter --- data/db.sqlite3 | Bin 204800 -> 204800 bytes docker.sh | 2 +- links/templates/links/custom_link.html | 73 +------------- links/templates/links/newsletter_detail.html | 18 +--- static/css/markdown.css | 98 +++++++++++++++++++ 5 files changed, 105 insertions(+), 86 deletions(-) create mode 100644 static/css/markdown.css diff --git a/data/db.sqlite3 b/data/db.sqlite3 index e75fb7fa9fdef7200f14b77ca75721a8fe4e887b..caf6002322b29ede55d4df6457c69f5ba9d2c032 100644 GIT binary patch delta 189 zcmZoTz|(MmXM!~2>4`GVjHfpyi0U(1G?(dbFVko2yTEMDadj#?Q#K37caE!@6&2z+ zTof!=7#x|542(>44Gnb-Oce|btxSN(RL|5L2+bI#Dwt!cFgCL?G}N;&H!(IfV3@jH zl9TB*8?!mz;_2)HOpz>ntN0dgPY__T=i_5zW@2QRY5}3lw{MhV`tx51*%C8TV-o}R K?fd1J9T@?O{4S{g delta 98 zcmV-o0Gr&;vCI8I=bDYqKFBrwF$h z2?FZ|12qn@mj@66S+`^m0zVFspc1#S9s>OT5;7n%GCDFbIy5ydF)}eVHZ}#fza9fY E0U#+IjsO4v diff --git a/docker.sh b/docker.sh index 473fabd..759e364 100755 --- a/docker.sh +++ b/docker.sh @@ -26,7 +26,7 @@ case "$1" in docker-compose build ;; "shell") - docker-compose exec web uv run manage.py shell + docker-compose exec web bash ;; "migrate") docker-compose exec web uv run manage.py makemigrations diff --git a/links/templates/links/custom_link.html b/links/templates/links/custom_link.html index 7ed320a..ae9d361 100644 --- a/links/templates/links/custom_link.html +++ b/links/templates/links/custom_link.html @@ -1,3 +1,4 @@ +{% load static %} @@ -6,79 +7,11 @@ {{ link.alias }} - +
-
+
{{ rendered_text|safe }}
diff --git a/links/templates/links/newsletter_detail.html b/links/templates/links/newsletter_detail.html index a74de17..235cdff 100644 --- a/links/templates/links/newsletter_detail.html +++ b/links/templates/links/newsletter_detail.html @@ -1,22 +1,10 @@ {% extends 'base.html' %} {% load i18n %} {% load markdown_extras %} +{% load static %} {% block extra_css %} - + {% endblock %} {% block content %} @@ -61,7 +49,7 @@
-
+
{{ newsletter.content|markdown|safe }}
diff --git a/static/css/markdown.css b/static/css/markdown.css new file mode 100644 index 0000000..ccab665 --- /dev/null +++ b/static/css/markdown.css @@ -0,0 +1,98 @@ +.prose { + color: #374151; + max-width: none; +} +.prose p { + margin-top: 1.25em; + margin-bottom: 1.25em; +} +.prose a { + color: #2563eb; + text-decoration: underline; +} +.prose strong { + font-weight: 600; +} +.prose ul { + margin-top: 1.25em; + margin-bottom: 1.25em; + list-style-type: disc; + padding-left: 1.625em; +} +.prose ol { + margin-top: 1.25em; + margin-bottom: 1.25em; + list-style-type: decimal; + padding-left: 1.625em; +} +.prose h1 { + font-size: 2.25em; + margin-top: 0; + margin-bottom: 0.8888889em; + line-height: 1.1111111; + font-weight: 600; +} +.prose h2 { + font-size: 1.5em; + margin-top: 2em; + margin-bottom: 1em; + line-height: 1.3333333; + font-weight: 600; +} +.prose h3 { + font-size: 1.25em; + margin-top: 1.6em; + margin-bottom: 0.6em; + line-height: 1.6; + font-weight: 600; +} +.prose img { + margin-top: 2em; + margin-bottom: 2em; +} +.prose code { + color: #111827; + font-weight: 600; + background-color: #f3f4f6; + padding: 0.2em 0.4em; + border-radius: 0.375rem; + font-size: 0.875em; +} +.prose pre { + color: #e5e7eb; + background-color: #1f2937; + overflow-x: auto; + font-size: 0.875em; + line-height: 1.7142857; + margin-top: 1.7142857em; + margin-bottom: 1.7142857em; + border-radius: 0.375rem; + padding: 1em; +} +.prose pre code { + background-color: transparent; + color: inherit; + padding: 0; +} +.prose blockquote { + font-style: italic; + border-left: 4px solid #e5e7eb; + padding-left: 1em; + margin: 1.25em 0; +} +.prose table { + width: 100%; + border-collapse: collapse; + margin: 2em 0; +} +.prose table th { + background-color: #f3f4f6; + font-weight: 600; + text-align: left; + padding: 0.5em; + border: 1px solid #e5e7eb; +} +.prose table td { + padding: 0.5em; + border: 1px solid #e5e7eb; +}