Spaces:
Running
Running
Commit
·
9c9ffb4
1
Parent(s):
4c413f1
Add Markmap toolbar integration and auto-fit functionality in post_blog.py
Browse files- post_blog.py +13 -0
post_blog.py
CHANGED
@@ -23,6 +23,19 @@ def generate_post_html(title, summary, mindmap, citation):
|
|
23 |
html_summary = mistune.html(summary)
|
24 |
post = f"""
|
25 |
<div id="paper_post">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
<script src="https://cdn.jsdelivr.net/npm/markmap-autoloader@latest"></script>
|
27 |
<style>
|
28 |
.markmap {{
|
|
|
23 |
html_summary = mistune.html(summary)
|
24 |
post = f"""
|
25 |
<div id="paper_post">
|
26 |
+
<script src='https://cdn.jsdelivr.net/npm/markmap-toolbar@0.18.4/dist/index.min.js'/>
|
27 |
+
<script async='async' src='https://cdn.jsdelivr.net/npm/markmap-autoloader@latest'/>
|
28 |
+
<script>
|
29 |
+
window.addEventListener('load', function() {{
|
30 |
+
const element = document.querySelector('div.mm-toolbar-item[title="Fit window size"]');
|
31 |
+
if (element) {{
|
32 |
+
element.click();
|
33 |
+
}} else {{
|
34 |
+
console.log('Element not found');
|
35 |
+
}}
|
36 |
+
}}, 500); // Adjust the delay if needed
|
37 |
+
}});
|
38 |
+
</script>
|
39 |
<script src="https://cdn.jsdelivr.net/npm/markmap-autoloader@latest"></script>
|
40 |
<style>
|
41 |
.markmap {{
|