Skip to content

Instantly share code, notes, and snippets.

@d0ugal
Created June 3, 2015 09:27
Show Gist options
  • Select an option

  • Save d0ugal/53a1af8ec63c906cc203 to your computer and use it in GitHub Desktop.

Select an option

Save d0ugal/53a1af8ec63c906cc203 to your computer and use it in GitHub Desktop.
A simple script to update MkDocs pages config to match the 0.13 style.
"""
This expects you to be in an environment with MkDocs 0.13 or greater installed.
Save the file, run it by passing in a mkdocs.yml and it will print out the
converted version. Copy this into the config, tweak test and you are done!
"""
import click
import yaml
from mkdocs import legacy
@click.command()
@click.argument('config', type=click.File('rb'))
def convert(config):
config = yaml.load(config)
print(yaml.dump(legacy.pages_compat_shim(config['pages'])))
if __name__ == '__main__':
convert()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment