{# The aim of this file is to provide a way to create a multi-languages tabbed code block. You'll need to separate each code-block with a --- tag. You'll also need to provide a list of strings that'll be displayed in the tabs.
Example:
{% fenced_code_tab(tabs=["rust", "C", "java"]) %}
println!("Hello World!");
prinf("Hello World!\n");
system.out.println("Hello World!");
{% end %}") }}
#}
{% if tabs is not defined %} {{ throw(message="You did not provide any tab name") }} {% endif %}
{% set body = body | markdown | split(pat="
") %}
{% if tabs | length != body | length %} {{ throw(message="You must provide as much tabs name as there is code blocks") }} {% endif %}
{%- for i in range(end=tabs | length) -%} <input name="tab-group-{{ nth }}" type="radio" id="tab-group-{{ nth }}-{{ i }}{{ tabs[i] }}"{% if i == 0 %} checked="checked"{% endif %} class="code-tab" data-lang="{{ tabs[i] }}" aria-controls="tab-group-{{ nth }}-{{ i }}{{ tabs[i] }}-panel" aria-hidden="true" role="tab"
<label for="tab-group-{{ nth }}-{{ i }}{{ tabs[i] }}" class="code-tab-label" data-lang="{{ tabs[i] }}" id="tab-group-{{ nth }}-{{ i }}{{ tabs[i] }}-label"
{{ tabs[i] }}
{%- endfor %}