Vim HTML to Markdown

If you need to remove HTML from documents (or convert basic HTML to Markdown) with Vim below are the main search and replace commands. I’ve been using these to convert stuff from simple html to markdown.

Pandoc is a great tool that can convert html to markdown - but I only want to convert sections in documents - so i’ve been using these Vim command to do the job - simple and works well

:%s/  / /g
:%s/ / /g
:%s/<p \/>/\r/g
:%s/<p >//g
:%s/<\/p >/\r/g

Let me know if you have more Vim commands to strip HTML or convert to Markdown

Note: For more info re the ^M search and replace command refer

Justin Kelly

Justin Kelly

Data Engineeer, Business Analytics, Web Developer, Library Technology specialising in PHP and Tableau

Based in Melbourne, Australia

Feel free to contact me or _justin_kelly