{"id":13579078,"url":"https://github.com/outofcontrol/mediawiki-to-gfm","last_synced_at":"2025-10-23T11:30:35.943Z","repository":{"id":30348275,"uuid":"111573898","full_name":"outofcontrol/mediawiki-to-gfm","owner":"outofcontrol","description":"Converts Mediawiki format to Github Flavoured Markdown format","archived":false,"fork":false,"pushed_at":"2023-12-29T22:28:05.000Z","size":67,"stargazers_count":88,"open_issues_count":3,"forks_count":24,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-02-07T10:49:07.732Z","etag":null,"topics":["converter","gitlab","markdown","mediawiki"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/outofcontrol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSES/MIT.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-11-21T16:29:51.000Z","updated_at":"2025-01-03T14:38:23.000Z","dependencies_parsed_at":"2022-09-01T00:52:51.285Z","dependency_job_id":"cda74a77-2f88-4d26-8b08-91f9a6b2a1a4","html_url":"https://github.com/outofcontrol/mediawiki-to-gfm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outofcontrol%2Fmediawiki-to-gfm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outofcontrol%2Fmediawiki-to-gfm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outofcontrol%2Fmediawiki-to-gfm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outofcontrol%2Fmediawiki-to-gfm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/outofcontrol","download_url":"https://codeload.github.com/outofcontrol/mediawiki-to-gfm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237811560,"owners_count":19370150,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["converter","gitlab","markdown","mediawiki"],"created_at":"2024-08-01T15:01:36.329Z","updated_at":"2025-10-23T11:30:35.627Z","avatar_url":"https://github.com/outofcontrol.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# Mediawiki to GitHub Flavoured Markdown\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Build Status](https://travis-ci.org/outofcontrol/mediawiki-to-gfm.svg?branch=master)](https://travis-ci.org/outofcontrol/mediawiki-to-gfm)\n\nMediawiki to GFM is a script to convert a set of [Mediawiki](https://www.mediawiki.org)\npages to [GitHub Flavoured Markdown](https://github.github.com/gfm/) (GFM). This script was written from a necessity to convert a MediaWiki installation to a GitLab wiki. This code is based on [MediaWiki to Markdown](https://github.com/philipashlock/mediawiki-to-markdown) by [Philip Ashlock](https://github.com/philipashlock/). Philip graciously gave us permission to post our version as a new project.\n\nMajor differences include the addition of PHPUnit tests, code is broken into classes, deprecated code removed, work around for a bug in Pandoc added, fix for a common MediaWiki user error added, other small changes other small changes. \n\n## Requirements\n\n* PHP: Tested in PHP 7.0, 7.1, 7.2 and 8.0\n* Pandoc: Installation instructions are here https://pandoc.org/installing.html\n    - Tested on version 2.0.1.1 and 2.0.2 \n* MediaWiki: https://www.mediawiki.org/wiki/MediaWiki\n    - Tested on version 1.27.x and 1.29.x\n* Composer: Installation instructions are here https://getcomposer.org/download/\n\n## Installation \n\n    git clone https://github.com/outofcontrol/mediawiki-to-gfm.git\n    cd mediawiki-to-gfm\n    composer update --no-dev\n    \n## Run\n\nRun the script on your exported MediaWiki XML file:\n\n    ./convert.php --filename=/path/to/filename.xml --output=/path/to/converted/files \n\n## Options\n\n    ./convert.php --filename=/path/to/filename.xml --output=/path/to/converted/files --format=gfm --addmeta --flatten --indexes\n\n    --filename : Location of the mediawiki exported XML file to convert \n                 to GFM format (Required)\n    --output   : Location where you would like to save the converted files\n                 (Default: ./output)\n    --format   : What format would you like to convert to. Default is GFM \n                 (for use in GitLab and GitHub) See pandoc documentation\n                 for more formats (Default: 'gfm')\n    --addmeta  : This flag will add a Permalink to each file (Default: false)\n    --flatten  : This flag will force all pages to be saved in a single level \n                 directory. File names will be converted in the following way:\n                 Mediawiki_folder/My_File_Name -\u003e Mediawiki_folder_My_File_Name\n                 and saved in a file called 'Mediawiki_folder_My_File_Name.md' \n                 (Default: false)\n    --help     : This help message (almost)\n\n## Run with docker\n\nCreate a new directory and put `filename.xml` into the new directory:\n```bash\nmkdir my_wiki\nmv filename.xml my_wiki/\ncd my_wiki\n```\nNow you can convert `filename.xml` using docker.\nNote: do **not** use the output parameter. The output will always be written into the subdirectory `output` of the current path. (hence the creation of a new directory). This is necessary, because the docker container does not have access to your filesystem except for the current directory (because of the `-v $PWD:/app` parameter for docker)\n```bash\ndocker run -v $PWD:/app oooc/mediawiki-to-gfm --filename=filename.xml\n```\n\n## Export Mediawiki Files to XML \n\nIn order to convert from MediaWiki format to GFM and use in GitLab (or GitHub), you will first need to export all the pages you wish to convert from Mediawiki into an XML file. Here are a few simple steps to help\nyou accomplish this quickly:\n\n1. MediaWiki -\u003e Special Pages -\u003e 'All Pages'\n1. With help from the filter tool at the top of 'All Pages', copy the page names to convert into a text file (one file name per line).\n1. MediaWiki -\u003e Special Pages -\u003e 'Export'\n1. Paste the list of pages into the Export field. \n1. Check: 'Include only the current revision, not the full history'  \n   Note: This convert script will only do latest version, not revisions. \n1. Uncheck: Include Templates\n1. Check: Save as file\n1. Click on the 'Export' button.\n1. An XML file will be saved locally. \n1. Use this convert.php script to convert the XML file a set of GFM formatted pages. \n\nIn theory you can convert to any of these formats… (not tested):  \n    https://pandoc.org/MANUAL.html#description\n\nUpdates and improvements are welcome! Please only submit a PR if you have also written tests and tested your code! To run phpunit tests, update composer without the --no-dev parameter:\n\n    composer update\n\n## Thank you\n\n[@SomethingGeneric](https://github.com/SomethingGeneric/): Fix path for Docker  \n[@mloskot](https://github.com/mloskot/): Verify that this script does run in PHP 7.2 ([#1](https://github.com/outofcontrol/mediawiki-to-gfm/issues/1))  \n[@timwsuqld](https://github.com/timwsuqld/): First contribution!\n\n## Disclaimer\n\nThis script has not been tested on Windows. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foutofcontrol%2Fmediawiki-to-gfm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foutofcontrol%2Fmediawiki-to-gfm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foutofcontrol%2Fmediawiki-to-gfm/lists"}