inserting blocks of text in haml

Sukima picture Sukima · Aug 27, 2010 · Viewed 12.1k times · Source

In my Jekyll blog I use the include tag to put the contents of a file into the document. However if I attempt to do this with a HAML based document the indentation of the included text is wrong. :preserve does not work because it requires indentation. Is there a way to specify a block of text without depending on indentation?

%html
  %body
    - preserve do
<strong>included text from file</strong>
    - end

Answer

Pavel Strakhov picture Pavel Strakhov · Jan 13, 2013

It seems that in current version of Haml :text filter was removed. Now you can use :plain filter. No processing is performed for the text inside this block. You can paste multiline blocks of text or HTML code there. HTML will appear on the page unescaped.

:plain
  Some text <b>or HTML</b>.