Tidy can sort attributes or leave them in source document order. However the priority-attributes option can place certain attributes in user-desired order ahead of the sorting mechanism specified by sort-attributes.

The anchor tag below contains several attributes, but the config file for this test indicates that id, style, and class shall be placed first.

You are cool.