Wikipedia to Markdown

When I begin researching a topic I often start by reading WikiPedia. Unfortunately there is no direct download in Markdown format which is used in many programs I use. On MacOS some simple commands can be used to achieve this goal – sorry no automatic procedure. You need pandoc installed to do the main work and a simple sed command to make the links work (here for the German wikipedia version). Assuming you have downloaded the source (available at “Edit”) to a file you can use this:


1. pandoc -f mediawiki -t markdown source > source.md
2. sed -E 's/\(([a-zA-Z0-9_\-\.]+) "wikilink"/\(https:\/\/de.wikipedia.org\/wiki\/\1/g' < source.md > target.md

Took me some time to figure out the sed command line ;-).

0 0 votes
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments