Jekyll nomarkdown


Problem

Recently, I tried rendering an img before a script tag on a Jekyll page:

<img />
<script>
  console.log(2 > 1);
</script>

However, what was outputted was:

<p>
  <img />
  <script>
    console.log(2 &gt; 1);
  </script>
</p>

The img and script were wrapped in a p tag and the script contents were escaped.

Solution

It turned out that I needed to stop processing with kramdown and output the content as-is.

Wrapping img with nomarkdown extension solved the issue for me:

{::nomarkdown}
<img />
{:/nomarkdown}
<script>
  console.log(2 > 1);
</script>


Please support this site and join our Discord!