I'm using pandoc on Windows to convert from a
pandoc --wrap none --to markdown_github --output fms.md "FMS.docx"
There is no flag to achieve this, but there is a simple solution using pandoc's filter functionallity. Internally, list items are represented as a list of blocks; a list is compact if all block items only consist of
Plain blocks. If all items consist of only a single paragraph, then it is sufficient to change the type of the item block from
Para (for paragraph) to
The Haskell program below does just that. Safe it and use it as a filter:
pandoc -t markdown --filter the-filter.hs your-document.docx
import Text.Pandoc.JSON main = toJSONFilter compactifyList compactifyList :: Block -> Block compactifyList blk = case blk of (BulletList items) -> BulletList $ map compactifyItem items (OrderedList attrbs items) -> OrderedList attrbs $ map compactifyItem items _ -> blk compactifyItem :: [Block] -> [Block] compactifyItem [Para bs] = [Plain bs] compactifyItem item = item
The same would also be possible using a Python filter in case Haskell isn't an option. See pandoc's scripting page for details.