Skip to content

Base class format in classes #228

Closed Answered by pawamoy
quattro asked this question in Q&A
Discussion options

You must be logged in to vote

Hello, yes, you can achieve this with Jinja templates! See these two links:

You'd simply override the class.html template to change how bases are displayed. Something like:

{% extends "_base/class.html" %}

{# Append bases at the end of the heading. #}
{% block heading %}
  {{ super() }}
  {%- if config.show_bases and class.bases- %}
    ({%- for expression in class.bases -%}
       <code>{% include "expression.html" with context %}</code>{% if not loop.last %}, {% endif %}
     {% endfor -%})
   {%- endif -%}
{% endblock %}

{# Empty the original "bases" block. #}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pawamoy
Comment options

Answer selected by quattro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
templates: material Related to templates for Material for MkDocs
2 participants