Sha256: a2de2ce7fab2aa69cf1185286f0f07a14d415644aab2e6c11fcdf0578b45ba3a

Contents?: true

Size: 1.52 KB

Versions: 3

Compression:

Stored size: 1.52 KB

Contents

{%- include reset/i18n.liquid -%}

{%- assign shortcodes = "mermaid, warning, note, tip, danger" | split: ", " -%}

{%- if site.debug.shortcodes == false -%}
    {{ content }}
{%- else -%}
    {%- if content contains "<pre" -%}
        {%- assign content_blocks = content | split: "<pre" -%}
        {%- for content_block in content_blocks -%}
            {%- if content_block contains "</pre>" -%}
                {%- assign pre_blocks = content_block | split: "</pre>" -%}
                {%- if content_block contains '><code class="language-' -%}
                    {%- comment %} shortcodes: <pre><code class="language-**"> {% endcomment -%}
                    {%- assign custom = content_block | replace_first: '><code class="language-', "" | replace_first: '">', "<temp/>" | split: "<temp/>" -%}
                    {%- assign lang   = custom.first -%}
                    {%- assign codes  = custom.last | split: "</code>" | first -%}
                    {%- if shortcodes contains lang -%}
                        {%- include shortcodes/{{ lang }}.liquid -%} {{- pre_blocks.last -}}
                    {%- else -%}
                        <pre{{ pre_blocks.first }}</pre> {{ pre_blocks.last }}
                    {%- endif -%}
                {%- else -%}
                    <pre{{ pre_blocks.first }}</pre> {{ pre_blocks.last -}}
                {%- endif -%}
            {%- else -%}
                {{- content_block -}}
            {%- endif -%}
        {%- endfor -%}
    {%- else -%}
        {{- content -}}
    {%- endif -%}
{%- endif -%}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jekyll-rtd-theme-2.0.9 _layouts/tasks/shortcodes.liquid
jekyll-rtd-theme-2.0.8 _layouts/tasks/shortcodes.liquid
jekyll-rtd-theme-2.0.7 _layouts/plugins/shortcodes.liquid