def graphviz_parser(preprocessor, tag, markup):
    """ Simple Graphviz parser """

    # Parse the markup string
    m = DOT_BLOCK_RE.search(markup)
    if m:
        # Get program and DOT code
        code = m.group('code')
        program = m.group('program').strip()

        # Run specified program with our markup
        output = run_graphviz(program, code)

        # Return Base64 encoded image
        return '<span class="graphviz" style="text-align: center;"><img src="data:image/png;base64,%s"></span>' % base64.b64encode(output).decode('utf-8')
    else:
        raise ValueError('Error processing input. '
                         'Expected syntax: {0}'.format(SYNTAX))
Simple Graphviz parser