when I transferred the file to my kobo the formatting is correct except that the long lines are simply cut off entirely.
In Preferences->Conversion->Page Setup(tab), select the 'Kobo Reader' as the output profile. You can also do this on a per conversion basis in the conversion settings.
Also take a look HERE
regarding Calibre's markdown support, you can do a lot with it if you're willing put in a little time to pre-edit the txt files.
You could also take a look at Sigil
), which is a graphical tool to edit epubs. It's features are pretty basic, as it's still a baby project. But you can easily apply H2/3 styles to chapter headings (which will also generate a TOC for you), or fix up formatting and such.
Anyway, Welcome to MobileRead forums