diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 2ce0ce5..908a274 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -17,7 +17,10 @@ "Bash(gh release create v1.9.0 --title \"v1.9.0: Custom Headers & Footers for All Exports\" --notes \"$(cat <<''EOF''\n# Release v1.9.0: Custom Headers & Footers for All Exports\n\n## šŸŽÆ Overview\nThis release introduces comprehensive header and footer customization for all standard export formats (PDF, DOCX, ODT, PPTX), allowing users to add professional branding, page numbers, and dynamic content to their exported documents.\n\n## ✨ New Features\n\n### šŸ“‹ Custom Headers & Footers System\n- **Three-Column Layout**: Position content left, center, or right in headers and footers\n- **Custom Text Fields**: Add any text to header/footer positions\n- **Logo/Image Support**: Upload and embed logos in headers or footers\n- **Dynamic Fields**: Automatically insert document information:\n - `$PAGE$` - Current page number\n - `$TOTAL$` - Total page count\n - `$DATE$` - Current date\n - `$TIME$` - Current time\n - `$TITLE$` - Document title\n - `$AUTHOR$` - Document author\n - `$FILENAME$` - File name\n- **Enable/Disable Toggle**: Quick on/off for headers and footers\n- **Persistent Settings**: Preferences saved across sessions\n- **Field Picker Dialog**: Easy insertion of dynamic fields with button clicks\n\n### šŸ“ Format Support\n- āœ… **PDF**: Headers/footers with LaTeX fancyhdr package\n- āœ… **DOCX (Standard)**: Word document XML manipulation\n- āœ… **ODT**: LibreOffice format support\n- āœ… **PPTX**: PowerPoint slide footers\n- āœ… **Batch Conversion**: Full header/footer support in batch mode\n\n**Note**: Enhanced exports (DOCX Enhanced, PDF Enhanced) use Word templates which already have their own headers/footers defined in the template itself.\n\n### šŸ”§ Technical Enhancements\n- **Logo Storage**: Images stored in userData directory for persistence\n- **LaTeX Integration**: Professional PDF headers using fancyhdr package\n- **Word XML Generation**: Direct manipulation of DOCX header/footer sections\n- **Page Numbering**: Automatic page number fields for all formats\n- **Error Handling**: Comprehensive validation and user feedback\n\n## šŸ› Bug Fixes\n\n### Logo Upload Error Fix\n- **Issue**: Logo upload failed with \"path undefined\" error\n- **Fix**: Added validation and fallback for file path handling\n- **Technical**: Use webUtils.getPathForFile when file.path is unavailable\n- **Result**: Logo uploads now work reliably in all contexts\n\n### Header/Footer Visibility Fix\n- **Issue**: Headers/footers not appearing in exported documents\n- **Fix**: Added header/footer logic to all PDF export paths\n- **Technical**: Extended tryPdfFallback function with fancyhdr LaTeX generation\n- **Result**: Headers/footers now appear correctly in all export modes\n\n## šŸŽØ User Interface\n\n### Header & Footer Dialog\n- **Access**: File → Header & Footer Settings...\n- **Three-column grid** for precise positioning\n- **Logo upload buttons** with file browser\n- **Dynamic field buttons** for easy insertion\n- **Enable/disable checkboxes** for quick toggling\n- **Dark theme support** for all dialog elements\n\n### Field Picker Dialog\n- **Quick access** to all dynamic fields\n- **One-click insertion** into text boxes\n- **Field descriptions** explaining each variable\n- **Keyboard friendly** with Tab navigation\n\n## šŸ“¦ Available Downloads\n\nChoose the package that suits your needs:\n\n1. **PanConverter-Setup-1.9.0.exe** (Recommended)\n - Full installer with uninstaller\n - File associations and Start Menu shortcuts\n - ~104 MB\n\n2. **PanConverter-1.9.0-x64.exe**\n - Portable executable, no installation required\n - Run directly from any folder\n - ~104 MB\n\n3. **PanConverter-1.9.0-x64.zip**\n - ZIP archive with unpacked application\n - For manual extraction and deployment\n - ~145 MB (uncompressed files)\n\n## šŸš€ What''s Changed\n\n### Header & Footer Configuration\n1. Open File → Header & Footer Settings...\n2. Configure left, center, right positions for header and footer\n3. Upload logos (optional)\n4. Insert dynamic fields using the \"šŸ”½\" button\n5. Save settings (persisted across app restarts)\n6. Export as usual - headers/footers applied automatically\n\n### Example Use Cases\n- **Corporate Documents**: Add company logo in header, page numbers in footer\n- **Reports**: Document title in header left, date in header right, page X of Y in footer center\n- **Professional Papers**: Author name in header, filename in footer, page numbers center\n\n## šŸ”„ Upgrade Notes\n\nIf upgrading from v1.8.3 or earlier:\n- All your settings and preferences will be preserved\n- Recent files list will remain intact\n- Word template selections will be maintained\n- No breaking changes to existing workflows\n- Header/footer settings start disabled by default\n\n## šŸ“ Installation Instructions\n\n### Using the Installer (Recommended)\n1. Download `PanConverter-Setup-1.9.0.exe`\n2. Run the installer\n3. Follow the installation wizard\n4. Launch from Start Menu or Desktop shortcut\n\n### Using Portable Version\n1. Download `PanConverter-1.9.0-x64.exe`\n2. Save to any folder (e.g., Documents, Desktop)\n3. Double-click to run (no installation needed)\n4. Create your own shortcut if desired\n\n## šŸ” Technical Details\n\n### Implementation\n- **src/main.js**: Header/footer state management, IPC handlers, LaTeX generation\n- **src/renderer.js**: Dialog management, logo handling, field insertion\n- **src/index.html**: Header/footer dialog UI, field picker dialog\n- **src/styles.css**: Dialog styling with dark theme support\n\n### Dependencies\n- **pdf-lib** (v1.17.1): PDF manipulation\n- **pizzip** (v3.2.0): Word document XML handling\n- **electron-store** (v10.1.0): Persistent settings storage\n- **Pandoc**: System requirement for document conversions\n\n### LaTeX Packages Used\n- **fancyhdr**: Header/footer formatting\n- **lastpage**: Total page count support\n\n## šŸ“š Documentation\nFor complete feature documentation, see the [project README](https://github.com/amitwh/pan-converter/blob/master/README.md) and [CLAUDE.md](https://github.com/amitwh/pan-converter/blob/master/CLAUDE.md).\n\n## šŸ’¬ Feedback\nHave suggestions or found a bug? Please [open an issue](https://github.com/amitwh/pan-converter/issues).\n\n---\n\n**Full Changelog**: https://github.com/amitwh/pan-converter/compare/v1.8.3...v1.9.0\n\nšŸ¤– Generated with [Claude Code](https://claude.com/claude-code)\n\nCo-Authored-By: Claude \nEOF\n)\" \"dist/PanConverter-1.9.0-x64.exe\" \"dist/PanConverter-1.9.0-x64.zip\" \"dist/PanConverter-Setup-1.9.0.exe\")", "Bash(where:*)", "Bash(cmd.exe /c \"where xelatex\")", - "Read(//c/Program Files/MiKTeX/miktex/bin/x64/**)" + "Read(//c/Program Files/MiKTeX/miktex/bin/x64/**)", + "Bash(findstr:*)", + "Bash(cmd /c \"dir /b H:\\Coding\\pan-converter\\dist\\*.exe H:\\Coding\\pan-converter\\dist\\*.zip 2>nul | findstr 1.9.1\")", + "Bash(cmd /c \"dir H:\\Coding\\pan-converter\\dist\\*1.9.1*\")" ], "deny": [], "ask": [] diff --git a/CLAUDE.md b/CLAUDE.md index e5abba4..38326e7 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -4,7 +4,7 @@ **PanConverter** is a cross-platform Markdown editor and converter powered by Pandoc, built with Electron. It provides professional-grade editing capabilities with comprehensive export options. -**Current Version**: v1.9.0 +**Current Version**: v1.9.1 **Author**: Amit Haridas (amit.wh@gmail.com) **License**: MIT **Repository**: https://github.com/amitwh/pan-converter @@ -113,7 +113,77 @@ gh release create v1.2.1 --title "Title" --notes "Release notes" \ ## Feature Implementation Guide -### v1.9.0 Custom Headers & Footers (Latest) +### v1.9.1 ASCII Art & Code Block Preservation (Latest) + +#### šŸŽØ Preserved ASCII Art in Exports +**ASCII Art, Charts, Tables & Flowcharts Now Export Exactly as Previewed** (`src/wordTemplateExporter.js`, `src/main.js`) + +**Problem Solved:** +- Previously, ASCII art, flowcharts, and code blocks were being corrupted during export to Word and PDF +- Line breaks, spacing, and monospace alignment were lost +- Box-drawing characters and diagrams became unreadable + +**Solution Implemented:** +1. **Enhanced Word Template Exporter** (`src/wordTemplateExporter.js:259-289`) + - Code blocks now render each line as a separate paragraph with exact spacing + - `white-space: pre` and `word-wrap: normal` prevent text wrapping + - Monospace font (Consolas) with consistent 18pt size + - Light gray background (#F5F5F5) for visual distinction + - `` and `` preserve exact formatting + +2. **Improved ASCII Art Detection** (`src/wordTemplateExporter.js:410-456`) + - Extended Unicode box-drawing character support (╭╮╯╰ rounded corners, heavy box characters) + - Additional arrow characters (↔↕⇒⇐⇓⇑) + - More ASCII patterns detected (+---+---+, <---->, etc.) + - Better markdown table vs ASCII art differentiation + +3. **Enhanced PDF Export** (`src/main.js:1266-1268`, `src/main.js:1345-1347`, `src/main.js:2410-2412`) + - Added `-V monofont="Consolas"` for monospace code blocks + - Added `--highlight-style=tango` for syntax highlighting + - Applied to main export, fallback export, and CLI conversion + +4. **Electron PDF Fallback** (`src/main.js:1613-1637`) + - Enhanced CSS for `
` and `` elements
+   - `white-space: pre` prevents wrapping
+   - `font-family: Consolas, Monaco, 'Courier New', monospace`
+   - Print media query preserves formatting when printing
+
+5. **HTML Export** (`src/main.js:1525-1548`)
+   - Same CSS improvements as Electron PDF
+   - Code blocks maintain exact preview appearance
+
+**Key CSS Properties for ASCII Preservation:**
+```css
+pre {
+    white-space: pre;
+    word-wrap: normal;
+    font-family: Consolas, Monaco, 'Courier New', monospace;
+    font-size: 12px;
+    line-height: 1.4;
+}
+pre code {
+    white-space: pre;
+    word-wrap: normal;
+    display: block;
+}
+```
+
+**Word XML Properties for ASCII Preservation:**
+```xml
+
+    
+    
+    
+
+
+    
+    
+
+```
+
+---
+
+### v1.9.0 Custom Headers & Footers
 
 #### šŸ“„ Comprehensive Header & Footer System
 **Custom Headers & Footers for Standard Exports** (`src/main.js:701-853`, `src/index.html:929-1042`, `src/renderer.js:2560-2747`, `src/styles.css:3162-3432`)
@@ -1109,7 +1179,7 @@ if (!gotTheLock) {
 
 ## Pending Tasks & Future Enhancements
 
-No pending tasks at this time. All planned v1.9.0 features have been completed.
+No pending tasks at this time. All planned v1.9.1 features have been completed.
 
 ### Potential Future Enhancements
 - Image embedding in headers/footers (partially implemented - logo upload UI ready)
@@ -1119,19 +1189,19 @@ No pending tasks at this time. All planned v1.9.0 features have been completed.
 
 ---
 
-**Last Updated**: October 28, 2025
-**Claude Assistant**: Development completed for v1.9.0 with Custom Headers & Footers!
+**Last Updated**: December 12, 2025
+**Claude Assistant**: Development completed for v1.9.1 with ASCII Art Preservation!
 
-### v1.9.0 - Latest Release Summary
-- **Custom Headers & Footers**: Professional headers/footers for PDF, DOCX, ODT, and PowerPoint exports
-- **Dynamic Field Support**: $PAGE$, $TOTAL$, $DATE$, $TIME$, $TITLE$, $AUTHOR$, $FILENAME$
-- **Logo Upload UI**: Ready for image embedding in headers/footers
-- **Three-Column Layout**: Left/Center/Right positioning for headers and footers
-- **Batch Support**: Full header/footer integration in batch converter
-- **Persistent Settings**: Configurations saved across sessions
-- **Dark Theme Support**: Complete styling for all 22 themes
+### v1.9.1 - Latest Release Summary
+- **ASCII Art Preservation**: Code blocks, flowcharts, tables, and ASCII art now export exactly as shown in preview
+- **Enhanced Code Block Rendering**: Each line rendered separately to preserve exact spacing and alignment
+- **Monospace Font Support**: Consolas font used consistently across all export formats
+- **Improved ASCII Detection**: Extended Unicode box-drawing and arrow character support
+- **PDF Export Enhancement**: Added monofont and highlight-style options for better code rendering
+- **HTML/Electron PDF Fix**: Enhanced CSS to prevent text wrapping in code blocks
 
 ### Previous Releases
+- v1.9.0: Custom Headers & Footers for PDF, DOCX, ODT, PowerPoint exports
 - v1.8.3: Streamlined PDF Editor UI & Configurable Template Settings
 - v1.8.2: Enhanced PDF Export & Print Fix
 - v1.8.1: Streamlined PDF Editor UI
diff --git a/package.json b/package.json
index 38b0d28..d39304d 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "pan-converter",
-  "version": "1.9.0",
+  "version": "1.9.1",
   "description": "Cross-platform Markdown editor and converter using Pandoc",
   "main": "src/main.js",
   "scripts": {
diff --git a/src/main.js b/src/main.js
index 7f41737..29d2dfd 100644
--- a/src/main.js
+++ b/src/main.js
@@ -515,7 +515,7 @@ function createMenu() {
               type: 'info',
               title: 'About PanConverter',
               message: 'PanConverter',
-              detail: 'A cross-platform Markdown editor and converter using Pandoc.\n\nVersion: 1.9.0\nAuthor: Amit Haridas\nEmail: amit.wh@gmail.com\nLicense: MIT\n\nFeatures:\n• Custom Headers & Footers for PDF, DOCX, ODT, and PowerPoint exports\n• Dynamic field support: $PAGE$, $TOTAL$, $DATE$, $TIME$, $TITLE$, $AUTHOR$, $FILENAME$\n• Logo/image embedding in headers and footers\n• Modern glassmorphism UI with gradient backgrounds\n• Enhanced PDF export via Word template with configurable start page\n• Configurable template settings (start page selection)\n• Streamlined PDF Editor UI (merge, split, compress, rotate, watermark, encrypt)\n• Universal File Converter (LibreOffice, ImageMagick, FFmpeg, Pandoc)\n• Windows Explorer context menu integration\n• Tabbed interface for multiple files\n• Advanced markdown editing with live preview\n• Real-time preview updates while typing\n• Full toolbar markdown editing functions\n• Enhanced PDF export with built-in Electron fallback\n• Enhanced Word export with template support (single file & batch)\n• File association support for .md files\n• Command-line interface for batch conversion\n• Advanced export options with templates and metadata\n• Batch file conversion with progress tracking\n• Improved preview typography and spacing\n• Adjustable font sizes via menu (Ctrl+Shift+Plus/Minus)\n• Complete theme support including Monokai fixes\n• Find & replace with match highlighting\n• Line numbers and auto-indentation\n• Export to multiple formats via Pandoc\n• PowerPoint & presentation export\n• Export tables to Excel/ODS spreadsheets\n• Document import & conversion\n• Table creation helper\n• 22 beautiful themes (including Dracula, Nord, Tokyo Night, Gruvbox, Ayu, Concrete, and more)\n• Undo/redo functionality\n• Live word count and statistics',
+              detail: 'A cross-platform Markdown editor and converter using Pandoc.\n\nVersion: 1.9.1\nAuthor: Amit Haridas\nEmail: amit.wh@gmail.com\nLicense: MIT\n\nFeatures:\n• Preserved ASCII art, charts, tables, flowcharts in exports (NEW in v1.9.1)\n• Custom Headers & Footers for PDF, DOCX, ODT, and PowerPoint exports\n• Dynamic field support: $PAGE$, $TOTAL$, $DATE$, $TIME$, $TITLE$, $AUTHOR$, $FILENAME$\n• Logo/image embedding in headers and footers\n• Modern glassmorphism UI with gradient backgrounds\n• Enhanced PDF export via Word template with configurable start page\n• Configurable template settings (start page selection)\n• Streamlined PDF Editor UI (merge, split, compress, rotate, watermark, encrypt)\n• Universal File Converter (LibreOffice, ImageMagick, FFmpeg, Pandoc)\n• Windows Explorer context menu integration\n• Tabbed interface for multiple files\n• Advanced markdown editing with live preview\n• Real-time preview updates while typing\n• Full toolbar markdown editing functions\n• Enhanced PDF export with built-in Electron fallback\n• Enhanced Word export with template support (single file & batch)\n• File association support for .md files\n• Command-line interface for batch conversion\n• Advanced export options with templates and metadata\n• Batch file conversion with progress tracking\n• Improved preview typography and spacing\n• Adjustable font sizes via menu (Ctrl+Shift+Plus/Minus)\n• Complete theme support including Monokai fixes\n• Find & replace with match highlighting\n• Line numbers and auto-indentation\n• Export to multiple formats via Pandoc\n• PowerPoint & presentation export\n• Export tables to Excel/ODS spreadsheets\n• Document import & conversion\n• Table creation helper\n• 22 beautiful themes (including Dracula, Nord, Tokyo Night, Gruvbox, Ayu, Concrete, and more)\n• Undo/redo functionality\n• Live word count and statistics',
               buttons: ['OK']
             });
           }
@@ -1263,6 +1263,10 @@ function performExportWithOptions(format, options) {
       pandocCmd += ` --pdf-engine="${pdfEngine}"`;
       if (options.geometry) pandocCmd += ` -V geometry:"${options.geometry}"`;
 
+      // Add monospace font settings for code blocks (ASCII art preservation)
+      pandocCmd += ' -V monofont="Consolas"';
+      pandocCmd += ' --highlight-style=tango';
+
       // Add header/footer if enabled
       if (headerFooterSettings.enabled) {
         const filename = currentFile ? path.basename(currentFile, path.extname(currentFile)) : 'document';
@@ -1338,6 +1342,10 @@ function tryPdfFallback(inputFile, outputFile, engines, index, options, lastErro
   const engine = engines[index];
   let pandocCmd = `${getPandocPath()} "${inputFile}" --pdf-engine=${engine} -o "${outputFile}"`;
 
+  // Add monospace font settings for code blocks (ASCII art preservation)
+  pandocCmd += ' -V monofont="Consolas"';
+  pandocCmd += ' --highlight-style=tango';
+
   // Add geometry if specified
   if (options.geometry) pandocCmd = pandocCmd.replace(` -o `, ` -V geometry:"${options.geometry}" -o `);
 
@@ -1494,7 +1502,7 @@ function exportToHTML(outputFile) {
     const marked = require('marked');
     const markdownContent = fs.readFileSync(currentFile, 'utf8');
     const htmlContent = marked.parse(markdownContent);
-    
+
     const fullHtml = `
 
 
@@ -1514,21 +1522,37 @@ function exportToHTML(outputFile) {
             margin-top: 1.5em;
             margin-bottom: 0.5em;
         }
+        /* Inline code */
         code {
             background: #f4f4f4;
             padding: 2px 4px;
             border-radius: 3px;
             font-family: Consolas, Monaco, 'Courier New', monospace;
+            font-size: 0.9em;
         }
+        /* Code blocks - critical for ASCII art preservation */
         pre {
-            background: #f4f4f4;
+            background: #f5f5f5;
             padding: 1em;
             border-radius: 5px;
             overflow-x: auto;
+            white-space: pre;
+            word-wrap: normal;
+            font-family: Consolas, Monaco, 'Courier New', monospace;
+            font-size: 13px;
+            line-height: 1.4;
+            border: 1px solid #e0e0e0;
+            margin: 1em 0;
         }
         pre code {
             background: transparent;
             padding: 0;
+            font-family: inherit;
+            font-size: inherit;
+            line-height: inherit;
+            white-space: pre;
+            word-wrap: normal;
+            display: block;
         }
         blockquote {
             border-left: 4px solid #ddd;
@@ -1560,6 +1584,18 @@ function exportToHTML(outputFile) {
             max-width: 100%;
             height: auto;
         }
+        @media print {
+            pre {
+                white-space: pre;
+                word-wrap: normal;
+                overflow: visible;
+                page-break-inside: avoid;
+            }
+            pre code {
+                white-space: pre;
+                word-wrap: normal;
+            }
+        }
     
 
 
@@ -1582,7 +1618,7 @@ function exportToPDFElectron(outputFile) {
     const marked = require('marked');
     const markdownContent = fs.readFileSync(currentFile, 'utf8');
     const htmlContent = marked.parse(markdownContent);
-    
+
     const fullHtml = `
 
 
@@ -1602,21 +1638,38 @@ function exportToPDFElectron(outputFile) {
             margin-top: 1.5em;
             margin-bottom: 0.5em;
         }
+        /* Inline code */
         code {
             background: #f4f4f4;
             padding: 2px 4px;
             border-radius: 3px;
             font-family: Consolas, Monaco, 'Courier New', monospace;
+            font-size: 0.9em;
         }
+        /* Code blocks - critical for ASCII art preservation */
         pre {
-            background: #f4f4f4;
+            background: #f5f5f5;
             padding: 1em;
             border-radius: 5px;
-            overflow-x: auto;
+            overflow-x: visible;
+            overflow-y: visible;
+            white-space: pre;
+            word-wrap: normal;
+            font-family: Consolas, Monaco, 'Courier New', monospace;
+            font-size: 12px;
+            line-height: 1.4;
+            border: 1px solid #e0e0e0;
+            margin: 1em 0;
         }
         pre code {
             background: transparent;
             padding: 0;
+            font-family: inherit;
+            font-size: inherit;
+            line-height: inherit;
+            white-space: pre;
+            word-wrap: normal;
+            display: block;
         }
         blockquote {
             border-left: 4px solid #ddd;
@@ -1643,6 +1696,16 @@ function exportToPDFElectron(outputFile) {
         }
         @media print {
             body { padding: 20px; }
+            pre {
+                white-space: pre;
+                word-wrap: normal;
+                overflow: visible;
+                page-break-inside: avoid;
+            }
+            pre code {
+                white-space: pre;
+                word-wrap: normal;
+            }
         }
     
 
@@ -2344,6 +2407,9 @@ function buildPandocCommand(content, format, outputPath) {
   switch (format) {
     case 'pdf':
       command += ' --pdf-engine=xelatex --variable geometry:margin=1in';
+      // Add monospace font settings for code blocks (ASCII art preservation)
+      command += ' -V monofont="Consolas"';
+      command += ' --highlight-style=tango';
 
       // Add header/footer if enabled
       if (headerFooterSettings.enabled) {
diff --git a/src/wordTemplateExporter.js b/src/wordTemplateExporter.js
index dd540f3..06fc42c 100644
--- a/src/wordTemplateExporter.js
+++ b/src/wordTemplateExporter.js
@@ -253,23 +253,39 @@ class WordTemplateExporter {
     }
 
     /**
-     * Create code block XML
+     * Create code block XML - renders each line as separate paragraph
+     * to preserve exact formatting like in preview (monospace, no wrapping)
      */
     createCodeBlockXml(code) {
-        const escapedCode = this.escapeXml(code);
+        const lines = code.split('\n');
+        let xml = '';
 
-        return `
-            
-                
-            
-            
-                
-                    
-                    
-                
-                ${escapedCode}
-            
-        `;
+        lines.forEach((line, index) => {
+            const escapedLine = this.escapeXml(line);
+
+            // Each line gets its own paragraph with exact spacing and no wrapping
+            xml += `
+                
+                    
+                    
+                    
+                    
+                    
+                
+                
+                    
+                        
+                        
+                        
+                        
+                        
+                    
+                    ${escapedLine}
+                
+            `;
+        });
+
+        return xml;
     }
 
     /**
@@ -397,15 +413,22 @@ class WordTemplateExporter {
     isAsciiArt(line) {
         // Don't treat markdown tables as ASCII art
         if (line.trim().startsWith('|') && line.trim().endsWith('|')) {
-            return false;
+            // Check if it's a proper markdown table (has multiple cells)
+            const cells = line.split('|').filter(c => c.trim());
+            if (cells.length >= 2) {
+                return false;
+            }
         }
 
-        // Common ASCII art characters
+        // Common ASCII art characters (Unicode box drawing and symbols)
         const asciiArtChars = [
             '─', '│', 'ā”Œ', '┐', 'ā””', 'ā”˜', 'ā”œ', '┤', '┬', '┓', '┼',  // Box drawing
             '═', 'ā•‘', 'ā•”', 'ā•—', 'ā•š', 'ā•', 'ā• ', 'ā•£', '╦', 'ā•©', '╬',  // Double box
-            'ā–²', 'ā–¼', 'ā—„', 'ā–ŗ', '♦', 'ā—', 'ā—‹', 'ā– ', 'ā–”',             // Shapes
-            '↓', '→', '←', '↑',                                      // Arrows
+            'ā•­', 'ā•®', '╯', 'ā•°',                                      // Rounded corners
+            'ā–²', 'ā–¼', 'ā—„', 'ā–ŗ', '♦', 'ā—', 'ā—‹', 'ā– ', 'ā–”', 'ā—†', 'ā—‡',  // Shapes
+            '↓', '→', '←', '↑', '↔', '↕', '⇒', '⇐', '⇓', '⇑',      // Arrows
+            'ā”ƒ', '━', 'ā”', '┓', 'ā”—', 'ā”›', '┣', '┫', '┳', 'ā”»', 'ā•‹',  // Heavy box
+            'ā–‘', 'ā–’', 'ā–“', 'ā–ˆ',                                      // Shading
         ];
 
         // Check for box drawing characters
@@ -415,14 +438,18 @@ class WordTemplateExporter {
 
         // Check for ASCII box patterns with regular characters
         const asciiPatterns = [
-            /^\s*\+[-=_]+\+/,                    // +-----+
+            /^\s*\+[-=_+]+\+/,                   // +-----+ or +=====+
             /^\s*\|[-=_]{3,}\|/,                 // |-----|
             /^\s*[-=_]{5,}$/,                    // -----
+            /^\s*\+[-]+\+[-]+\+/,                // +---+---+
             /^\s*\([A-Z][a-z]+\)\s*\|\|/,       // (Deformable) ||
             /^\s*\|\s+[A-Z\s]+[-:]\s+[A-Z]/,    // | TILE ADHESIVE - TYPE
             /^\s*\|\s*\[[^\]]+\]/,              // | [BIS Mark / CE Mark]
             /^\s*\|\s{2,}\w+.*\|\|/,            // ||  text  ||
-            /^\s*\[[^\]]+\]/,                   // [Step in brackets]
+            /^\s*\[[^\]]+\]\s*$/,               // [Step in brackets]
+            /^\s*<[-=]+>/,                       // <----> or <====>
+            /^\s*\/[-_\\\/]+\//,                 // /----/
+            /^\s*\*[-=\*]+\*/,                   // *----*
         ];
 
         return asciiPatterns.some(pattern => pattern.test(line));