Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Tanami/markdown-graphviz-svg

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Markdown Graphviz SVG (for Python 3 and ReText)

This is a rewrite/continuation of the following modules:

  • markdown-inline-graphviz
  • python-markdown-graphviz
  • markdown-dot

At some point in the development of python-markdown the original method that these modules used to embed Graphviz was broken because the way it inserted the rendered SVG was dumb (see:).

I have poorly reimplemented the original functionality with the BlockProcessors class, this is a bit finnicky with the parsing of blocks (sometimes you need to use double newlines). But it is more robust than using the Preprocessor method.

I did not implement the PNG rendering functionality because I don't use it. If you want to make significantly smaller documents you might wish to implement SVGZ with the original PNG method from python-markdown-graphviz.

Because this uses the special {% %} syntax, it should be compatible with Jinja and other platforms that recognise it as such, however this is untested.

Install

Usage

  • Add markdown_graphviz_svg to your extensions list in ReText's configuration
  • Use like this:
{% dot
    digraph G {
        rankdir=LR
        Earth [peripheries=2]
        Mars
        Earth -> Mars
    }
%}

Where dot can be any of: dot, neato, fdp, sfdp, twopi, circo.

KNOWN BUGS

  • Sometimes the block parser doesn't think you have made a separate block. Insert two newlines above and below your code block to fix it.
  • If you don't insert an ending %}, the parser will eat the rest of your document. I am not fixing this.

Credits

License

MIT License

About

Extension for python-markdown and ReText to embed Graphviz output.

Topics

Resources

Stars

Watchers

Forks

Used by

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.