diff --git a/app.py b/app.py index bc16091..bf2f838 100644 --- a/app.py +++ b/app.py @@ -72,6 +72,7 @@ from core.shared import noindex from core.shared import paginated_query from utils.blacklist import is_blacklisted from utils.emojis import EMOJIS +from utils.highlight import HIGHLIGHT_CSS from utils.key import get_secret_key from utils.template_filters import filters @@ -153,6 +154,7 @@ def inject_config(): else 0, me=ME, base_url=config.BASE_URL, + highlight_css=HIGHLIGHT_CSS, ) diff --git a/requirements.txt b/requirements.txt index 3e81189..5c0a865 100644 --- a/requirements.txt +++ b/requirements.txt @@ -24,3 +24,4 @@ pyyaml pillow emoji-unicode html5lib +Pygments diff --git a/templates/layout.html b/templates/layout.html index a71eab7..be29498 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -21,6 +21,7 @@ width: 25px; height: 25px; } +{{ highlight_css }} {% block headers %}{% endblock %} diff --git a/templates/utils.html b/templates/utils.html index caeace5..10a2303 100644 --- a/templates/utils.html +++ b/templates/utils.html @@ -77,7 +77,7 @@ {% if obj | has_type(['Article', 'Page']) %} {{ obj.name }} {{ obj | url_or_id | get_url }} {% elif obj | has_type('Question') %} - {{ obj.content | clean | replace_custom_emojis(obj) | safe }} + {{ obj.content | clean | replace_custom_emojis(obj) | code_highlight | safe }}