Search code examples
rubysyntaxhamlmarkupjekyll

inserting blocks of text in haml


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

Solution

  • 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>.