{% assign demo-code = code %}
{% assign demo-code = demo-code | replace_regex: '\{% (end)?hide %\}', '' %}
{% assign demo-code = demo-code | replace_regex: 'href="#"', 'href="javascript:void(0)"' %}

<div class="example no_toc_section{% if include.centered %} example-centered{% endif %}{% if include.columns or include.light %} example-bg{% endif %}">
	<div class="example-content">
		{% if include.max-width %}<div style="max-width: {{ include.max-width }}">{% endif %}
		{% if include.columns %}<div class="example-column example-column-{{ include.columns }}">{% endif %}
		{% if include.modal %}<div class="example-modal-backdrop"></div>{% endif %}
		{% if include.wrapper %}<div class="{{ include.wrapper }}">{% endif %}

		{{ demo-code }}

		{% if include.wrapper %}</div>{% endif %}
		{% if include.columns %}</div>{% endif %}
		{% if include.max-width %}</div>{% endif %}
	</div>
</div>


{% capture html %}
{{ code }}

{% removeemptylines %}
{{ site.captured_global.scripts | last }}
{% endremoveemptylines %}
{% endcapture %}

{% assign html = html | strip %}
{% assign html = html | replace_regex: '// @formatter:(off|on)', '' %}

{% capture new_line %}
{% endcapture %}
{% assign html = html | replace_regex: "\n\n+", new_line %}

{% assign html = html | replace_regex: 'url\(([^\)]+)\)', 'url(...)' %}
{% assign html = html | replace_regex: 'src="([^"]+)"', 'src="..."' %}
{% assign html = html | replace_regex: 'href="([^#][^"]+)"', 'href="#"' %}
{% assign html = html | replace_regex: '\{% hide %\}.*?\{% endhide %\}', '' %}
{% assign html = html | replace_regex: 'class=" ', 'class="' %}

{% assign html = html | htmlbeautifier %}

<div class="example-code">
	{% highlight html %}{{ html }}{% endhighlight %}
</div>
