Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import urllib
import plantumlencoder
from IPython.core.magic import magics_class, cell_magic, Magics
from IPython.display import Image, SVG
class Plantuml(Magics):
def plantuml(self, line, cell):
self.filename = line
self.code = ""
for line in cell.split('\n'):
newline = line.strip()
if newline:
self.code += newline + '\n'
uri = "" + plantumlencoder.compress(self.code)
urllib.urlretrieve(uri, self.filename)
return SVG(filename=self.filename)
def load_ipython_extension(ipython):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.