DocBook to Markdown
Convert docbook to markdown with pandoc. Runs entirely on your device.
Runs on your device. The file is never uploaded.
DocBook to Markdown reads a DocBook XML file and writes Markdown, program listings becoming fenced code and DocBook tables becoming Markdown tables. The file has to parse as XML: one unclosed tag stops pandoc, and you see the first line of its message. Element roles and profiling attributes flatten away, since Markdown cannot hold them.
Questions
My document is split with XIncludes. Will they be resolved?
No. The tool passes pandoc the single file you drop, so an XInclude or an external entity reference points at something pandoc cannot open, and that content does not appear in the Markdown. Flatten the document into one XML file with your own toolchain first, then convert the flattened file.
Does the file need to be valid XML?
It needs to parse. Pandoc reads DocBook as XML, so an unclosed tag or a stray ampersand stops the conversion, and the page shows the first line of pandoc's error. Validation against the DocBook DTD or schema is a separate matter; pandoc simply ignores elements it does not recognise.
What happens to program listings, tables and images?
Program listings become fenced code blocks, DocBook tables become Markdown tables, and image references become Markdown image links carrying the same file names. The image data is never read, so keep the picture files at those paths next to the Markdown.
Which Markdown dialect is the output?
Pandoc's extended Markdown, which has table, footnote and definition list syntax that strict CommonMark does not. DocBook is a much richer format than Markdown, so semantic markup with no Markdown equivalent, element roles and profiling attributes for instance, is flattened away rather than preserved.
How do I convert Markdown to DocBook?
Use Markdown to DocBook. It writes DocBook 4 section elements with no XML declaration or article wrapper, and names the file with a .dbk extension. This tool's output is your file name with .md instead. Neither direction is a round trip to trust blindly, because DocBook can express far more than Markdown, so read the result before it replaces your source.