Neat!
If I use your tool and "Copy HN-ready" and paste here then it works, but oddly if I then edit the post the formatting is lost.
Also, if I just manually post, starting with a blank line, followed by a couple of lines starting with two spaces (e.g. " aaa", " bbb"), then I'm not getting the <pre> code formatting. Any idea what I might be doing wrong?
foo
aa
bb
.
edit test: Works fine for me, even after multiple edits the formatting stays the same ¯\(ツ)/¯