Prevent HTML included in markdowns, further processed by Jekyll?

I work with Jekyll and want to use it {% include... %}to include the HTML fragment in the markup file without further HTML processing, that is, it is then processed by the markup processor, as if it were only built-in HMTL.

Note. I use redcarpet markdown (and not, for example, kramdown).

Can this be handled with a Jekyll plugin?

I created a GitHub md-include-html repository with the following files that demonstrate my problem.

1. _layouts/default.htmlcontains:

<div>
{{ content }}
</div>

2. md-page.mdcontains:

---
layout: default
---
A

{% include_relative html-snippet.html %}

B

3. html-snippet.htmlcontains:

</div>
<!-- Some arbitrary HTML for {{ page.path }} -->
<div>

Note that I am first trying to close the div that will be presented _layouts/default.html, and then open a new div at the end.

_site/md-page.html:

<div>
<p>A</p>

<p></div>
&lt;!-- Some arbitrary HTML for md-page.md --&gt;
<div></p>

, , <p>...</p>.

, , -.

HTML - (. html-page.html ):

{% capture snippet_content %}
{% include_relative md-snippet.md %}
{% endcapture %}
{{ snippet_content | markdownify }}

HTML .

(- Liquid, , ), .

.

A

<markdown-off>{% include_relative html-snippet.html %}</markdown-off>

B

, , , , .

- Jekyll-? , Jekyll, .

+4
2

, , {% raw %} {% endraw %}?

Try

</div>
{% raw}
<!-- Some arbitrary HTML for {{ page.path }} -->
{% endraw %}
<div>

.

, , Liquid {{ page.path }}

0

. include html .md Jekyll. Kramdown, .

<div markdown="0"> !-- some html you don't want processed --> </div>

.

0

All Articles