As Keno pointed out, your writemime needs to actually write the HTML data to the stream, not return it.
The print(foo) function always displays the text/plain MIME type.
If you want to display text/html, assuming you have a writemime method for text/html, you can either:
* use display(foo)
* use display("text/html", foo)
* evaluate a code cell in which foo is the last expression evaluated (and hence is the output value)
Note also that you need
import Base.writemime
before you add a new writemime method.