First a page is not just content but can contain metadata (we call the objects or xobjects). Some xobject properties are of type textarea and can contain markup too. So I guess you want to convert them too?
There are plenty of ways to do what you want but it requires a bit of coding:
- Implement a OutputFilterStreamFactory (see https://extensions.xwiki.org/xwiki/bin/view/Extension/Filter%20Module) and then use https://extensions.xwiki.org/xwiki/bin/view/Extension/Filter%20Application or use the script api at https://extensions.xwiki.org/xwiki/bin/view/Extension/Filter%20Script%20API
- Implement a new Exporter by implementing a new URL action (see https://extensions.xwiki.org/xwiki/bin/view/Extension/Resource%20API#HAddinganewResourceTypeHandler) and plug it in te UI (see https://www.xwiki.org/xwiki/bin/view/Documentation/DevGuide/ExtensionPoint/Export%20buttons).
- Simply write some script in a wiki page using something like:
- search for pages to export (for ex by using the Query script service)
- for each page convert its content to MD using the Rendering script service
- for each page save it to disk somewhere (in the tmp directory or the permanent directory for ex)
- Use a “fspath” or “path” EntityReferenceSerializer to find the subdir to output to.
I’ve written a quick groovy script to show you how it can be done, see https://snippets.xwiki.org/xwiki/bin/view/Extension/Export%20pages%20to%20Markdown/