Browse Source

Add line numbers on code samples

master
Gabriel Augendre 1 week ago
parent
commit
20b2da9cd0
  1. 23
      articles/static/code.css
  2. 1
      articles/templates/articles/base.html
  3. 2
      articles/utils.py

23
articles/static/code.css

@ -0,0 +1,23 @@
.codehilitetable td {
border: none;
margin: 0;
padding: 0;
}
.codehilitetable .linenos {
max-width: 20px;
}
.codehilitetable .linenos pre {
border-right: none;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
padding-right: 0;
}
.codehilitetable .code pre {
border-left: none;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
padding-left: .1rem;
}

1
articles/templates/articles/base.html

@ -19,6 +19,7 @@
<link rel="stylesheet" href="{% static "admonitions.css" %}" type="text/css">
{% if article and article.has_code %}
<link rel="stylesheet" href="{% static "vendor/codehilite.css" %}" type="text/css">
<link rel="stylesheet" href="{% static "code.css" %}" type="text/css">
{% endif %}
{% if user.is_authenticated %}
<link rel="stylesheet" href="{% static "authenticated.css" %}">

2
articles/utils.py

@ -20,7 +20,7 @@ def format_article_content(content):
extensions=[
"extra",
"admonition",
CodeHiliteExtension(linenums=False, guess_lang=False),
CodeHiliteExtension(linenums=True, guess_lang=False),
LazyLoadingImageExtension(),
]
)

Loading…
Cancel
Save