Sorry, I think I read too quickly. I was under the impression your problem was getting the text output as markdown, and I missed the part where you're using the command line. According to
the manual, the relevant option would probably be formatting-type. You should probably also double-check your options for TOC creation.