web/_includes/refactor-content.html

28 lines
979 B
HTML
Raw Normal View History

<!--
Refactor the HTML structure.
-->
{% assign _content = include.content %}
<!--
Suroundding the markdown table with '<div class="table-wrapper">. and '</div>'
-->
{% if _content contains '<table>' %}
{% assign _content = _content | replace: '<table>', '<div class="table-wrapper"><table>' %}
{% assign _content = _content | replace: '</table>', '</table></div>' %}
{% assign _content = _content | 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' %}
{% assign _content = _content | replace: '</code></pre></div>', '</code></div>' %}
{% endif %}
{{ _content }}