Skip to content

Commit

Permalink
Add async labels to ToC
Browse files Browse the repository at this point in the history
  • Loading branch information
EvieePy committed Mar 18, 2024
1 parent 30105c8 commit 1af7632
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions docs/stylesheets/extra.css
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,15 @@
.doc-symbol-method::after {
content: "def";
}

.pythonista-toc-label {
font-weight: 200;
}

.toc-label-async {
color: #f7b900ee;
padding: 0 0.3em;
}
}

::-webkit-scrollbar {
Expand Down
4 changes: 3 additions & 1 deletion docs/templates/python/material/function.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@

{% set function_name = function.path if show_full_path else function.name %}
{% set symbol_type = "method" if function.parent.is_class else "function" %}
{% set label = "async" if "async" in function.labels|sort else "" %}


{% if not root or config.show_root_heading %}
{% filter heading(
heading_level,
role="function",
id=html_id,
class="doc doc-heading",
toc_label=(('<code class="doc-symbol doc-symbol-toc doc-symbol-' + symbol_type + '"></code>&nbsp;')|safe if config.show_symbol_type_toc else '') + function.name,
toc_label=(('<span class="pythonista-toc-label toc-label-async">' + label + '</span>' if label == "async" else "")|safe + ('<code class="doc-symbol doc-symbol-toc doc-symbol-' + symbol_type + '"></code>&nbsp;')|safe if config.show_symbol_type_toc else '') + function.name,
) %}

{% block heading scoped %}
Expand Down

0 comments on commit 1af7632

Please sign in to comment.