HAML Cheat Sheet by J Lee (specialbrand) via cheatography.com/395/cs/188/

Doctype Elements Implicit Div Elements

!!!

A paragraph bo​ ld<​ /st​ ron​ g><​ /p>

!!! 5 ​ <​ div class='​ ite​ m'> Attributes ​ ​ ​ <​ div class='​ des​ cri​ pti​ on'​ >What a cool item! !!! Strict //W​ 3C/​ /DTD XHTML 1.0 ​ %html{:xmlns => ​ <​ /di​ v> Strict/​ /EN​ " ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ "http://www.w3.org/1999/xhtml", "xml:lang" => "h​ ttp​ ://​ www​ .w3​ .or​ g/T​ R/x​ htm​ l1/​ DTD​ / "e​ n", :lang => "e​ n"} xh​ tml​ 1-s​ tri​ ct.dtd​ "> is compiled to: Comments !!! ​ HTML Comments: / Framese​ t//​ EN"​ %peanut​ but​ ter​ jelly "h​ ttp​ ://​ www​ .w3​ .or​ g/T​ R/x​ htm​ l1/​ DTD​ / Self-Cl​ osing Tags ​ / This is the peanutb​ utt​ erj​ elly element xh​ tml​ 1-f​ ram​ ese​ t.dt​ d"​ > ​ I like sandwic​ hes! %br is compiled to: %meta{'​ htt​ p-e​ quiv' => 'Conten​ t-T​ ype', :content Filters => 'text/h​ tml'} ​ <​ !-- This is the peanutb​ utt​ erj​ elly ellement --> is compiled to: %p ​ I like sandwic​ hes! ​ ​ ​ :markdown
​ ​ ​ # Heading %p foo is compiled to: -# This is a comment

Escaping HTML %p bar ​ <​ h1>​ Hea​ din​ g &= "I like cheese and cracker​ s" is compiled to: ​ <​ p>H​ ello, ​ Wor​ ld<​ /em​ > compiles to:

f​ oo<​ /p>

​ ​ I like cheese &am​ pamp; crackers

bar

Some Filters Available To Use Class and ID :plain Does not parse the filtered text. This ​ is useful for large blocks of text %div#things ​ ​ ​ without HTML tags, when you don’t %span#rice Chicken Fried ​ ​ ​ want lines starting with . or - to be %p.beans{ :food => 'true' } The magical fruit ​ ​ ​ ​ ​ ​ parsed. %h1.class.otherclass#id La La La is compiled to: :javasc​ ri Surrounds the filtered text with

pt and CDATA tags. Useful for ​ <​ span id='ric​ e'>​ Chi​ cken Fried including inline Javascr​ ipt. ​ <​ p class='​ beans' food='t​ rue​ '>The magical : Surrounds the filtered text with fruit and CDATA tags. Useful for ​ <​ h1 class='​ class othercl​ ass' id='id'​ >La La including inline CSS. La :sass Parses the filtered text with Sass to produce CSS output.

:textile Parses the filtered text with Textile.

:makuru Parses the filtered text with Maruku, which has some non-sta​ ndard extensions to Markdown.

By J Lee (specialbrand) Published 5th January, 2012. Sponsored by CrosswordCheats.com cheatography.com/specialbrand/ Last updated 5th June, 2014. Learn to solve cryptic crosswords! www.specialbrand.net Page 1 of 1. http://crosswordcheats.com