Pandoc is a tool to convert documents from one format to another, but I primarily use it for its powerful pandoc-Markdown dialect.
It works well with Scrivener too.