mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-08-02 18:10:18 +05:30
Release v1.7.9: Enhanced Word Export with Template Support
Major Features: - Template-based Word export with custom template selection - File menu option to select and persist Word templates - Table styling with orange headers and white data rows - ASCII art and flowchart rendering with perfect alignment - Red-colored arrows in flowcharts for enhanced visibility - Markdown numbering stripped from headings and lists Technical Improvements: - Enhanced ASCII art detection for arrows and flowchart patterns - Line-by-line rendering with no-wrap properties - Arrow character detection and red coloring (↓→←↑) - Template path persistence across sessions - Word XML manipulation using PizZip Files Modified: - src/wordTemplateExporter.js: Enhanced ASCII art rendering, table styling - src/main.js: Template selection function and menu integration - CLAUDE.md: Comprehensive v1.7.9 documentation - package.json: Version bump to 1.7.9 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This commit is contained in:
+33
-3
@@ -48,6 +48,7 @@ const store = {
|
||||
let mainWindow;
|
||||
let currentFile = null; // This will now represent the active tab's file
|
||||
let pandocAvailable = null; // Cache pandoc availability check
|
||||
let wordTemplatePath = null; // Path to selected Word template
|
||||
let rendererReady = false; // Track if renderer is ready to receive file data
|
||||
|
||||
// Handle single instance lock for Windows file association
|
||||
@@ -251,6 +252,11 @@ function createMenu() {
|
||||
]
|
||||
},
|
||||
{ type: 'separator' },
|
||||
{
|
||||
label: 'Select Word Template...',
|
||||
click: selectWordTemplate
|
||||
},
|
||||
{ type: 'separator' },
|
||||
{
|
||||
label: 'Quit',
|
||||
accelerator: process.platform === 'darwin' ? 'Cmd+Q' : 'Ctrl+Q',
|
||||
@@ -535,6 +541,27 @@ function showBatchConversionDialog() {
|
||||
mainWindow.webContents.send('show-batch-dialog');
|
||||
}
|
||||
|
||||
// Select Word Template
|
||||
async function selectWordTemplate() {
|
||||
const result = await dialog.showOpenDialog(mainWindow, {
|
||||
title: 'Select Word Template',
|
||||
filters: [{ name: 'Word Document', extensions: ['docx'] }],
|
||||
properties: ['openFile']
|
||||
});
|
||||
|
||||
if (!result.canceled && result.filePaths.length > 0) {
|
||||
wordTemplatePath = result.filePaths[0];
|
||||
store.set('wordTemplatePath', wordTemplatePath);
|
||||
|
||||
dialog.showMessageBox(mainWindow, {
|
||||
type: 'info',
|
||||
title: 'Template Selected',
|
||||
message: 'Word template has been updated',
|
||||
detail: `Template: ${path.basename(wordTemplatePath)}`
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Enhanced Word Export with Template Support
|
||||
async function exportWordWithTemplate() {
|
||||
if (!currentFile) {
|
||||
@@ -555,8 +582,8 @@ async function exportWordWithTemplate() {
|
||||
|
||||
if (result.canceled) return;
|
||||
|
||||
// Create exporter instance
|
||||
const exporter = new WordTemplateExporter();
|
||||
// Create exporter instance with selected template (if any)
|
||||
const exporter = new WordTemplateExporter(wordTemplatePath);
|
||||
|
||||
// Convert markdown to DOCX
|
||||
await exporter.convert(content, result.filePath);
|
||||
@@ -1630,13 +1657,16 @@ function buildPandocCommand(content, format, outputPath) {
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
// Load saved Word template path
|
||||
wordTemplatePath = store.get('wordTemplatePath', null);
|
||||
|
||||
// Check for command line conversion requests
|
||||
const args = process.argv.slice(2);
|
||||
if (args.length >= 2 && (args[0] === '--convert' || args[0] === '--convert-to')) {
|
||||
handleCLIConversion(args);
|
||||
return; // Don't create window for CLI operations
|
||||
}
|
||||
|
||||
|
||||
createWindow();
|
||||
|
||||
// Handle file association on app startup
|
||||
|
||||
Reference in New Issue
Block a user