mirror of
https://github.com/welpo/tabi.git
synced 2025-10-10 23:38:53 +02:00
feat: let extra features be used by sections
Extra features were already compatible with sections so it has been made explicit sections can be used as well.
This commit is contained in:
parent
def4b2d41c
commit
080a1b4b8c
1 changed files with 13 additions and 8 deletions
|
@ -1,8 +1,13 @@
|
|||
{# Quick navigation buttons #}
|
||||
{% if macros_settings::evaluate_setting_priority(setting="quick_navigation_buttons", page=page, default_global_value=false) == "true" %}
|
||||
{%- if page -%}
|
||||
{%- set_global page_or_section = page -%}
|
||||
{%- elif section -%}
|
||||
{%- set_global page_or_section = section -%}
|
||||
{%- endif -%}
|
||||
{% if macros_settings::evaluate_setting_priority(setting="quick_navigation_buttons", page=page_or_section, default_global_value=false) == "true" %}
|
||||
<div id="button-container">
|
||||
{# Button to go show a floating Table of Contents #}
|
||||
{% if page.toc %}
|
||||
{% if page_or_section.toc %}
|
||||
<div id="toc-floating-container">
|
||||
<input type="checkbox" id="toc-toggle" class="toggle"/>
|
||||
<label for="toc-toggle" class="overlay"></label>
|
||||
|
@ -10,7 +15,7 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M414.82-193.094q-18.044 0-30.497-12.32-12.453-12.319-12.453-30.036t12.453-30.086q12.453-12.37 30.497-12.37h392.767q17.237 0 29.927 12.487 12.69 12.486 12.69 30.203 0 17.716-12.69 29.919t-29.927 12.203H414.82Zm0-244.833q-18.044 0-30.497-12.487Q371.87-462.9 371.87-480.45t12.453-29.92q12.453-12.369 30.497-12.369h392.767q17.237 0 29.927 12.511 12.69 12.512 12.69 29.845 0 17.716-12.69 30.086-12.69 12.37-29.927 12.37H414.82Zm0-245.167q-18.044 0-30.497-12.32t-12.453-30.037q0-17.716 12.453-30.086 12.453-12.369 30.497-12.369h392.767q17.237 0 29.927 12.486 12.69 12.487 12.69 30.203 0 17.717-12.69 29.92-12.69 12.203-29.927 12.203H414.82ZM189.379-156.681q-32.652 0-55.878-22.829t-23.226-55.731q0-32.549 23.15-55.647 23.151-23.097 55.95-23.097 32.799 0 55.313 23.484 22.515 23.484 22.515 56.246 0 32.212-22.861 54.893-22.861 22.681-54.963 22.681Zm0-245.167q-32.652 0-55.878-23.134-23.226-23.135-23.226-55.623 0-32.487 23.467-55.517t56.12-23.03q32.102 0 54.721 23.288 22.62 23.288 22.62 55.775 0 32.488-22.861 55.364-22.861 22.877-54.963 22.877Zm-.82-244.833q-32.224 0-55.254-23.288-23.03-23.289-23.03-55.623 0-32.333 23.271-55.364 23.272-23.03 55.495-23.03 32.224 0 55.193 23.288 22.969 23.289 22.969 55.622 0 32.334-23.21 55.364-23.21 23.031-55.434 23.031Z"/></svg>
|
||||
</label>
|
||||
<div class="toc-content">
|
||||
{{ macros_toc::toc(page=page, header=false, language_strings=language_strings) }}
|
||||
{{ macros_toc::toc(page=page_or_section, header=false, language_strings=language_strings) }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
@ -30,13 +35,13 @@
|
|||
{% endif %}
|
||||
|
||||
{# Add KaTeX functionality #}
|
||||
{%- if macros_settings::evaluate_setting_priority(setting="katex", page=page, default_global_value=false) == "true" -%}
|
||||
{%- if macros_settings::evaluate_setting_priority(setting="katex", page=page_or_section, default_global_value=false) == "true" -%}
|
||||
<link rel="stylesheet" href="{{ get_url(path='katex.min.css', trailing_slash=false) | safe }}">
|
||||
<script defer src="{{ get_url(path='js/katex.min.js', trailing_slash=false) | safe }}"></script>
|
||||
{%- endif -%}
|
||||
|
||||
{# Load mermaid.js #}
|
||||
{%- if macros_settings::evaluate_setting_priority(setting="mermaid", page=page, default_global_value=false) == "true" -%}
|
||||
{%- if macros_settings::evaluate_setting_priority(setting="mermaid", page=page_or_section, default_global_value=false) == "true" -%}
|
||||
{%- if config.extra.serve_local_mermaid | default(value=true) -%}
|
||||
<script defer src="{{ get_url(path='js/mermaid.min.js', trailing_slash=false) | safe }}"></script>
|
||||
{%- else -%}
|
||||
|
@ -45,7 +50,7 @@
|
|||
{%- endif -%}
|
||||
|
||||
{# Add copy button to code blocks #}
|
||||
{%- if macros_settings::evaluate_setting_priority(setting="copy_button", page=page, default_global_value=true) == "true" -%}
|
||||
{%- if macros_settings::evaluate_setting_priority(setting="copy_button", page=page_or_section, default_global_value=true) == "true" -%}
|
||||
{#- Add hidden HTML elements with the translated strings for the button's interactions -#}
|
||||
<span id="copy-success" class="hidden">
|
||||
{{ macros_translate::translate(key="copied", default="Copied!", language_strings=language_strings) }}
|
||||
|
@ -57,11 +62,11 @@
|
|||
{%- endif -%}
|
||||
|
||||
{# JavaScript to use the "Show source or path" on code blocks shortcode: https://welpo.github.io/tabi/blog/shortcodes/#show-source-or-path #}
|
||||
{%- if macros_settings::evaluate_setting_priority(setting="add_src_to_code_block", page=page, default_global_value=false) == "true" -%}
|
||||
{%- if macros_settings::evaluate_setting_priority(setting="add_src_to_code_block", page=page_or_section, default_global_value=false) == "true" -%}
|
||||
<script defer src="{{ get_url(path='js/addSrcToCodeBlock.min.js', trailing_slash=false) | safe }}"></script>
|
||||
{%- endif -%}
|
||||
|
||||
{# Add backlinks to footnotes #}
|
||||
{%- if macros_settings::evaluate_setting_priority(setting="footnote_backlinks", page=page, default_global_value=false) == "true" -%}
|
||||
{%- if macros_settings::evaluate_setting_priority(setting="footnote_backlinks", page=page_or_section, default_global_value=false) == "true" -%}
|
||||
<script defer src="{{ get_url(path='js/footnoteBacklinks.min.js', trailing_slash=false | safe )}}"></script>
|
||||
{%- endif -%}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue