web/_includes/refactor-content.html

40 lines
1.2 KiB
HTML
Raw Normal View History

<!--
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>' %}
2020-12-14 10:01:05 +03:00
{% 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">' %}
2020-12-14 10:01:05 +03:00
{% 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 %}
2020-12-14 10:01:05 +03:00
<!-- return -->
{{ _content }}