Export WordPress posts to XML an then convert it into Markdown files suitable for a static site generator such as Gridsome, Gatsby, Hugo, Jekyll, etc.
Step 1. Export WordPress to XML
Navigate to Tools > Export and Select “All Content”

File will be saved as [website].WordPress. [DATE].xml
Step 3. Install NodeJS & Git
Make sure you have Git, NodeJS and NPM installed first
sudo apt install git
sudo apt install nodejs
sudo apt install npm


Step 4. Download the script
download the file from github
git clone https://github.com/lonekorean/wordpress-export-to-markdown

Step 5. Move the file to the same folder
move the exported xml file inside the same folder as the script and rename it to export.xml
mv [website].WordPress. [DATE].xml wordpress-export-to-markdown/export.xml
Step 6. Start the script
run the script
cd wordpress-export-to-markdown
npm install && node index.js
after running the script the wizard will let you configure options

the script will go trough the XML file and output posts as .md files

What’s next when you’ve exported WordPress posts to markup? use them inside a static site such as Gridsome or Gatsby.