How can I write a percent sign (%) at the beginning of a line in HAML?

escaping, haml

Solution

try

\%

maybe..

because it said in http://haml.info/docs/yardoc/file.REFERENCE.html#escaping_ that \ is the escape character

Problem

How can I start a line with a percent in HAML file? This doesn't work: ``` %p = my_ruby_var % ``` === UPDATE === Note: This answer is not accepted. I don't want any ruby to be computed: ``` %p = my_ruby_var = '%' ``` === UPDATE 2 === For info: I discovered in the same doc reference that it is also possible to escape HTML as well: An ampersand followed by one or two equals characters evaluates Ruby code just like the equals without the ampersand, but sanitizes any HTML-sensitive characters in the result of the code. For example: ``` &= "I like cheese & crackers" ``` compiles to ``` I like cheese & crackers ```

Original source