# Haml Haml is a templating engine for HTML. It's are designed to make it both easier and more pleasant to write HTML documents, by eliminating redundancy, reflecting the underlying structure that the document represents, and providing elegant, easily understandable, and powerful syntax. ## Using Haml can be used from the command line or as part of a Ruby web framework. The first step is to install the gem: gem install haml After you convert some HTML to Haml, you can run haml document.haml to compile them. For more information on these commands, check out haml --help To install Haml in Rails 2, just add `config.gem "haml"` to `config/environment.rb`. In Rails 3, add `gem "haml"` to your Gemfile instead. and both Haml and Sass will be installed. Views with the `.html.haml` extension will automatically use Haml. To use Haml programatically, check out the [YARD documentation](http://haml-lang.com/docs/yardoc/). ## Formatting The most basic element of Haml is a shorthand for creating HTML: %tagname{:attr1 => 'value1', :attr2 => 'value2'} Contents No end-tag is needed; Haml handles that automatically. If you prefer HTML-style attributes, you can also use: %tagname(attr1='value1' attr2='value2') Contents Adding `class` and `id` attributes is even easier. Haml uses the same syntax as the CSS that styles the document: %tagname#id.class In fact, when you're using the `