Skip to content

Instantly share code, notes, and snippets.

@meteozond
Last active March 26, 2021 10:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meteozond/d816f113a9346074a6cbfc107240a7c0 to your computer and use it in GitHub Desktop.
Save meteozond/d816f113a9346074a6cbfc107240a7c0 to your computer and use it in GitHub Desktop.
Jupyter generated sequence diagram
from IPython.core.display import display, HTML
from random import randint
def sequence_diagram(diagram):
d = randint(0,1000)
display(HTML(f'''
<script src="https://bramp.github.io/js-sequence-diagrams/js/webfont.js"></script>
<script src="https://bramp.github.io/js-sequence-diagrams/js/snap.svg-min.js"></script>
<script src="https://bramp.github.io/js-sequence-diagrams/js/underscore-min.js"></script>
<script src="https://bramp.github.io/js-sequence-diagrams/js/sequence-diagram-min.js"></script>
<div id="diagram{d}"></div>
<script>
var diagram = Diagram.parse(`{diagram}`);
diagram.drawSVG("diagram{d}", {{theme: 'simple'}});
</script>
'''))
@meteozond
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment