Skip to content
This repository was archived by the owner on Aug 22, 2019. It is now read-only.

Inline image link fixes for markdown from dump.xml #1

@DRN88

Description

@DRN88

Thanks for mw2md project. It helped me a lot!

Dump mediawiki latest data

php /var/www/html/mediawiki_1.21.1/maintenance/dumpBackup.php --current > /root/wiki2markdown/dump.xml

Dump all latest images to a folder: images

php /var/www/html/mediawiki_1.21.1/maintenance/dumpUploads.php | sed 's~mwstore://local-backend/local-public~/var/www/html/mediawiki_1.21.1/images~' | xargs cp -t /root/wiki2markdown/images/

Change config.yml. Add image tag with 'ccccccc' or any other key character(s)

# Rewrite special wiki constructs to be markdown-friendly
# (output should be HTML that feeds into the Markdown conversion)
rewrite_wiki:
  '\{\{#ev:youtube\|([^|}]*)\|([^|}]*)\}\}': '<iframe width="\2" src="//youtube.com/embed/\1" frameborder="0" allowfullscreen="true"> </iframe>'
  '\{\{#ev:youtube\|([^|}]*)\|([^|}]*)\|([^|}]*)[^}]?\}\}': '<iframe width="\2" src="//youtube.com/embed/\1" frameborder="0" align="\3" allowfullscreen="true"> </iframe>'
  '\[\[image:(.*)\]\]': '!ccccccc\1ccccccc(/images/\1)'

# Rewrite resulting Markdown
rewrite_markdown:
  '!ccccccc': '!['
  'ccccccc': ']'

Result should be

![myimageName.jpg](/images/myimageName.jpg)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions