In HTML 4.01 and XHTML 1.1 and older:
h1
may contain an a
a
may not contain an h1
So …
In the HTML 5 draft:
h1
may contain an a
a
may contain an h1
(but only if the a
is somewhere an h1
is allowed — see the comments on this answer)So either, but browser support may vary (such is life on the bleeding edge).