Sha256: e398ab3dee1fe3cc940dd61876dc9edd27cc62644784cc3d05faf640a2fd3b17

Contents?: true

Size: 2 KB

Versions: 11

Compression:

Stored size: 2 KB

Contents

<!--
  Refactor the HTML structure.
-->

{% assign _content = include.content %}

<!--
  In order to allow a wide table to scroll horizontally,
  we suround the markdown table with `<div class="table-wrapper">` and `</div>`
-->
{% if _content contains '<table>' %}
  {% assign _content = _content
    | replace: '<table>', '<div class="table-wrapper"><table>'
    | replace: '</table>', '</table></div>'
    | replace: '</table></div></code>', '</table></code>'
  %}
{% endif %}

<!--
  Fixed kramdown code highlight rendering:
  https://github.com/penibelst/jekyll-compress-html/issues/101
  https://github.com/penibelst/jekyll-compress-html/issues/71#issuecomment-188144901
-->
{% if _content contains '<pre class="highlight">' %}
  {% assign _content = _content
    | replace: '<div class="highlight"><pre class="highlight"><code', '<div class="highlight"><code'
    | replace: '</code></pre></div>', '</code></div>'
  %}
{% endif %}

<!-- Add attribute 'hide-bullet' to the checkbox list -->
{% if _content contains '<li class="task-list-item"><' %}
  {% assign _content = _content
    | replace: '"task-list-item"><', '"task-list-item" hide-bullet><'
  %}
{% endif %}

{% if _content contains '<img src="' %}

  {% if site.img_cdn != '' %}
    {% assign img_path_replacement = '<img src="' | append: site.img_cdn | append: '/' %}
  {% else %}
    {% assign img_path_replacement = '<img src="' | append: site.baseurl | append: '/' %}
  {% endif %}

  {% assign _content = _content | replace: '<img src="/', img_path_replacement %}

  <!-- lazy-load images <https://github.com/ApoorvSaxena/lozad.js#usage> -->
  {% assign lozad = true %}
  {% assign img_placehodler
    = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7' %}

  {% assign lozad_replacement = '<img src="'
    | append: img_placehodler
    | append: '" data-src="' %}

  {% assign _content = _content | replace: '<img src="', lozad_replacement %}

{% endif %}

<!-- return -->
{{ _content }}

{% if lozad %}
  {% include lozad.html %}
{% endif %}

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
jekyll-theme-chirpy-3.3.2 _includes/refactor-content.html
jekyll-theme-chirpy-3.3.1 _includes/refactor-content.html
jekyll-theme-chirpy-3.3.0 _includes/refactor-content.html
jekyll-theme-chirpy-3.2.2 _includes/refactor-content.html
jekyll-theme-chirpy-3.2.1 _includes/refactor-content.html
jekyll-theme-chirpy-3.2.0 _includes/refactor-content.html
jekyll-theme-chirpy-3.1.1 _includes/refactor-content.html
jekyll-theme-chirpy-3.1.0 _includes/refactor-content.html
jekyll-theme-chirpy-3.0.3 _includes/refactor-content.html
jekyll-theme-chirpy-3.0.2 _includes/refactor-content.html
jekyll-theme-chirpy-3.0.1 _includes/refactor-content.html