# Haml

To use this language, use the class "language-haml".

## Comments

    / This is comment
        on multiple lines
    / This is a comment
    but this is not
    -# This is another comment
        on multiple lines

## Doctype

    !!! XML
    !!!
    !!! 5

## Tags

    %div
    	%span
    %span(class="widget_#{@widget.number}")
    %div{:id => [@item.type, @item.number], :class => [@item.type, @item.urgency]}
    %html{:xmlns => "http://www.w3.org/1999/xhtml", "xml:lang" => "en", :lang => "en"}
    %html{html_attrs('fr-fr')}
    %div[@user, :greeting]
    %img
    %pre><
      foo
      bar
    %img

## Markup

    %div
      <p id="blah">Blah!</p>

## Inline Ruby

    = ['hi', 'there', 'reader!'].join " "
    - foo = "hello"
    = link_to_remote "Add to cart",
        :url => { :action => "add", :id => product.id },
        :update => { :success => "cart", :failure => "error" }
    ~ "Foo\n<pre>Bar\nBaz</pre>"
    %p
      - case 2
      - when 1
        = "1!"
      - when 2
        = "2?"
      - when 3
        = "3."
    - (42...47).each do |i|
      %p= i
    %p See, I can count!

## Filters

    %head
    	:css
    		#content: {
    			background: url('img/background.jpg');
    		}
    		div {
    			color: #333;
    		}
    	:javascript
    		(function() {
    			var test = "Do you like Prism?";
    			if(confirm(test)) {
    				do_something_great();
    			}
    		}());
    %body

Filters require the desired language to be loaded. On this page, check CoffeeScript before checking Haml should make the example below work properly.

    %script
      :coffee
        console.log 'This is coffee script'