Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

For those who didn't know, Zen Coding is a tool for creating html with a same kind of syntax, available for many editors: http://code.google.com/p/zen-coding/


Thanks for the link. Definitely some good inspiration for future versions.

I've never used it, any feedback on their syntax? I was planning on using a `space` instead of a `>` when I do inline hierarchy.

Also, what is zero padding? (`li.item$$$`)

edit: What is the purpose of zero padding?


There are probably several other use-cases, but the one I've run into was where there is a naive implementation of alphabetic sorting (basically character by character sorting), zero padding allows proper numerical sorting to work:

001

002

010

022

Instead of:

1

10

2

22

If you think you might have a thousand items, you'd probably zero pad by 3 digits.

0001

0010

0100

1000

1001

Edit: of course, one area you're guaranteed to have trouble with numerical sorting is when your number is prefixed by a letter. Zero-padding mitigates that problem: M001, M002, M020, M023.


Zen coding syntax is fantastic, it makes generating HTML in my editor a breeze.

Stick to ">". That's the standard CSS for indicating a child element.

e.g. "div.myclass > h1" indicates a div with class "myclass" and a child h1 element. In zen, it outputs:

  <div class="myclass">
    <h1></h1>
  </div>
http://www.w3.org/TR/CSS2/selector.html#pattern-matching




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: