@LiquidTags.register('graphviz')
def graphviz_parser(preprocessor, tag, markup):
 m = DOT_BLOCK_RE.search(markup)
 if m:
  code = m.group('code')
  program = m.group('program').strip()
  output = run_graphviz(program, code)
  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))

@ LiquidTags . register ( 'graphviz' ) def graphviz_parser ( preprocessor , tag , markup ) : m = DOT_BLOCK_RE . search ( markup ) if m : code = m . group ( 'code' ) program = m . group ( 'program' ) . strip ( ) output = run_graphviz ( program , code ) 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 .