From 214a3b14faf5c6bdae66f83b1b5ebb9761cd4248 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Tue, 18 Aug 2020 10:30:58 +0200 Subject: [PATCH] Improve codeblocks style --- articles/models.py | 4 +++- articles/static/style.css | 17 +++++++++++++++-- articles/templates/articles/base.html | 2 +- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/articles/models.py b/articles/models.py index abf4b26..224de0b 100644 --- a/articles/models.py +++ b/articles/models.py @@ -60,7 +60,9 @@ class Article(models.Model): return html.split("")[0] def get_formatted_content(self): - md = markdown.Markdown(extensions=["extra", CodeHiliteExtension(linenums=True)]) + md = markdown.Markdown( + extensions=["extra", CodeHiliteExtension(linenums=False)] + ) content = self.content content = re.sub(r"(\s)#(\w+)", r"\1\#\2", content) return md.convert(content) diff --git a/articles/static/style.css b/articles/static/style.css index 8b97a43..6f1e20d 100644 --- a/articles/static/style.css +++ b/articles/static/style.css @@ -4,7 +4,7 @@ --main2: #575757; /*--main3: #7d7d7d;*/ --background: #ffffff; - /*--background2: #f7f7f7;*/ + --background2: #f7f7f7; } html { @@ -79,6 +79,19 @@ a:hover, a:focus { justify-content: space-between; } +code { + white-space: pre-wrap; +} + +.codehilite { + border-radius: .5ex; + background-color: var(--background2); +} + +.codehilite pre { + padding: 1em; +} + @media (prefers-color-scheme: dark) { :root { --accent: #226997; @@ -86,7 +99,7 @@ a:hover, a:focus { --main2: #cecece; /*--main3: #b1b1b1;*/ --background: #111111; - /*--background2: #575656;*/ + --background2: #282828; } img { diff --git a/articles/templates/articles/base.html b/articles/templates/articles/base.html index 094587f..a21fe85 100644 --- a/articles/templates/articles/base.html +++ b/articles/templates/articles/base.html @@ -5,9 +5,9 @@ {% block title %}Home{% endblock %} | Gab's Notes - +