2

Django questions are pretty common on Stack Overflow. Many of them use Django templates. Django is supported by highlight.js but isn't supported by Stack Exchange. This isn't necessary, but would be very nice to have. Example:

{% if articles|length %}
{% for article in articles %}

{% custom %}

{# Striped table #}
<tr class="{% cycle odd,even %}">
  <td>{{ article|default:"Hi... " }}</td>
  <td {% if article.today %}class="today"{% endif %}>
    Published on {{ article.date }}
  </td>
</tr>

{% endfor %}
{% endif %}

Example

5
  • 1
    Having it available sounds useful, but due to a bug in the implementation, it probably shouldn't be added as a "Code Language" for any tag (not Django), because having multiple tags associated with a highlight language on a single question will result in the highlighter guessing a random language from all of the loaded languages. There are many django/python questions, so that'd be a real concern. It could only be used with deliberate notation: ```django Commented Sep 10, 2022 at 14:49
  • @CertainPerformance I agree. However, I think maybe it should be added as a code language for django-templates, because most of the questions there are about the template engine.
    – pigrammer
    Commented Sep 10, 2022 at 17:32
  • 2
    Of the 18.4k questions with django-templates, there are 6.1k questions also with python, so that's 6.1k questions or so whose auto-highlighting would break Commented Sep 10, 2022 at 17:33
  • @CertainPerformance All right
    – pigrammer
    Commented Sep 11, 2022 at 13:59
  • 1
    @CertainPerformance Even if it could only be used with deliberate notation ```django, I think that would already be a great improvement.
    – djvg
    Commented Oct 17, 2022 at 8:13

0

You must log in to answer this question.

Browse other questions tagged .