Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jekyll raw HTML in post

I have a Jekyll website, with Posts written in Markdown using the Kramdown parser.

I would like to add some raw HTML within the post. However when I try to add the HTML, it parses it as markdown (changing <'s to &lt; for example).

I have tried:

  • Adding the HTML in its own paragraph.
  • Including a .html file.
  • Adding markdown="0" to the HTML tag (also tried 1).
  • Indenting (and wrapping in triple back-tick) with all of the above.
  • Using raw tags

Example of what I have:

Some **markdown** `here`

<iframe src="asd"></iframe>

More *markdown*.

The iframe should be output as HTML, not parsed text.

I am using Github pages, so Jekyll extensions are not optional.

like image 384
Marcus Hughes Avatar asked May 14 '15 09:05

Marcus Hughes


People also ask

Can I use HTML in Jekyll?

Your Jekyll pages consist of HTML, CSS, and JavaScript, so pretty much any code you need to embed will work without a problem.

What is raw in HTML?

Raw(Object) Wraps HTML markup in an HtmlString instance so that it is interpreted as HTML markup. Raw(String) Wraps HTML markup in an HtmlString instance so that it is interpreted as HTML markup.

Does Jekyll use Markdown?

By default, Jekyll uses the kramdown Markdown processor with stock settings, but you can enable other kramdown options or even switch Jekyll to another Markdown processor. See the Jekyll Markdown configuration options documentation for more information.


1 Answers

The HTML was being ignored because some tag attr's did not have quotes. For example width=500 should have been width="500"

Nothing else was required. The HTML is in its own paragraphs with no indentation and it is parsed.

like image 151
Marcus Hughes Avatar answered Nov 16 '22 01:11

Marcus Hughes