diff --git a/backend/export.py b/backend/export.py
index 06bdb47..0a0bd8f 100644
--- a/backend/export.py
+++ b/backend/export.py
@@ -300,18 +300,20 @@ def generate_export_html(
title: str,
content: str,
theme_css: str,
- is_dark: bool = False
+ is_dark: bool = False,
+ show_print_button: bool = False
) -> str:
"""
Generate a standalone HTML document for a note.
Uses marked.js for client-side markdown rendering.
-
+
Args:
title: The note title (for
and display)
content: Raw markdown content (images should already be base64 embedded)
theme_css: CSS content for theming
is_dark: Whether using a dark theme (for Mermaid/Highlight.js)
-
+ show_print_button: Whether to show a print button (for preview mode)
+
Returns:
Complete HTML document as string
"""
@@ -327,6 +329,24 @@ def generate_export_html(
highlight_theme = 'github-dark' if is_dark else 'github'
mermaid_theme = 'dark' if is_dark else 'default'
+ # Print toolbar HTML (only shown in preview mode)
+ print_toolbar_html = '''
+
+''' if show_print_button else ''
+
html = f'''
@@ -667,12 +687,56 @@ def generate_export_html(
padding: 0.5in;
max-width: none;
}}
+ .print-toolbar {{
+ display: none !important;
+ }}
+ }}
+
+ /* Print toolbar (only shown in preview mode) */
+ .print-toolbar {{
+ position: fixed;
+ top: 1rem;
+ right: 1rem;
+ z-index: 1000;
+ display: flex;
+ gap: 0.5rem;
+ background: var(--bg-secondary, #f8f9fa);
+ padding: 0.5rem;
+ border-radius: 0.5rem;
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
+ border: 1px solid var(--border-primary, #dee2e6);
+ }}
+
+ .print-toolbar button {{
+ display: flex;
+ align-items: center;
+ gap: 0.375rem;
+ padding: 0.5rem 0.75rem;
+ border: 1px solid var(--border-primary, #dee2e6);
+ border-radius: 0.375rem;
+ background: var(--bg-primary, #ffffff);
+ color: var(--text-primary, #333333);
+ cursor: pointer;
+ font-size: 0.875rem;
+ font-family: inherit;
+ transition: background-color 0.15s, border-color 0.15s;
+ }}
+
+ .print-toolbar button:hover {{
+ background: var(--bg-tertiary, #e9ecef);
+ border-color: var(--accent-primary, #0366d6);
+ }}
+
+ .print-toolbar button svg {{
+ width: 1rem;
+ height: 1rem;
}}
+ {print_toolbar_html}
-
+