{% comment %}
This fine mess is a workaround for inconsistent values of page.content.
Relevant GH issues are:
https://github.com/jekyll/jekyll-archives/issues/28
https://github.com/jekyll/jekyll/issues/6209
The brief summary is that at the time that this layout is processed,
the various `page` objects may or may not have had their `content`
transformed into html. Those that have not been transformed will
still be in raw markdown, which we can transform to html but not
apply any other filters/plugins for highlighting or eg: octicons.
As a result, we manually test to see if the content looks like
html and apply a simple transformation to markdown, and then
convert any liquid open/close tags to html comments so that
they don't appear in our TOC.
{% endcomment %}
{% if p.content contains '' %}
{% assign p_content = p.content %}
{% else %}
{% assign curlyend = '}' %}
{% assign p_content = p.content | markdownify | replace: "{%", "" %}
{% endif %}
{% include toc.html sanitize=true baseurl=p_url html=p_content %}
{% endif %}
{% endfor %}