How to convert wordpress to markdown
Convert wordpress export.xml to markdown files
- Wordpress export xml
- convert export.xml to markdown files (no year, no day, no folder for each post, date prefix, not download images)
$ npx wordpress-export-to-markdown
npx: installed 137 in 11.812s
Starting wizard...
? Path to WordPress export file? wordpress.xml
? Path to output folder? output
? Create year folders? No
? Create month folders? No
? Create a folder for each post? No
? Prefix post folders/files with date? Yes
? Save images attached to posts? Yes
? Save images scraped from post body content? Yes
Get pinyin.txt
- print all file title and save as file
title.txt
for f in *;
do sed -n 2p $f; done;
- use vim to remove title line prefix and suffix
- use php-pinyin-converter to convert titles to pinyin
while read -r line; do
php convert.php $line
done < title.txt
- save pinyin titles to file
pinyin.txt
Generate date.txt
- Print all file date
for f in *; do sed -n 3p $f; done;
- use vim to remove date line prefix and suffix
Rename files to pinyin
- rename files to pinyin
i=1;
j=1;
for f in *;
do
mv $f $(sed -n $(echo $i)p ../date)-$(sed -n $(echo $j)p ../out.cv).md
((i=i+1))
((j=j+1));
done