pyegeria 5.3.4.4.dev2__py3-none-any.whl → 5.3.4.4.dev3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyegeria/mermaid_utilities.py +55 -2
- {pyegeria-5.3.4.4.dev2.dist-info → pyegeria-5.3.4.4.dev3.dist-info}/METADATA +1 -1
- {pyegeria-5.3.4.4.dev2.dist-info → pyegeria-5.3.4.4.dev3.dist-info}/RECORD +6 -6
- {pyegeria-5.3.4.4.dev2.dist-info → pyegeria-5.3.4.4.dev3.dist-info}/LICENSE +0 -0
- {pyegeria-5.3.4.4.dev2.dist-info → pyegeria-5.3.4.4.dev3.dist-info}/WHEEL +0 -0
- {pyegeria-5.3.4.4.dev2.dist-info → pyegeria-5.3.4.4.dev3.dist-info}/entry_points.txt +0 -0
pyegeria/mermaid_utilities.py
CHANGED
@@ -93,7 +93,7 @@ def parse_mermaid_code(mermaid_code):
|
|
93
93
|
return title, guid, mermaid_code
|
94
94
|
|
95
95
|
|
96
|
-
def
|
96
|
+
def old_construct_mermaid_html(mermaid_str: str) -> str:
|
97
97
|
"""Function to display a HTML code in a Jupyter notebook"""
|
98
98
|
title_label, guid, mermaid_code = parse_mermaid_code(mermaid_str)
|
99
99
|
|
@@ -131,7 +131,7 @@ def construct_mermaid_html(mermaid_str: str) -> str:
|
|
131
131
|
<script type="module">
|
132
132
|
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs';
|
133
133
|
|
134
|
-
mermaid.initialize({startOnLoad:
|
134
|
+
mermaid.initialize({startOnLoad: false});
|
135
135
|
await mermaid.run({
|
136
136
|
querySelector: '.mermaid',
|
137
137
|
postRenderCallback: (id) => {
|
@@ -218,6 +218,59 @@ def construct_mermaid_html(mermaid_str: str) -> str:
|
|
218
218
|
return html_section1 + html_section2 + html_section3 + mermaid_code + html_section4
|
219
219
|
|
220
220
|
|
221
|
+
def construct_mermaid_html(mermaid_str: str) -> str:
|
222
|
+
"""Function to display a HTML code in a Jupyter notebook
|
223
|
+
|
224
|
+
Constructs HTML for a single Mermaid graph with pan and zoom support.
|
225
|
+
Each call overwrites the previous graph.
|
226
|
+
|
227
|
+
:param mermaid_code: The Mermaid code for the graph.
|
228
|
+
:param graph_id: An optional unique graph ID (default is 'mermaid-graph').
|
229
|
+
:return: The HTML content for the Mermaid graph with pan and zoom enabled.
|
230
|
+
|
231
|
+
"""
|
232
|
+
title_label, guid, mermaid_code = parse_mermaid_code(mermaid_str)
|
233
|
+
|
234
|
+
graph_id = title_label.replace(" ", "_")
|
235
|
+
# Construct the HTML content with Mermaid.js initialization and zoom/pan support
|
236
|
+
mermaid_html = f"""
|
237
|
+
<!DOCTYPE html>
|
238
|
+
<html>
|
239
|
+
<head>
|
240
|
+
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
|
241
|
+
<script>
|
242
|
+
// Initialize mermaid with pan and zoom enabled
|
243
|
+
window.mermaid.initialize({{
|
244
|
+
startOnLoad: true,
|
245
|
+
securityLevel: "loose", // Allow inline event handlers
|
246
|
+
theme: "default", // Use default theme (this can be modified)
|
247
|
+
flowchart: {{
|
248
|
+
useMaxWidth: false, // Disable resizing to fit container width
|
249
|
+
htmlLabels: true, // Enable HTML labels
|
250
|
+
wrap: true // Wrap long labels
|
251
|
+
}},
|
252
|
+
// Enable zoom and pan for the graph
|
253
|
+
zoom: {{
|
254
|
+
enabled: true,
|
255
|
+
scaleExtent: [0.5, 4], // Minimum 50% zoom, maximum 400% zoom
|
256
|
+
pan: true, // Enable panning
|
257
|
+
zoomOnScroll: true // Zoom with scrollwheel/mousepad
|
258
|
+
}}
|
259
|
+
}});
|
260
|
+
</script>
|
261
|
+
</head>
|
262
|
+
<body>
|
263
|
+
<div id="{graph_id}" class="mermaid">{mermaid_code}</div>
|
264
|
+
<script>
|
265
|
+
// Specifically initialize the newly added graph in case Mermaid is already loaded
|
266
|
+
window.mermaid.contentLoaded();
|
267
|
+
</script>
|
268
|
+
</body>
|
269
|
+
</html>
|
270
|
+
"""
|
271
|
+
|
272
|
+
return mermaid_html
|
273
|
+
|
221
274
|
def save_mermaid_html(
|
222
275
|
title: str, mermaid_str: str, folder: str = EGERIA_MERMAID_FOLDER
|
223
276
|
):
|
@@ -502,7 +502,7 @@ pyegeria/feedback_manager_omvs.py,sha256=B66e3ZCaC_dirb0mcb2Nz3PYh2ZKsoMAYNOb3eu
|
|
502
502
|
pyegeria/full_omag_server_config.py,sha256=CQqLCy_3DZFvJZEOcGf50HWdFaWpiAIs6z-kKyjvpDA,47464
|
503
503
|
pyegeria/glossary_browser_omvs.py,sha256=RCvZ1l2xg6uZ1o4xGJUkIVJQO9NZG00F_jGSc4fAERU,93538
|
504
504
|
pyegeria/glossary_manager_omvs.py,sha256=CN04lhnAFk_g4soE5V_jZ0GDrLPClhX5yX9iE0t6NDk,132440
|
505
|
-
pyegeria/mermaid_utilities.py,sha256=
|
505
|
+
pyegeria/mermaid_utilities.py,sha256=C86-dGDeCD5G6bKJzpa34yOAgZiAitKFZDoospgDtno,20215
|
506
506
|
pyegeria/metadata_explorer_omvs.py,sha256=u66o4IOhSo-i75KYeHogGql-gECBzZPT-RYbvfYuzoI,86932
|
507
507
|
pyegeria/my_profile_omvs.py,sha256=i0e29KXRKZzZGgxuQI7c2_w7dyDuQWFIykky1Nqc0_8,34673
|
508
508
|
pyegeria/platform_services.py,sha256=xlF5p5HPKDGTFFDsuxm2RLhr8vjZPv4T7e2qCkDgKXE,41654
|
@@ -515,8 +515,8 @@ pyegeria/template_manager_omvs.py,sha256=o_qCIFTRLK8b9C3N99taLji8VkDygo1Ss0fua35
|
|
515
515
|
pyegeria/utils.py,sha256=GCt1C0bp0Xng1ahzbZhzV9qQwH7Dj93IaCt2dvWb-sg,5417
|
516
516
|
pyegeria/valid_metadata_omvs.py,sha256=UyIT4DfB1_QIG55Hmop7ozbsq8cNdrpYB7Tb6EOFiN8,65035
|
517
517
|
pyegeria/x_action_author_omvs.py,sha256=6b725SPsC52AI7ols7Qq8MsBlZuAXr_BgJ_-ychVRCw,6386
|
518
|
-
pyegeria-5.3.4.4.
|
519
|
-
pyegeria-5.3.4.4.
|
520
|
-
pyegeria-5.3.4.4.
|
521
|
-
pyegeria-5.3.4.4.
|
522
|
-
pyegeria-5.3.4.4.
|
518
|
+
pyegeria-5.3.4.4.dev3.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
519
|
+
pyegeria-5.3.4.4.dev3.dist-info/METADATA,sha256=G60bhZzxU4w2OTbvb8FZJpF1rCUvS5C6zoFKDGC_IEs,2740
|
520
|
+
pyegeria-5.3.4.4.dev3.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
521
|
+
pyegeria-5.3.4.4.dev3.dist-info/entry_points.txt,sha256=E83aZ9RhrxffYGmHgBwhLdS5fvEeYhrIPp0FZRvaFOI,6180
|
522
|
+
pyegeria-5.3.4.4.dev3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|