Haml is a markup and templating language for describing HTML documents using compact, indentation-based syntax.
Instead of writing conventional HTML opening and closing tags, authors describe elements and their nesting through a combination of short identifiers and whitespace. This makes the hierarchy of a template apparent from its layout.
Haml was designed as an alternative to inline templating systems such as ERB. It allows HTML structures and dynamic expressions to coexist without surrounding every element with repetitive markup.
The language follows conventions familiar from CSS selectors. Classes and IDs can be expressed using shorthand syntax, while more complex attributes can be specified separately.
Indentation is significant in Haml. The nesting level of an element determines its position in the generated document, so consistent whitespace is essential when maintaining templates.
Haml also supports embedded expressions and control statements. These can supply dynamic content, conditionally render elements and generate repeated structures from application data.
Filters allow sections of a template to be processed as other kinds of content. This makes it possible to include stylesheets, scripts, plain text and markup handled by compatible external processors.
Haml can be used directly through its template engine or integrated into Ruby on Rails applications, where templates are generally identified by the .haml extension.
This is free and open source software.
Key Features
- Indentation-based HTML document structure.
- Compact syntax for tags and attributes.
- CSS-style class and ID shorthand.
- Dynamic expressions embedded in templates.
- Conditional statements and iteration.
- Attribute hashes and dynamic attribute values.
- Escaped and unescaped expression output.
- Whitespace preservation and removal controls.
- Comments and comments omitted from generated output.
- Filters for processing specialised content blocks.
- Plain-text and escaped-text filters.
- Integration with external markup processors through filters.
- Standalone template rendering.
- Ruby on Rails template integration.
Website: haml.info
Support:
Developer: Hampton Catlin, Natalie Weizenbaum and Takashi Kokubun
License: MIT License
Haml is written in Ruby. Learn Ruby with our recommended free books and free tutorials.
Related Software
| Lightweight Markup Languages | |
|---|---|
| Markdown | Markup language and Text-to-HTML conversion tool |
| MultiMarkdown | Based on Markdown with additional features |
| GitHub Flavored Markdown | For user content on GitHub.com and GitHub Enterprise |
| Markdown Extra | Lightweight markup language based on Markdown |
| AsciiDoc | Presentable text document format for writing articles |
| Textile | Billed as a "humane web text generator" |
| Texy | Text-to-XHTML formatter and converter library |
| Tome | Markup Language and Tool Suite for Authors |
| reStructuredText | Markup Syntax and Parser Component of Docutils |
| Haml | Templating engine for HTML |
| JsonML | Map between XML and JSON |
| TOML | Tom’s Obvious Minimal Language |
| Djot | Light markup language inspired by CommonMark |
| Org-mode | Plain text markup for notes, documents, and workflows |
LinuxLinks helps you discover the best free and open source software for Linux. Explore our extensive collection of recommended applications, including alternatives to popular proprietary software.We also publish software reviews, Linux tutorials, hardware reviews, free programming books and articles covering the wider open source community. Browse our Linux resources to discover more. Know a useful free and open source Linux application we haven't covered? Suggest a program for inclusion. Has your software been featured on LinuxLinks? Display one of our Featured on LinuxLinks badges on your website or GitHub README. |


Please read our Comment Policy before commenting.