HTML is the right way to go, however, the <hat> tag is HTML 5 whereas yEd supports only HTML 3.2. Thus you need to use the appropriate entity instead of a tag:
<html><head></head><body><p>
x-bar = x̄ or x̄
<br>
p-hat = p̂ or p̂
</p></body></html>