Forgot code block being wrapped for code-copy btn

Should have been in an earlier commit. oops.  Its adapted from Bryce's code which used njk and this is liquid. so set became assign.
This commit is contained in:
Robert McGovern 2023-02-18 23:25:19 +00:00
parent aecb4ae267
commit 02bd9c09d9
1 changed files with 14 additions and 1 deletions

View File

@ -40,7 +40,20 @@ layout: default
</nav> </nav>
</aside> </aside>
{% endif %} {% endif %}
{{ content }}
{% assign Content = content %}
{% assign withoutDivStart = '<pre ' %}
{% assign withDivStart = '<div class="highlight codeblock"><pre ' %}
{% assign withoutDivEnd = '</code></pre>' %}
{% assign withDivEnd = '</code></pre></div>' %}
{% if content contains withoutDivStart %}
{% assign Content = content | replace: withoutDivStart, withDivStart %}
{% assign Content = Content | replace: withoutDivEnd, withDivEnd %}
{% endif %}
{{ Content }}
{% if page.link %}<div><a href="{{ page.link }}" class="btn btn--primary">{{ ui-text[site.locale].ext_link_label | default: "Direct Link" }}</a></div>{% endif %} {% if page.link %}<div><a href="{{ page.link }}" class="btn btn--primary">{{ ui-text[site.locale].ext_link_label | default: "Direct Link" }}</a></div>{% endif %}
</section> </section>