{{ require_js(get_asset_url('../../js/code-block.js'),{"type":"module"}) }}

{# Access fields from their groups as defined in fields.json #}
{% set code_snippet = module.content.code_snippet %}
{% set language = module.content.language %}
{% set filename = module.content.filename %}
{% set useLineNumbers = module.style.useLineNumbers %}

<div class="code-block-wrapper">
  {%- if filename -%}
    <div class="code-block-filename">
      <span class="filename-text">{{ filename }}</span>
    </div>
  {%- endif -%}
  <code-block data-line-numbers="{{ useLineNumbers }}" class="{% if filename %}has-filename{% endif %}">
    <code-tab data-label="" data-language="{{ language }}" data-escaped="true">
      {{- code_snippet|escape|escape_jinjava -}}
    </code-tab>
  </code-block>
</div>
