forked from QuantStack/jupyterlab-drawio
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
626 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "eligible-lexington", | ||
"metadata": {}, | ||
"source": [ | ||
"# Diagram Document\n", | ||
"\n", | ||
"Using a `.dio` file directly in the _Diagram Document_ is much simpler than the [Diagram Widget](./Diagram%20Widget.ipynb) or [Diagram Rich Display](./Diagram%20Rich%20Display.ipynb). \n", | ||
"\n", | ||
"You can download these from [diagrams.net](https://diagrams.net), or one of their many integrations. You might also be able to use these documents in [documentation](https://pypi.org/project/sphinxcontrib-drawio/)." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "heard-adolescent", | ||
"metadata": {}, | ||
"source": [ | ||
"## Making a Diagram Document\n", | ||
"From the _JupyterLab Launcher_:\n", | ||
"- click _Diagram_" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "collectible-breeding", | ||
"metadata": {}, | ||
"source": [ | ||
"## Opening a Diagram Document\n", | ||
"- Find a <img src=\"../packages/ipydrawio/style/img/drawio.svg\" style=\"width:1.6em\"/> file in the JupyterLab _File Browser_ <kbd>Ctrl+Shift+F</kbd>\n", | ||
"- Double click it" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "forced-scheduling", | ||
"metadata": {}, | ||
"source": [ | ||
"### Other Formats\n", | ||
"\n", | ||
"`drawio` XML can be embedded inside `png` and `svg` images and notebooks. If they have a compound suffix, like `.dio.png`, `.dio.ipynb`, the _Diagram Editor_ will be opened by default.\n", | ||
"- right click on the file in the _File Browser_\n", | ||
"- select _Open With_\n", | ||
"- select one of the _Diagram_ options" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "respected-plymouth", | ||
"metadata": {}, | ||
"source": [ | ||
"## Configuration\n", | ||
"\n", | ||
"In the JupyterLab _Advanced Settings_ Panel <kbd>Ctrl+,</kbd>, the <img src=\"../packages/ipydrawio/style/img/drawio.svg\" style=\"width:1.6em\"/> _Diagrams Documents_ section offers many, many options." | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.6" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "addressed-population", | ||
"metadata": {}, | ||
"source": [ | ||
"# Diagram Rich Display\n", | ||
"\n", | ||
"The _Rich Display_ is a good deal simpler than the [Diagram Widget](./Diagram%20Widget.ipynb), but offers more computability than the [Diagram Document](./Diagram%20Document.ipynb)." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "another-cricket", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from IPython.display import display, update_display" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "secondary-lingerie", | ||
"metadata": {}, | ||
"source": [ | ||
"If you just need to show a diagram (or want a _really_ temporary scratchpad), just send a display message to the frontend with the `application/x-drawio` mimetype." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "academic-injury", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"MIMETYPE = \"application/x-drawio\"" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "oriented-poland", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"def display_drawio(xml, **kwargs):\n", | ||
" \"\"\" Send some xml to the frontend\n", | ||
" \n", | ||
" Get a handle to update later by calling `display_drawio` with `display_id=True` \n", | ||
" \"\"\"\n", | ||
" return display({MIMETYPE: xml}, raw=True, **kwargs)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "fiscal-decline", | ||
"metadata": {}, | ||
"source": [ | ||
"Apparently, an empty string is valid." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "extensive-sharing", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"handle = display_drawio(\"\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "wrong-connecticut", | ||
"metadata": {}, | ||
"source": [ | ||
"## Metadata\n", | ||
"The `drawioUrlParams` and `drawioConfig` (as well as `width` and `height`) can change how the application works." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "empirical-scout", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"handle = display_drawio(\"\", metadata={\n", | ||
" MIMETYPE: dict(height=\"200px\", drawioUrlParams=dict(ui=\"dark\", chrome=0))\n", | ||
"})" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.6" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Oops, something went wrong.