From 3f88af32586b8ddd024b4ae5bcbbd016ec199316 Mon Sep 17 00:00:00 2001 From: DJP Date: Thu, 11 Dec 2025 16:08:24 -0500 Subject: [PATCH] feat: Add Forge Document mode to Markdown Converter - Backend: - Added 'forge' output format support (maps to HTML with Forge theme). - Implemented 'forge' theme with Montserrat font and white-paper styling. - Fixed 'Plain Text' mode not returning output. - Added fallback 'output' return when markdown library is missing. - Frontend: - Added 'Forge Document' as the default output format. - Implemented 'Copy Formatted' button for rich text clipboard support (Word/Excel compatible). - Switched to single-column layout for better document visibility. - Used iframe for document preview to isolate styles and prevent layout issues. --- backend/app/services/markdown_tools.py | 18 ++- frontend/app/text/markdown-converter/page.tsx | 107 ++++++++++++------ 2 files changed, 88 insertions(+), 37 deletions(-) diff --git a/backend/app/services/markdown_tools.py b/backend/app/services/markdown_tools.py index 875cec1..c085c2a 100644 --- a/backend/app/services/markdown_tools.py +++ b/backend/app/services/markdown_tools.py @@ -415,6 +415,10 @@ async def convert_markdown( Dictionary with converted content """ try: + if output_format == "forge": + output_format = "html" + theme = "forge" + import markdown from markdown.extensions import tables, fenced_code, toc @@ -429,12 +433,20 @@ async def convert_markdown( ]) html = md.convert(content) - # Add basic styling + # Define styles based on theme + extra_head = "" + font_family = "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif" + + if theme == "forge": + extra_head = '' + font_family = "'Montserrat', sans-serif" + styled_html = f""" +{extra_head}