This is what drives MDiocre’s user interface.


class mdiocre.wizard.Wizard
generate_from_directory(args, callback=None)

Generates pages based on the directory it is supplied through args.

This function looks at the files inside the argssource_dir path recursively and copies the files to build_dir, or generates a page if it is a MDiocre file (see is_mdiocre_string()).

In order to generate pages, it needs a template. The template file is supplied through each file’s mdiocre-template variable, and it is relative to source_dir.

  • args (dict) – A dictionary containing arguments for this function. It must have the following keys: source_dir and build_dir.

  • callback (func) – A function to call every file completion. Its arguments are a dictionary containing the keys “original_file”, “target_file”, “root”.


True, if every file is successfully processed. Otherwise, return False. Additionally, it will also create or modify files on the filesystem.

generate_from_path(source_file, built_file, root='', to_html=False, level=0)

If the file is a MDiocre file, generate an HTML page from a source file to a built file. Otherwise, simply copy the file.

generate_from_string(md_string, root)

Given a MDiocre string and a “root” path, convert it to a proper HTML document.

MDiocre is simple: HTML template + Markdown = New HTML page

The HTML template itself is obtained from the presence of the mdiocre_template variable, which simply contains the path of the template file relative to the root set here. Which is why the mdiocre-template variable must be present for the markdown to be considered convertable by MDiocre.

  • md_string (string) – The markdown-formatted text to convert.

  • root (string) – The ‘root’ path.


A rendered HTML string. If the md_string is invalid or if it cannot find the template file, it will return an empty string.


Determines whether or not this is valid MDiocre-formatted markdown.

The only criteria currently needed for this is whether or not it contains a mdiocre-template variable.


md_string (string) – The markdown-formatted text to validate.


True if it is a valid string, False otherwise.

register_converter(file_extension, parser_name)

Registers a parser with a file extension.


Generate a VariableManager object directly from a source file name using automatic file type detection. Directly means that it won’t check if it is a “valid” MDiocre file - that is, whether or not there is a template doesn’t matter one bit.


source_file (string) – Path to the MDiocre file to process.


VariableManager object if the source_file is parseable. None otherwise.