{% assign _content = include.content %} {% if _content contains '
', ''
| replace: '
' %} {% assign _content = _content | replace: '', '' %} {% endif %} {% if _content contains '', '' | replace: '', '' %} {% endif %} {% assign IMG_TAG = '' | first %} {% assign _right = _img_snippet | remove: _left %} {% unless _left contains 'src=' %} {% continue %} {% endunless %} {% assign _left = _left | remove: ' /' | replace: ' w=', ' width=' | replace: ' h=', ' height=' %} {% assign _attrs = _left | split: '" ' %} {% assign _src = null %} {% assign _lqip = null %} {% assign _class = null %} {% for _attr in _attrs %} {% unless _attr contains '=' %} {% continue %} {% endunless %} {% assign _pair = _attr | split: '="' %} {% capture _key %}{{ _pair | first }}{% endcapture %} {% capture _value %}{{ _pair | last | remove: '"' }}{% endcapture %} {% case _key %} {% when 'src' %} {% assign _src = _value %} {% when 'lqip' %} {% assign _lqip = _value %} {% when 'class' %} {% assign _class = _value %} {% endcase %} {% endfor %} {% if _class %} {% capture _old_class %}class="{{ _class }}"{% endcapture %} {% assign _left = _left | remove: _old_class %} {% endif %} {% assign _final_src = null %} {% assign _lazyload = true %} {%- capture _img_url -%} {% include img-url.html src=_src img_path=page.img_path %} {%- endcapture -%} {% assign _path_prefix = _img_url | remove: _src %} {% unless _src contains '//' %} {% assign _final_src = _path_prefix | append: _src %} {% assign _src_alt = 'src="' | append: _path_prefix %} {% assign _left = _left | replace: 'src="', _src_alt %} {% endunless %} {% if _lqip %} {% assign _lazyload = false %} {% assign _class = _class | append: ' blur' %} {% unless _lqip contains 'data:' %} {% assign _lqip_alt = 'lqip="' | append: _path_prefix %} {% assign _left = _left | replace: 'lqip="', _lqip_alt %} {% endunless %} {% assign _left = _left | replace: 'src=', 'data-src=' | replace: ' lqip=', ' data-lqip="true" src=' %} {% else %} {% assign _class = _class | append: ' shimmer' %} {% endif %} {% if _lazyload %} {% assign _left = _left | append: ' loading="lazy"' %} {% endif %} {% if page.layout == 'home' %} {% assign _wrapper_start = '
' %} {% assign _img_content = _img_content | append: _wrapper_start %} {% assign _right = _right | prepend: '>` is wrapped by `` --> {% assign _parent = _right | slice: 1, 4 %} {% if _parent == '' %} {% assign _size = _img_content | size | minus: 1 %} {% capture _class %} class="img-link{% unless _lqip %} shimmer{% endunless %}" {% endcapture %} {% assign _img_content = _img_content | slice: 0, _size | append: _class | append: '>' %} {% else %} {% assign _wrapper_start = _final_src | default: _src | prepend: '' %} {% assign _img_content = _img_content | append: _wrapper_start %} {% assign _right = '> {% assign _img_content = _img_content | append: IMG_TAG | append: _left | append: _right %} {% endfor %} {% if _img_content %} {% assign _content = _img_content %} {% endif %} {% endif %} {% if _content contains '' %} {% assign _code_spippets = _content | split: '
' %} {% assign _new_content = '' %} {% for _snippet in _code_spippets %} {% if forloop.last %} {% assign _new_content = _new_content | append: _snippet %} {% else %} {% assign _left = _snippet | split: '><' | last %} {% if _left contains 'file="' %} {% assign _label_text = _left | split: 'file="' | last | split: '"' | first %} {% assign _label_icon = 'far fa-file-code fa-fw' %} {% else %} {% assign _lang = _left | split: 'language-' | last | split: ' ' | first %} {% capture _label_text %}{% include language-alias.html language=_lang %}{% endcapture %} {% assign _label_icon = 'fas fa-code fa-fw small' %} {% endif %} {% capture _label %} {% endcapture %} {% assign _new_content = _new_content | append: _snippet | append: '
' | append: _label | append: '' | append: '' %} {% endif %} {% endfor %} {% assign _content = _new_content %} {% endif %} {% assign heading_levels = '2,3,4,5' | split: ',' %} {% assign _heading_content = _content %} {% for level in heading_levels %} {% assign mark_start = '
' %} {% assign left = snippet | split: mark_end | first %} {% assign right = snippet | slice: left.size, snippet.size %} {% assign left = left | replace_first: '">', '">' | append: '' %} {% assign _new_content = _new_content | append: mark_start | append: left | append: anchor | append: right %} {% endfor %} {% assign _heading_content = _new_content %} {% endif %} {% endfor %} {% assign _content = _heading_content %} {{ _content }}