Compare commits

...
1 Commits
Author SHA1 Message Date
amitwhandClaude Opus 4.5 16c0e00201 Normalize line endings and remove rpm from Linux build targets
- Normalize line endings across all files
- Remove rpm target from Linux build (requires rpmbuild)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 17:58:55 +05:30
42 changed files with 23252 additions and 23253 deletions
+35 -35
View File
@@ -1,36 +1,36 @@
node_modules/ node_modules/
dist/ dist/
*.log *.log
.DS_Store .DS_Store
Thumbs.db Thumbs.db
.env .env
.env.local .env.local
*.swp *.swp
*.swo *.swo
*~ *~
.vscode/ .vscode/
.idea/ .idea/
*.iml *.iml
out/ out/
.cache/ .cache/
.npm/ .npm/
.electron/ .electron/
package-lock.json package-lock.json
# Screenshots and temp files # Screenshots and temp files
*.png.bak *.png.bak
Screen.png Screen.png
dark.png dark.png
light.png light.png
pdf.png pdf.png
uvmodal.png uvmodal.png
nul nul
*.tmp *.tmp
# Development screenshots # Development screenshots
pdf\ modal.png pdf\ modal.png
# Claude/AI development files # Claude/AI development files
.claude/ .claude/
CLAUDE.md CLAUDE.md
agents.md agents.md
+11 -11
View File
@@ -1,11 +1,11 @@
{ {
"semi": true, "semi": true,
"singleQuote": true, "singleQuote": true,
"tabWidth": 2, "tabWidth": 2,
"useTabs": false, "useTabs": false,
"trailingComma": "es5", "trailingComma": "es5",
"bracketSpacing": true, "bracketSpacing": true,
"arrowParens": "always", "arrowParens": "always",
"printWidth": 100, "printWidth": 100,
"endOfLine": "auto" "endOfLine": "auto"
} }
+102 -102
View File
@@ -1,103 +1,103 @@
# Export Functionality Fix - Summary # Export Functionality Fix - Summary
## Issues Found and Fixed ## Issues Found and Fixed
### 1. **Primary Issue: Pandoc Installation Problem** ### 1. **Primary Issue: Pandoc Installation Problem**
- **Problem**: Pandoc is installed but has a system error (paging file too small) - **Problem**: Pandoc is installed but has a system error (paging file too small)
- **Impact**: All pandoc-dependent exports (DOCX, LaTeX, etc.) were failing - **Impact**: All pandoc-dependent exports (DOCX, LaTeX, etc.) were failing
- **Solution**: Added robust fallback mechanisms - **Solution**: Added robust fallback mechanisms
### 2. **Export Function Improvements** ### 2. **Export Function Improvements**
#### Before (Issues): #### Before (Issues):
- ❌ No pandoc availability checking - ❌ No pandoc availability checking
- ❌ Poor error messages - ❌ Poor error messages
- ❌ No fallback for missing pandoc - ❌ No fallback for missing pandoc
- ❌ Limited debugging information - ❌ Limited debugging information
#### After (Fixed): #### After (Fixed):
-**Pandoc Detection**: Automatically checks if pandoc is available -**Pandoc Detection**: Automatically checks if pandoc is available
-**Built-in HTML Export**: Works without pandoc using marked library -**Built-in HTML Export**: Works without pandoc using marked library
-**Built-in PDF Export**: Works without pandoc using Electron's printToPDF -**Built-in PDF Export**: Works without pandoc using Electron's printToPDF
-**Better Error Messages**: Clear instructions for users -**Better Error Messages**: Clear instructions for users
-**Comprehensive Logging**: Debug information in console -**Comprehensive Logging**: Debug information in console
-**Graceful Fallbacks**: Falls back to built-in converters when pandoc fails -**Graceful Fallbacks**: Falls back to built-in converters when pandoc fails
## How It Works Now ## How It Works Now
### Export Process Flow: ### Export Process Flow:
1. **User clicks export** → Check if file is saved 1. **User clicks export** → Check if file is saved
2. **Select output location** → Show save dialog 2. **Select output location** → Show save dialog
3. **Check pandoc availability** → Async pandoc detection 3. **Check pandoc availability** → Async pandoc detection
4. **Choose export method**: 4. **Choose export method**:
- **If pandoc available**: Use pandoc with format-specific options - **If pandoc available**: Use pandoc with format-specific options
- **If pandoc not available**: - **If pandoc not available**:
- HTML → Use built-in marked converter - HTML → Use built-in marked converter
- PDF → Use Electron's printToPDF - PDF → Use Electron's printToPDF
- Other formats → Show helpful error with installation guide - Other formats → Show helpful error with installation guide
### Supported Export Formats: ### Supported Export Formats:
#### ✅ **Always Work** (no pandoc required): #### ✅ **Always Work** (no pandoc required):
- **HTML**: Built-in converter using marked library - **HTML**: Built-in converter using marked library
- **PDF**: Built-in converter using Electron - **PDF**: Built-in converter using Electron
#### ✅ **Work with Pandoc** (better quality): #### ✅ **Work with Pandoc** (better quality):
- **DOCX**: Microsoft Word format - **DOCX**: Microsoft Word format
- **LaTeX**: LaTeX document - **LaTeX**: LaTeX document
- **RTF**: Rich Text Format - **RTF**: Rich Text Format
- **ODT**: OpenDocument Text - **ODT**: OpenDocument Text
- **EPUB**: E-book format - **EPUB**: E-book format
- **PPTX**: PowerPoint presentations - **PPTX**: PowerPoint presentations
- **ODP**: OpenDocument Presentations - **ODP**: OpenDocument Presentations
## Testing the Fixes ## Testing the Fixes
### Manual Test Procedure: ### Manual Test Procedure:
1. **Start the application**: `npm start` 1. **Start the application**: `npm start`
2. **Open test file**: Load `test-export.md` 2. **Open test file**: Load `test-export.md`
3. **Test HTML export**: File → Export → HTML (should work) 3. **Test HTML export**: File → Export → HTML (should work)
4. **Test PDF export**: File → Export → PDF (should work) 4. **Test PDF export**: File → Export → PDF (should work)
5. **Test DOCX export**: File → Export → DOCX (will show pandoc error) 5. **Test DOCX export**: File → Export → DOCX (will show pandoc error)
### Expected Behavior: ### Expected Behavior:
- **HTML/PDF exports**: Should work immediately and create files - **HTML/PDF exports**: Should work immediately and create files
- **Other format exports**: Should show informative error about pandoc - **Other format exports**: Should show informative error about pandoc
- **Console logs**: Should show debug information about export process - **Console logs**: Should show debug information about export process
## Fix Summary ## Fix Summary
### Code Changes Made: ### Code Changes Made:
1. **Added `checkPandocAvailability()` function** - Detects pandoc 1. **Added `checkPandocAvailability()` function** - Detects pandoc
2. **Added `exportToHTML()` function** - Built-in HTML export 2. **Added `exportToHTML()` function** - Built-in HTML export
3. **Added `exportToPDFElectron()` function** - Built-in PDF export 3. **Added `exportToPDFElectron()` function** - Built-in PDF export
4. **Added `exportWithPandoc()` helper** - Generic pandoc export 4. **Added `exportWithPandoc()` helper** - Generic pandoc export
5. **Added `exportWithPandocPDF()` helper** - PDF with fallbacks 5. **Added `exportWithPandocPDF()` helper** - PDF with fallbacks
6. **Improved `exportFile()` function** - Main export logic with detection 6. **Improved `exportFile()` function** - Main export logic with detection
7. **Enhanced error handling** - Better user messages 7. **Enhanced error handling** - Better user messages
8. **Added comprehensive logging** - Debug information 8. **Added comprehensive logging** - Debug information
### Files Modified: ### Files Modified:
- `src/main.js` - Enhanced export functionality - `src/main.js` - Enhanced export functionality
- `test-export.md` - Created test file - `test-export.md` - Created test file
- `test-export-functionality.js` - Created test script - `test-export-functionality.js` - Created test script
## User Instructions ## User Instructions
### For Users Without Pandoc: ### For Users Without Pandoc:
-**HTML and PDF exports work perfectly** -**HTML and PDF exports work perfectly**
-**No additional software needed** -**No additional software needed**
-**Professional-looking output with proper styling** -**Professional-looking output with proper styling**
### For Users Who Want All Formats: ### For Users Who Want All Formats:
1. **Install Pandoc**: Visit https://pandoc.org/installing.html 1. **Install Pandoc**: Visit https://pandoc.org/installing.html
2. **For PDF with LaTeX**: Also install MiKTeX or TeX Live 2. **For PDF with LaTeX**: Also install MiKTeX or TeX Live
3. **Restart the application** after installation 3. **Restart the application** after installation
4. **All export formats will then be available** 4. **All export formats will then be available**
## Result ## Result
🎉 **Export functionality is now working reliably!** 🎉 **Export functionality is now working reliably!**
- Built-in exports (HTML, PDF) work without any dependencies - Built-in exports (HTML, PDF) work without any dependencies
- Clear error messages guide users for advanced formats - Clear error messages guide users for advanced formats
- Robust error handling prevents crashes - Robust error handling prevents crashes
- Better user experience with informative dialogs - Better user experience with informative dialogs
+82 -82
View File
@@ -1,82 +1,82 @@
# GEMINI.md # GEMINI.md
## Project Overview ## Project Overview
This project is a cross-platform Markdown editor and converter named **PanConverter**. It is built using the Electron framework, allowing it to run on Windows, macOS, and Linux. The application provides a rich text editor for writing Markdown, a live preview pane, and robust export capabilities powered by Pandoc. This project is a cross-platform Markdown editor and converter named **PanConverter**. It is built using the Electron framework, allowing it to run on Windows, macOS, and Linux. The application provides a rich text editor for writing Markdown, a live preview pane, and robust export capabilities powered by Pandoc.
The core technologies used are: The core technologies used are:
- **Electron:** For creating the desktop application. - **Electron:** For creating the desktop application.
- **JavaScript:** The primary programming language. - **JavaScript:** The primary programming language.
- **Pandoc:** For converting Markdown to various formats like PDF, DOCX, HTML, etc. - **Pandoc:** For converting Markdown to various formats like PDF, DOCX, HTML, etc.
- **Marked:** For parsing and rendering the Markdown preview in real-time. - **Marked:** For parsing and rendering the Markdown preview in real-time.
- **CodeMirror:** As the underlying text editor component. - **CodeMirror:** As the underlying text editor component.
- **highlight.js:** For syntax highlighting in the editor. - **highlight.js:** For syntax highlighting in the editor.
- **DOMPurify:** To sanitize the HTML output in the preview pane for security. - **DOMPurify:** To sanitize the HTML output in the preview pane for security.
The application features a tabbed interface for working with multiple files, various themes, find and replace functionality, and detailed document statistics. The application features a tabbed interface for working with multiple files, various themes, find and replace functionality, and detailed document statistics.
## Building and Running ## Building and Running
To build and run this project locally, you will need to have Node.js and npm installed. To build and run this project locally, you will need to have Node.js and npm installed.
### Installation ### Installation
1. **Clone the repository:** 1. **Clone the repository:**
```bash ```bash
git clone https://github.com/amitwh/pan-converter.git git clone https://github.com/amitwh/pan-converter.git
cd pan-converter cd pan-converter
``` ```
2. **Install dependencies:** 2. **Install dependencies:**
```bash ```bash
npm install npm install
``` ```
### Running the Application ### Running the Application
To run the application in development mode, use the following command: To run the application in development mode, use the following command:
```bash ```bash
npm start npm start
``` ```
### Building the Application ### Building the Application
You can build the application for different platforms using the scripts defined in `package.json`. You can build the application for different platforms using the scripts defined in `package.json`.
- **Build for the current platform:** - **Build for the current platform:**
```bash ```bash
npm run build npm run build
``` ```
- **Build for a specific platform:** - **Build for a specific platform:**
```bash ```bash
npm run build:win # For Windows npm run build:win # For Windows
npm run build:mac # For macOS npm run build:mac # For macOS
npm run build:linux # For Linux npm run build:linux # For Linux
``` ```
- **Build for all platforms at once:** - **Build for all platforms at once:**
```bash ```bash
npm run dist:all npm run dist:all
``` ```
The distributable files will be located in the `dist/` directory. The distributable files will be located in the `dist/` directory.
### Testing ### Testing
The project does not have a dedicated test suite configured. The `test` script in `package.json` currently returns an error. The project does not have a dedicated test suite configured. The `test` script in `package.json` currently returns an error.
```bash ```bash
npm test npm test
``` ```
## Development Conventions ## Development Conventions
- **Code Style:** The codebase is written in JavaScript (ES6+). There is no linter or formatter configured, but the code generally follows standard JavaScript conventions. - **Code Style:** The codebase is written in JavaScript (ES6+). There is no linter or formatter configured, but the code generally follows standard JavaScript conventions.
- **Main vs. Renderer Process:** The application logic is split between the Electron main process (`src/main.js`) and the renderer process (`src/renderer.js`). - **Main vs. Renderer Process:** The application logic is split between the Electron main process (`src/main.js`) and the renderer process (`src/renderer.js`).
- `src/main.js` handles window management, application menus, file system operations, and communication with the operating system. - `src/main.js` handles window management, application menus, file system operations, and communication with the operating system.
- `src/renderer.js` manages the user interface, editor functionality, and the Markdown preview. - `src/renderer.js` manages the user interface, editor functionality, and the Markdown preview.
- **Dependencies:** Project dependencies are managed through `package.json`. `devDependencies` are used for the build process, while `dependencies` are required for the application to run. - **Dependencies:** Project dependencies are managed through `package.json`. `devDependencies` are used for the build process, while `dependencies` are required for the application to run.
- **User Data:** The application stores settings and recent files in the user's application data directory. - **User Data:** The application stores settings and recent files in the user's application data directory.
- **Pandoc Integration:** The application relies on a system-installed version of Pandoc for its export functionality. It does not bundle Pandoc. - **Pandoc Integration:** The application relies on a system-installed version of Pandoc for its export functionality. It does not bundle Pandoc.
+1478 -1478
View File
File diff suppressed because it is too large Load Diff
+20 -20
View File
@@ -1,21 +1,21 @@
MIT License MIT License
Copyright (c) 2024 Amit Haridas Copyright (c) 2024 Amit Haridas
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software. copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
+12 -12
View File
@@ -1,12 +1,12 @@
# Test Double-Click File Opening # Test Double-Click File Opening
This is a test file to verify double-click functionality. This is a test file to verify double-click functionality.
## Features to Test ## Features to Test
- File should load automatically - File should load automatically
- Content should display in editor - Content should display in editor
- Tab should show filename - Tab should show filename
- Preview should render markdown - Preview should render markdown
**This text should be bold** **This text should be bold**
*This text should be italic* *This text should be italic*
+378 -378
View File
@@ -1,378 +1,378 @@
\hypertarget{panconverter}{% \hypertarget{panconverter}{%
\section{PanConverter}\label{panconverter}} \section{PanConverter}\label{panconverter}}
A cross-platform Markdown editor and converter powered by Pandoc. A cross-platform Markdown editor and converter powered by Pandoc.
\begin{figure} \begin{figure}
\centering \centering
\includegraphics{assets/icon.png} \includegraphics{assets/icon.png}
\caption{PanConverter} \caption{PanConverter}
\end{figure} \end{figure}
\hypertarget{features}{% \hypertarget{features}{%
\subsection{Features}\label{features}} \subsection{Features}\label{features}}
\hypertarget{advanced-markdown-editor}{% \hypertarget{advanced-markdown-editor}{%
\subsubsection{✨ Advanced Markdown \subsubsection{✨ Advanced Markdown
Editor}\label{advanced-markdown-editor}} Editor}\label{advanced-markdown-editor}}
\begin{itemize} \begin{itemize}
\tightlist \tightlist
\item \item
🗂️ \textbf{Tabbed Interface} - Work with multiple files simultaneously 🗂️ \textbf{Tabbed Interface} - Work with multiple files simultaneously
in separate tabs in separate tabs
\item \item
📝 \textbf{Rich Text Editor} - Full-featured editor with syntax 📝 \textbf{Rich Text Editor} - Full-featured editor with syntax
highlighting and comprehensive toolbar highlighting and comprehensive toolbar
\item \item
🔍 \textbf{Find \& Replace} - Powerful search and replace with match 🔍 \textbf{Find \& Replace} - Powerful search and replace with match
highlighting and navigation highlighting and navigation
\item \item
🔢 \textbf{Line Numbers} - Toggle line numbers for easier code editing 🔢 \textbf{Line Numbers} - Toggle line numbers for easier code editing
and navigation and navigation
\item \item
↩️ \textbf{Smart Auto-Indentation} - Automatic list continuation and ↩️ \textbf{Smart Auto-Indentation} - Automatic list continuation and
intelligent indentation intelligent indentation
\item \item
⏪ \textbf{Undo/Redo} - Full undo/redo support with keyboard shortcuts ⏪ \textbf{Undo/Redo} - Full undo/redo support with keyboard shortcuts
\item \item
⌨️ \textbf{Advanced Shortcuts} - Tab indentation, line selection, and ⌨️ \textbf{Advanced Shortcuts} - Tab indentation, line selection, and
smart text formatting smart text formatting
\item \item
📂 \textbf{File Association Support} - Open markdown files directly 📂 \textbf{File Association Support} - Open markdown files directly
from file manager from file manager
\end{itemize} \end{itemize}
\hypertarget{themes-interface}{% \hypertarget{themes-interface}{%
\subsubsection{🎨 Themes \& Interface}\label{themes-interface}} \subsubsection{🎨 Themes \& Interface}\label{themes-interface}}
\begin{itemize} \begin{itemize}
\tightlist \tightlist
\item \item
👁️ \textbf{Live Preview} - See your markdown rendered in real-time 👁️ \textbf{Live Preview} - See your markdown rendered in real-time
with synchronized scrolling with synchronized scrolling
\item \item
🎨 \textbf{Multiple Themes} - Choose from Light, Dark, Solarized, 🎨 \textbf{Multiple Themes} - Choose from Light, Dark, Solarized,
Monokai, or GitHub themes Monokai, or GitHub themes
\item \item
💾 \textbf{Auto-Save} - Never lose your work with automatic saving 💾 \textbf{Auto-Save} - Never lose your work with automatic saving
every 30 seconds every 30 seconds
\end{itemize} \end{itemize}
\hypertarget{export-conversion}{% \hypertarget{export-conversion}{%
\subsubsection{📤 Export \& Conversion}\label{export-conversion}} \subsubsection{📤 Export \& Conversion}\label{export-conversion}}
\begin{itemize} \begin{itemize}
\tightlist \tightlist
\item \item
📄 \textbf{Enhanced PDF Export} - Robust PDF generation with multiple 📄 \textbf{Enhanced PDF Export} - Robust PDF generation with multiple
LaTeX engine fallbacks (XeLaTeX, PDFLaTeX, wkhtmltopdf) LaTeX engine fallbacks (XeLaTeX, PDFLaTeX, wkhtmltopdf)
\item \item
📄 \textbf{Document Export} - Convert to HTML, DOCX, LaTeX, RTF, ODT, 📄 \textbf{Document Export} - Convert to HTML, DOCX, LaTeX, RTF, ODT,
EPUB, PowerPoint (PPTX), and OpenDocument Presentation (ODP) EPUB, PowerPoint (PPTX), and OpenDocument Presentation (ODP)
\item \item
📊 \textbf{Spreadsheet Export} - Export markdown tables to Excel 📊 \textbf{Spreadsheet Export} - Export markdown tables to Excel
(XLSX/XLS) and OpenDocument Spreadsheet (ODS) formats (XLSX/XLS) and OpenDocument Spreadsheet (ODS) formats
\item \item
📥 \textbf{Document Import} - Import DOCX, ODT, RTF, HTML, PDF, and 📥 \textbf{Document Import} - Import DOCX, ODT, RTF, HTML, PDF, and
presentation files to markdown presentation files to markdown
\item \item
📋 \textbf{Table Creation Helper} - Built-in table generator for easy 📋 \textbf{Table Creation Helper} - Built-in table generator for easy
markdown table creation markdown table creation
\end{itemize} \end{itemize}
\hypertarget{platform-support}{% \hypertarget{platform-support}{%
\subsubsection{🖥️ Platform Support}\label{platform-support}} \subsubsection{🖥️ Platform Support}\label{platform-support}}
\begin{itemize} \begin{itemize}
\tightlist \tightlist
\item \item
\textbf{Cross-Platform} - Works seamlessly on Windows, macOS, and \textbf{Cross-Platform} - Works seamlessly on Windows, macOS, and
Linux Linux
\end{itemize} \end{itemize}
\hypertarget{installation}{% \hypertarget{installation}{%
\subsection{Installation}\label{installation}} \subsection{Installation}\label{installation}}
\hypertarget{prerequisites}{% \hypertarget{prerequisites}{%
\subsubsection{Prerequisites}\label{prerequisites}} \subsubsection{Prerequisites}\label{prerequisites}}
\begin{itemize} \begin{itemize}
\tightlist \tightlist
\item \item
\href{https://pandoc.org/installing.html}{Pandoc} must be installed \href{https://pandoc.org/installing.html}{Pandoc} must be installed
for export functionality for export functionality
\begin{itemize} \begin{itemize}
\tightlist \tightlist
\item \item
\textbf{Ubuntu/Debian}: \texttt{sudo\ apt-get\ install\ pandoc} \textbf{Ubuntu/Debian}: \texttt{sudo\ apt-get\ install\ pandoc}
\item \item
\textbf{macOS}: \texttt{brew\ install\ pandoc} \textbf{macOS}: \texttt{brew\ install\ pandoc}
\item \item
\textbf{Windows}: Download installer from Pandoc website \textbf{Windows}: Download installer from Pandoc website
\end{itemize} \end{itemize}
\end{itemize} \end{itemize}
\hypertarget{pdf-export-requirements}{% \hypertarget{pdf-export-requirements}{%
\subsubsection{PDF Export Requirements}\label{pdf-export-requirements}} \subsubsection{PDF Export Requirements}\label{pdf-export-requirements}}
For optimal PDF export, install a LaTeX engine (recommended): - For optimal PDF export, install a LaTeX engine (recommended): -
\textbf{Ubuntu/Debian}: \textbf{Ubuntu/Debian}:
\texttt{sudo\ apt-get\ install\ texlive-xetex\ texlive-latex-base} - \texttt{sudo\ apt-get\ install\ texlive-xetex\ texlive-latex-base} -
\textbf{macOS}: \texttt{brew\ install\ -\/-cask\ mactex} - \textbf{macOS}: \texttt{brew\ install\ -\/-cask\ mactex} -
\textbf{Windows}: Install MiKTeX or TeX Live - \textbf{Alternative}: \textbf{Windows}: Install MiKTeX or TeX Live - \textbf{Alternative}:
\texttt{sudo\ apt-get\ install\ wkhtmltopdf} (fallback option) \texttt{sudo\ apt-get\ install\ wkhtmltopdf} (fallback option)
\hypertarget{download}{% \hypertarget{download}{%
\subsubsection{Download}\label{download}} \subsubsection{Download}\label{download}}
Download the latest release for your platform from the Download the latest release for your platform from the
\href{https://github.com/amitwh/pan-converter/releases}{Releases} page. \href{https://github.com/amitwh/pan-converter/releases}{Releases} page.
\hypertarget{linux}{% \hypertarget{linux}{%
\paragraph{Linux}\label{linux}} \paragraph{Linux}\label{linux}}
\begin{itemize} \begin{itemize}
\tightlist \tightlist
\item \item
\textbf{AppImage}: \texttt{PanConverter-1.3.1.AppImage} (universal, \textbf{AppImage}: \texttt{PanConverter-1.3.1.AppImage} (universal,
may require \texttt{-\/-no-sandbox} flag) may require \texttt{-\/-no-sandbox} flag)
\item \item
\textbf{Debian Package}: \texttt{pan-converter\_1.3.1\_amd64.deb} \textbf{Debian Package}: \texttt{pan-converter\_1.3.1\_amd64.deb}
\item \item
\textbf{Snap Package}: \texttt{pan-converter\_1.3.1\_amd64.snap} \textbf{Snap Package}: \texttt{pan-converter\_1.3.1\_amd64.snap}
\end{itemize} \end{itemize}
\hypertarget{install-from-source}{% \hypertarget{install-from-source}{%
\subsubsection{Install from Source}\label{install-from-source}} \subsubsection{Install from Source}\label{install-from-source}}
\begin{Shaded} \begin{Shaded}
\begin{Highlighting}[] \begin{Highlighting}[]
\FunctionTok{git}\NormalTok{ clone https://github.com/amitwh/pan{-}converter.git} \FunctionTok{git}\NormalTok{ clone https://github.com/amitwh/pan{-}converter.git}
\BuiltInTok{cd}\NormalTok{ pan{-}converter} \BuiltInTok{cd}\NormalTok{ pan{-}converter}
\ExtensionTok{npm}\NormalTok{ install} \ExtensionTok{npm}\NormalTok{ install}
\ExtensionTok{npm}\NormalTok{ start} \ExtensionTok{npm}\NormalTok{ start}
\end{Highlighting} \end{Highlighting}
\end{Shaded} \end{Shaded}
\hypertarget{usage}{% \hypertarget{usage}{%
\subsection{Usage}\label{usage}} \subsection{Usage}\label{usage}}
\hypertarget{basic-workflow}{% \hypertarget{basic-workflow}{%
\subsubsection{Basic Workflow}\label{basic-workflow}} \subsubsection{Basic Workflow}\label{basic-workflow}}
\begin{enumerate} \begin{enumerate}
\def\labelenumi{\arabic{enumi}.} \def\labelenumi{\arabic{enumi}.}
\tightlist \tightlist
\item \item
\textbf{Write} - Use the editor to write your Markdown content \textbf{Write} - Use the editor to write your Markdown content
\item \item
\textbf{Preview} - Toggle the preview pane to see rendered output \textbf{Preview} - Toggle the preview pane to see rendered output
\item \item
\textbf{Theme} - Choose your preferred theme from the View menu \textbf{Theme} - Choose your preferred theme from the View menu
\item \item
\textbf{Export} - Export your document to various formats \textbf{Export} - Export your document to various formats
\end{enumerate} \end{enumerate}
\hypertarget{export-options}{% \hypertarget{export-options}{%
\subsubsection{Export Options}\label{export-options}} \subsubsection{Export Options}\label{export-options}}
\begin{itemize} \begin{itemize}
\tightlist \tightlist
\item \item
\textbf{Documents}: HTML, PDF, DOCX, LaTeX, RTF, ODT, EPUB \textbf{Documents}: HTML, PDF, DOCX, LaTeX, RTF, ODT, EPUB
\item \item
\textbf{Presentations}: PowerPoint (PPTX), OpenDocument Presentation \textbf{Presentations}: PowerPoint (PPTX), OpenDocument Presentation
(ODP) (ODP)
\item \item
\textbf{Spreadsheets}: Excel (XLSX/XLS), OpenDocument Spreadsheet \textbf{Spreadsheets}: Excel (XLSX/XLS), OpenDocument Spreadsheet
(ODS) (ODS)
\end{itemize} \end{itemize}
\hypertarget{import-conversion}{% \hypertarget{import-conversion}{%
\subsubsection{Import \& Conversion}\label{import-conversion}} \subsubsection{Import \& Conversion}\label{import-conversion}}
\begin{itemize} \begin{itemize}
\tightlist \tightlist
\item \item
\textbf{Import Documents}: Convert DOCX, ODT, RTF, HTML, PDF, and \textbf{Import Documents}: Convert DOCX, ODT, RTF, HTML, PDF, and
presentation files to Markdown presentation files to Markdown
\item \item
\textbf{Cross-Format Conversion}: Convert current file between \textbf{Cross-Format Conversion}: Convert current file between
multiple formats multiple formats
\item \item
\textbf{Smart Presentation Handling}: Automatic slide-level formatting \textbf{Smart Presentation Handling}: Automatic slide-level formatting
for PPTX/ODP exports for PPTX/ODP exports
\end{itemize} \end{itemize}
\hypertarget{table-creation}{% \hypertarget{table-creation}{%
\subsubsection{Table Creation}\label{table-creation}} \subsubsection{Table Creation}\label{table-creation}}
\begin{itemize} \begin{itemize}
\tightlist \tightlist
\item \item
Click the table button in the toolbar Click the table button in the toolbar
\item \item
Specify number of rows and columns Specify number of rows and columns
\item \item
Automatically generates properly formatted Markdown tables Automatically generates properly formatted Markdown tables
\end{itemize} \end{itemize}
\hypertarget{keyboard-shortcuts}{% \hypertarget{keyboard-shortcuts}{%
\subsection{Keyboard Shortcuts}\label{keyboard-shortcuts}} \subsection{Keyboard Shortcuts}\label{keyboard-shortcuts}}
\hypertarget{file-operations}{% \hypertarget{file-operations}{%
\subsubsection{File Operations}\label{file-operations}} \subsubsection{File Operations}\label{file-operations}}
\begin{itemize} \begin{itemize}
\tightlist \tightlist
\item \item
\texttt{Ctrl/Cmd\ +\ N} - New file/tab \texttt{Ctrl/Cmd\ +\ N} - New file/tab
\item \item
\texttt{Ctrl/Cmd\ +\ T} - New tab \texttt{Ctrl/Cmd\ +\ T} - New tab
\item \item
\texttt{Ctrl/Cmd\ +\ W} - Close current tab \texttt{Ctrl/Cmd\ +\ W} - Close current tab
\item \item
\texttt{Ctrl/Cmd\ +\ Tab} - Switch to next tab \texttt{Ctrl/Cmd\ +\ Tab} - Switch to next tab
\item \item
\texttt{Ctrl/Cmd\ +\ O} - Open file \texttt{Ctrl/Cmd\ +\ O} - Open file
\item \item
\texttt{Ctrl/Cmd\ +\ S} - Save file \texttt{Ctrl/Cmd\ +\ S} - Save file
\item \item
\texttt{Ctrl/Cmd\ +\ Shift\ +\ S} - Save as \texttt{Ctrl/Cmd\ +\ Shift\ +\ S} - Save as
\item \item
\texttt{Ctrl/Cmd\ +\ I} - Import document \texttt{Ctrl/Cmd\ +\ I} - Import document
\end{itemize} \end{itemize}
\hypertarget{editor-features}{% \hypertarget{editor-features}{%
\subsubsection{Editor Features}\label{editor-features}} \subsubsection{Editor Features}\label{editor-features}}
\begin{itemize} \begin{itemize}
\tightlist \tightlist
\item \item
\texttt{Ctrl/Cmd\ +\ F} - Find \& Replace \texttt{Ctrl/Cmd\ +\ F} - Find \& Replace
\item \item
\texttt{Ctrl/Cmd\ +\ Z} - Undo \texttt{Ctrl/Cmd\ +\ Z} - Undo
\item \item
\texttt{Ctrl/Cmd\ +\ Shift\ +\ Z} - Redo \texttt{Ctrl/Cmd\ +\ Shift\ +\ Z} - Redo
\item \item
\texttt{Tab} - Indent lines or insert 4 spaces \texttt{Tab} - Indent lines or insert 4 spaces
\item \item
\texttt{Shift\ +\ Tab} - Outdent selected lines \texttt{Shift\ +\ Tab} - Outdent selected lines
\item \item
\texttt{Enter} - Auto-continue lists with proper indentation \texttt{Enter} - Auto-continue lists with proper indentation
\end{itemize} \end{itemize}
\hypertarget{view-navigation}{% \hypertarget{view-navigation}{%
\subsubsection{View \& Navigation}\label{view-navigation}} \subsubsection{View \& Navigation}\label{view-navigation}}
\begin{itemize} \begin{itemize}
\tightlist \tightlist
\item \item
\texttt{Ctrl/Cmd\ +\ P} - Toggle preview \texttt{Ctrl/Cmd\ +\ P} - Toggle preview
\item \item
\texttt{Ctrl/Cmd\ +\ Enter} - Toggle preview (alternative) \texttt{Ctrl/Cmd\ +\ Enter} - Toggle preview (alternative)
\item \item
\texttt{Escape} - Close find dialog \texttt{Escape} - Close find dialog
\end{itemize} \end{itemize}
\hypertarget{building}{% \hypertarget{building}{%
\subsection{Building}\label{building}} \subsection{Building}\label{building}}
\begin{Shaded} \begin{Shaded}
\begin{Highlighting}[] \begin{Highlighting}[]
\CommentTok{\# Install dependencies} \CommentTok{\# Install dependencies}
\ExtensionTok{npm}\NormalTok{ install} \ExtensionTok{npm}\NormalTok{ install}
\CommentTok{\# Generate icons} \CommentTok{\# Generate icons}
\ExtensionTok{npm}\NormalTok{ run generate{-}icons} \ExtensionTok{npm}\NormalTok{ run generate{-}icons}
\CommentTok{\# Build for current platform} \CommentTok{\# Build for current platform}
\ExtensionTok{npm}\NormalTok{ run build} \ExtensionTok{npm}\NormalTok{ run build}
\CommentTok{\# Build for specific platform} \CommentTok{\# Build for specific platform}
\ExtensionTok{npm}\NormalTok{ run build:win }\CommentTok{\# Windows} \ExtensionTok{npm}\NormalTok{ run build:win }\CommentTok{\# Windows}
\ExtensionTok{npm}\NormalTok{ run build:mac }\CommentTok{\# macOS } \ExtensionTok{npm}\NormalTok{ run build:mac }\CommentTok{\# macOS }
\ExtensionTok{npm}\NormalTok{ run build:linux }\CommentTok{\# Linux (generates .deb, .AppImage, and .snap)} \ExtensionTok{npm}\NormalTok{ run build:linux }\CommentTok{\# Linux (generates .deb, .AppImage, and .snap)}
\CommentTok{\# Build for all platforms} \CommentTok{\# Build for all platforms}
\ExtensionTok{npm}\NormalTok{ run dist:all} \ExtensionTok{npm}\NormalTok{ run dist:all}
\end{Highlighting} \end{Highlighting}
\end{Shaded} \end{Shaded}
\hypertarget{version-history}{% \hypertarget{version-history}{%
\subsection{Version History}\label{version-history}} \subsection{Version History}\label{version-history}}
\begin{itemize} \begin{itemize}
\tightlist \tightlist
\item \item
\textbf{v1.3.1} - Bug fixes: Fixed file associations for \textbf{v1.3.1} - Bug fixes: Fixed file associations for
double-clicking .md files, corrected 50/50 layout alignment for double-clicking .md files, corrected 50/50 layout alignment for
editor/preview panes editor/preview panes
\item \item
\textbf{v1.3.0} - Major update: Tabbed interface for multiple files, \textbf{v1.3.0} - Major update: Tabbed interface for multiple files,
enhanced PDF export with LaTeX engines, fixed file associations, enhanced PDF export with LaTeX engines, fixed file associations,
removed redundant converter menu, improved UI architecture removed redundant converter menu, improved UI architecture
\item \item
\textbf{v1.2.1} - Comprehensive editor enhancements: Find \& Replace, \textbf{v1.2.1} - Comprehensive editor enhancements: Find \& Replace,
Line Numbers, Undo/Redo, Auto-indentation, PowerPoint export, document Line Numbers, Undo/Redo, Auto-indentation, PowerPoint export, document
conversion menu, table creation helper, spreadsheet export conversion menu, table creation helper, spreadsheet export
\item \item
\textbf{v1.1.0} - Added Excel/ODS spreadsheet export, updated author \textbf{v1.1.0} - Added Excel/ODS spreadsheet export, updated author
information, renamed to PanConverter information, renamed to PanConverter
\item \item
\textbf{v1.0.0} - Initial release with basic markdown editing, themes, \textbf{v1.0.0} - Initial release with basic markdown editing, themes,
and Pandoc export and Pandoc export
\end{itemize} \end{itemize}
\hypertarget{known-issues}{% \hypertarget{known-issues}{%
\subsection{Known Issues}\label{known-issues}} \subsection{Known Issues}\label{known-issues}}
\begin{itemize} \begin{itemize}
\tightlist \tightlist
\item \item
AppImage may require \texttt{-\/-no-sandbox} flag on some Linux AppImage may require \texttt{-\/-no-sandbox} flag on some Linux
systems systems
\item \item
Windows/Mac builds require platform-specific build environments Windows/Mac builds require platform-specific build environments
\item \item
Large files may cause performance issues Large files may cause performance issues
\end{itemize} \end{itemize}
\hypertarget{contributing}{% \hypertarget{contributing}{%
\subsection{Contributing}\label{contributing}} \subsection{Contributing}\label{contributing}}
Contributions are welcome! Please feel free to submit a Pull Request to Contributions are welcome! Please feel free to submit a Pull Request to
the \href{https://github.com/amitwh/pan-converter}{GitHub repository}. the \href{https://github.com/amitwh/pan-converter}{GitHub repository}.
\hypertarget{license}{% \hypertarget{license}{%
\subsection{License}\label{license}} \subsection{License}\label{license}}
MIT License - see LICENSE file for details. MIT License - see LICENSE file for details.
\hypertarget{author}{% \hypertarget{author}{%
\subsection{Author}\label{author}} \subsection{Author}\label{author}}
\textbf{Amit Haridas} - \textbf{Amit Haridas} -
\href{mailto:amit.wh@gmail.com}{\nolinkurl{amit.wh@gmail.com}} \href{mailto:amit.wh@gmail.com}{\nolinkurl{amit.wh@gmail.com}}
\hypertarget{acknowledgments}{% \hypertarget{acknowledgments}{%
\subsection{Acknowledgments}\label{acknowledgments}} \subsection{Acknowledgments}\label{acknowledgments}}
\begin{itemize} \begin{itemize}
\tightlist \tightlist
\item \item
Built with \href{https://www.electronjs.org/}{Electron} Built with \href{https://www.electronjs.org/}{Electron}
\item \item
Markdown parsing by \href{https://marked.js.org/}{marked} Markdown parsing by \href{https://marked.js.org/}{marked}
\item \item
Export functionality powered by \href{https://pandoc.org/}{Pandoc} Export functionality powered by \href{https://pandoc.org/}{Pandoc}
\item \item
Syntax highlighting by \href{https://highlightjs.org/}{highlight.js} Syntax highlighting by \href{https://highlightjs.org/}{highlight.js}
\item \item
Spreadsheet export by \href{https://www.npmjs.com/package/xlsx}{XLSX} Spreadsheet export by \href{https://www.npmjs.com/package/xlsx}{XLSX}
\item \item
HTML sanitization by HTML sanitization by
\href{https://www.npmjs.com/package/dompurify}{DOMPurify} \href{https://www.npmjs.com/package/dompurify}{DOMPurify}
\end{itemize} \end{itemize}
+165 -165
View File
@@ -1,165 +1,165 @@
# MarkdownConverter # MarkdownConverter
A powerful cross-platform Markdown editor and document converter powered by Pandoc, built with Electron. 100% open-source with no proprietary dependencies. A powerful cross-platform Markdown editor and document converter powered by Pandoc, built with Electron. 100% open-source with no proprietary dependencies.
## Features ## Features
### Markdown Editor ### Markdown Editor
<img width="1920" height="1032" alt="image" src="https://github.com/user-attachments/assets/5f53ba94-7663-47c3-b12b-b7b8bd2645aa" /> <img width="1920" height="1032" alt="image" src="https://github.com/user-attachments/assets/5f53ba94-7663-47c3-b12b-b7b8bd2645aa" />
- **Multi-tab editing** - Work on multiple files simultaneously - **Multi-tab editing** - Work on multiple files simultaneously
- **Live preview** - Real-time markdown rendering with syntax highlighting - **Live preview** - Real-time markdown rendering with syntax highlighting
- **Dynamic splitter** - Drag to resize editor and preview panes - **Dynamic splitter** - Drag to resize editor and preview panes
- **25+ themes** - Light and dark themes including Atom One Light, Dracula, Nord, Sepia, and more - **25+ themes** - Light and dark themes including Atom One Light, Dracula, Nord, Sepia, and more
- **Find & Replace** - Search and replace with regex support - **Find & Replace** - Search and replace with regex support
- **Line numbers** - Toggle line numbers in the editor - **Line numbers** - Toggle line numbers in the editor
- **Auto-save** - Automatic saving every 30 seconds - **Auto-save** - Automatic saving every 30 seconds
- **Math support** - KaTeX integration for mathematical expressions - **Math support** - KaTeX integration for mathematical expressions
### PDF Viewer & Editor ### PDF Viewer & Editor
<img width="1920" height="1032" alt="image" src="https://github.com/user-attachments/assets/f10f62be-af3d-496e-81df-37ab4f91abfd" /> <img width="1920" height="1032" alt="image" src="https://github.com/user-attachments/assets/f10f62be-af3d-496e-81df-37ab4f91abfd" />
- **Built-in PDF viewer** - Open and view PDF files directly in the app - **Built-in PDF viewer** - Open and view PDF files directly in the app
- **Page navigation** - Navigate pages with keyboard or buttons - **Page navigation** - Navigate pages with keyboard or buttons
- **Zoom controls** - Zoom in/out, fit to width, fit to page - **Zoom controls** - Zoom in/out, fit to width, fit to page
- **Rotation** - Rotate pages left or right - **Rotation** - Rotate pages left or right
- **PDF Editor tools**: - **PDF Editor tools**:
- Merge multiple PDFs - Merge multiple PDFs
- Split PDFs by page range - Split PDFs by page range
- Compress PDFs - Compress PDFs
- Rotate pages - Rotate pages
- Delete pages - Delete pages
- Reorder pages - Reorder pages
- Add watermarks - Add watermarks
- Password protection - Password protection
- Remove passwords - Remove passwords
- Set permissions - Set permissions
### Export Options ### Export Options
- **PDF** - Export to PDF with customizable page sizes and orientation - **PDF** - Export to PDF with customizable page sizes and orientation
- **DOCX** - Standard and Enhanced (template-based) Word export - **DOCX** - Standard and Enhanced (template-based) Word export
- **ODT** - OpenDocument format - **ODT** - OpenDocument format
- **HTML** - Web-ready HTML export - **HTML** - Web-ready HTML export
- **PowerPoint** - PPTX presentation export - **PowerPoint** - PPTX presentation export
- **EPUB** - E-book format - **EPUB** - E-book format
- **LaTeX** - Academic document format - **LaTeX** - Academic document format
- **RTF** - Rich Text Format - **RTF** - Rich Text Format
### Advanced Features ### Advanced Features
- **Custom headers & footers** - Add headers/footers to exports with dynamic fields - **Custom headers & footers** - Add headers/footers to exports with dynamic fields
- **Page size configuration** - A3, A4, A5, B4, B5, Letter, Legal, Tabloid, or custom sizes - **Page size configuration** - A3, A4, A5, B4, B5, Letter, Legal, Tabloid, or custom sizes
- **Batch conversion** - Convert entire folders of markdown files - **Batch conversion** - Convert entire folders of markdown files
- **ASCII Art Generator** - Create text banners and diagrams - **ASCII Art Generator** - Create text banners and diagrams
- **Word templates** - Use custom Word templates for enhanced exports - **Word templates** - Use custom Word templates for enhanced exports
- **Import documents** - Import from 30+ formats (DOCX, PDF, HTML, etc.) - **Import documents** - Import from 30+ formats (DOCX, PDF, HTML, etc.)
## Installation ## Installation
### Prerequisites ### Prerequisites
- [Node.js](https://nodejs.org/) (v16 or later) - [Node.js](https://nodejs.org/) (v16 or later)
- [Pandoc](https://pandoc.org/installing.html) (required for export functionality) - [Pandoc](https://pandoc.org/installing.html) (required for export functionality)
### Install Dependencies ### Install Dependencies
```bash ```bash
npm install npm install
``` ```
### Run the Application ### Run the Application
```bash ```bash
npm start npm start
``` ```
### Build for Distribution ### Build for Distribution
```bash ```bash
# Windows # Windows
npm run build:win npm run build:win
# macOS # macOS
npm run build:mac npm run build:mac
# Linux # Linux
npm run build:linux npm run build:linux
``` ```
## Keyboard Shortcuts ## Keyboard Shortcuts
| Action | Shortcut | | Action | Shortcut |
|--------|----------| |--------|----------|
| New File | Ctrl+N | | New File | Ctrl+N |
| Open File | Ctrl+O | | Open File | Ctrl+O |
| Open PDF | Ctrl+Shift+O | | Open PDF | Ctrl+Shift+O |
| Save | Ctrl+S | | Save | Ctrl+S |
| Save As | Ctrl+Shift+S | | Save As | Ctrl+Shift+S |
| Export | Ctrl+E | | Export | Ctrl+E |
| Print | Ctrl+P | | Print | Ctrl+P |
| Find | Ctrl+F | | Find | Ctrl+F |
| Undo | Ctrl+Z | | Undo | Ctrl+Z |
| Redo | Ctrl+Shift+Z | | Redo | Ctrl+Shift+Z |
| New Tab | Ctrl+T | | New Tab | Ctrl+T |
| Close Tab | Ctrl+W | | Close Tab | Ctrl+W |
| Toggle Preview | Ctrl+Shift+P | | Toggle Preview | Ctrl+Shift+P |
| Zoom In | Ctrl+Shift++ | | Zoom In | Ctrl+Shift++ |
| Zoom Out | Ctrl+Shift+- | | Zoom Out | Ctrl+Shift+- |
## Themes ## Themes
### Light Themes ### Light Themes
- Atom One Light (Default) - Atom One Light (Default)
- GitHub Light - GitHub Light
- Light - Light
- Solarized Light - Solarized Light
- Gruvbox Light - Gruvbox Light
- Ayu Light - Ayu Light
- Sepia - Sepia
- Paper - Paper
- Rose Pine Dawn - Rose Pine Dawn
- Concrete Light - Concrete Light
### Dark Themes ### Dark Themes
- Dark - Dark
- One Dark - One Dark
- Dracula - Dracula
- Nord - Nord
- Monokai - Monokai
- Material - Material
- Gruvbox Dark - Gruvbox Dark
- Tokyo Night - Tokyo Night
- Palenight - Palenight
- Ayu Dark - Ayu Dark
- Ayu Mirage - Ayu Mirage
- Oceanic Next - Oceanic Next
- Cobalt2 - Cobalt2
- Concrete Dark - Concrete Dark
- Concrete Warm - Concrete Warm
## PDF Viewer ## PDF Viewer
Open PDF files directly in MarkdownConverter: Open PDF files directly in MarkdownConverter:
- **File > Open PDF** or **Ctrl+Shift+O** - **File > Open PDF** or **Ctrl+Shift+O**
- Navigate pages with arrow buttons or page input - Navigate pages with arrow buttons or page input
- Zoom controls: +/- buttons, Fit Width, Fit Page - Zoom controls: +/- buttons, Fit Width, Fit Page
- Rotate pages left or right - Rotate pages left or right
- Close PDF to return to editor - Close PDF to return to editor
## Open Source ## Open Source
MarkdownConverter is 100% open-source. All dependencies are permissively licensed: MarkdownConverter is 100% open-source. All dependencies are permissively licensed:
- **Electron** - MIT License - **Electron** - MIT License
- **pdf-lib** - MIT License - **pdf-lib** - MIT License
- **pdfjs-dist** - Apache 2.0 License - **pdfjs-dist** - Apache 2.0 License
- **marked** - MIT License - **marked** - MIT License
- **highlight.js** - BSD 3-Clause License - **highlight.js** - BSD 3-Clause License
- **dompurify** - Apache 2.0/MIT License - **dompurify** - Apache 2.0/MIT License
- **docx** - MIT License - **docx** - MIT License
- **xlsx** - Apache 2.0 License (SheetJS Community Edition) - **xlsx** - Apache 2.0 License (SheetJS Community Edition)
## License ## License
MIT License - see LICENSE file for details. MIT License - see LICENSE file for details.
## Author ## Author
Amit Haridas (amit.wh@gmail.com) Amit Haridas (amit.wh@gmail.com)
## Version ## Version
v3.0.0 v3.0.0
+166 -166
View File
@@ -1,166 +1,166 @@
# PanConverter - Updates & Changelog # PanConverter - Updates & Changelog
## Version 2.1.0 (December 14, 2025) ## Version 2.1.0 (December 14, 2025)
### 🎨 UI/UX Improvements ### 🎨 UI/UX Improvements
#### Subtle & Small Preview Popout Button #### Subtle & Small Preview Popout Button
- Redesigned popout button with minimalist aesthetic - Redesigned popout button with minimalist aesthetic
- Removed border for cleaner appearance - Removed border for cleaner appearance
- Reduced size: 11px font, 2px×6px padding (previously 14px font, 4px×8px padding) - Reduced size: 11px font, 2px×6px padding (previously 14px font, 4px×8px padding)
- Added opacity transition: 50% when idle, 100% on hover - Added opacity transition: 50% when idle, 100% on hover
- Subtle background effect on hover instead of heavy border styling - Subtle background effect on hover instead of heavy border styling
- **File**: `src/styles.css:195-211` - **File**: `src/styles.css:195-211`
#### Simplified Table Headers in Preview #### Simplified Table Headers in Preview
- Removed gradient background from table headers in modern theme - Removed gradient background from table headers in modern theme
- Changed from `var(--primary-gradient)` (purple gradient) to simple light gray (#f0f0f0) - Changed from `var(--primary-gradient)` (purple gradient) to simple light gray (#f0f0f0)
- Updated text color to dark (#333333) for better readability - Updated text color to dark (#333333) for better readability
- Clean, professional appearance matching standard themes - Clean, professional appearance matching standard themes
- **File**: `src/styles-modern.css:445-449` - **File**: `src/styles-modern.css:445-449`
### 📥 Enhanced Import Capabilities ### 📥 Enhanced Import Capabilities
#### Comprehensive Format-to-Markdown Conversion #### Comprehensive Format-to-Markdown Conversion
Dramatically expanded the "Import Document" feature to support 30+ file formats: Dramatically expanded the "Import Document" feature to support 30+ file formats:
**Supported Formats:** **Supported Formats:**
- **Documents**: DOCX, ODT, RTF, HTML, HTM, TEX, EPUB, PDF, TXT - **Documents**: DOCX, ODT, RTF, HTML, HTM, TEX, EPUB, PDF, TXT
- **Presentations**: PPTX, ODP - **Presentations**: PPTX, ODP
- **Markup Languages**: RST, Textile, MediaWiki, Org-mode, AsciiDoc, TWiki, OPML - **Markup Languages**: RST, Textile, MediaWiki, Org-mode, AsciiDoc, TWiki, OPML
- **E-book Formats**: EPUB, FB2 - **E-book Formats**: EPUB, FB2
- **LaTeX Formats**: TEX, LATEX, LTX - **LaTeX Formats**: TEX, LATEX, LTX
- **Web Formats**: HTML, HTM, XHTML - **Web Formats**: HTML, HTM, XHTML
- **Wiki Formats**: MediaWiki, DokuWiki, TikiWiki, TWiki - **Wiki Formats**: MediaWiki, DokuWiki, TikiWiki, TWiki
- **Data Formats**: CSV, TSV, JSON - **Data Formats**: CSV, TSV, JSON
**Format-Specific Optimizations:** **Format-Specific Optimizations:**
- PDF text extraction with XeLaTeX engine - PDF text extraction with XeLaTeX engine
- CSV/TSV automatic table conversion - CSV/TSV automatic table conversion
- JSON structure handling - JSON structure handling
- Improved error messages with format hints - Improved error messages with format hints
**Access**: File → Import Document (Ctrl+I) **Access**: File → Import Document (Ctrl+I)
**File**: `src/main.js:1933-1994` **File**: `src/main.js:1933-1994`
### 🎨 Exhaustive ASCII Art Generator ### 🎨 Exhaustive ASCII Art Generator
#### 5 New Text Banner Styles #### 5 New Text Banner Styles
Complete alphabet (A-Z) and numbers (0-9) support for all styles: Complete alphabet (A-Z) and numbers (0-9) support for all styles:
1. **Standard** - Classic ASCII art with slashes and underscores 1. **Standard** - Classic ASCII art with slashes and underscores
2. **Banner** - Large format using # characters (7-line height) 2. **Banner** - Large format using # characters (7-line height)
3. **Block** - Modern Unicode block characters (█ ╔ ╗ ═ ║) 3. **Block** - Modern Unicode block characters (█ ╔ ╗ ═ ║)
4. **Bubble** - Circular bubble letters (Ⓐ Ⓑ Ⓒ) 4. **Bubble** - Circular bubble letters (Ⓐ Ⓑ Ⓒ)
5. **Digital** - Digital display style (▄ ▀ ▐ ▌) 5. **Digital** - Digital display style (▄ ▀ ▐ ▌)
**File**: `src/renderer.js:3397-3537` **File**: `src/renderer.js:3397-3537`
#### 19 Professional ASCII Templates #### 19 Professional ASCII Templates
Organized into 4 categories with expanded options: Organized into 4 categories with expanded options:
**Arrows & Flow (4 templates):** **Arrows & Flow (4 templates):**
- Arrow Right - Horizontal flow indicators - Arrow Right - Horizontal flow indicators
- Arrow Down - Vertical flow indicators - Arrow Down - Vertical flow indicators
- Decision - Binary decision diagrams - Decision - Binary decision diagrams
- Process Flow - Multi-step process visualization - Process Flow - Multi-step process visualization
**Diagrams & Charts (6 templates):** **Diagrams & Charts (6 templates):**
- Flowchart - Advanced flowchart with decision branches and loops - Flowchart - Advanced flowchart with decision branches and loops
- Sequence - Sequence diagrams for User-System-Database interactions - Sequence - Sequence diagrams for User-System-Database interactions
- Network - Server-client network topology - Network - Server-client network topology
- Hierarchy - Organizational tree structures - Hierarchy - Organizational tree structures
- Timeline - Milestone visualization with dates - Timeline - Milestone visualization with dates
- Table Simple - Basic table template with borders - Table Simple - Basic table template with borders
**Boxes & Containers (4 templates):** **Boxes & Containers (4 templates):**
- Header - Section header with decorative borders - Header - Section header with decorative borders
- Note Box - Important notes with rounded corners (┏━━┓) - Note Box - Important notes with rounded corners (┏━━┓)
- Warning Box - Warning messages with bold borders (╔═══╗) - Warning Box - Warning messages with bold borders (╔═══╗)
- Info Box - Information boxes with subtle styling (╭───╮) - Info Box - Information boxes with subtle styling (╭───╮)
**Decorative Elements (6 templates):** **Decorative Elements (6 templates):**
- Divider - Horizontal section separator (═══) - Divider - Horizontal section separator (═══)
- Separator Fancy - Elegant rounded divider - Separator Fancy - Elegant rounded divider
- Brackets - Japanese-style brackets 【 】 - Brackets - Japanese-style brackets 【 】
- Banner Stars - Star-bordered banners - Banner Stars - Star-bordered banners
- Checklist - Task lists with ✓ checkmarks - Checklist - Task lists with ✓ checkmarks
- Progress Bar - Visual progress indicators - Progress Bar - Visual progress indicators
**Features:** **Features:**
- All ASCII art automatically wrapped in code blocks for proper rendering - All ASCII art automatically wrapped in code blocks for proper rendering
- Preserved formatting in markdown preview and all export formats - Preserved formatting in markdown preview and all export formats
- Categorized template selection interface - Categorized template selection interface
- Real-time preview generation - Real-time preview generation
**Access**: Tools → ASCII Art Generator **Access**: Tools → ASCII Art Generator
**Files**: `src/renderer.js:3513-3671`, `src/index.html:427-466` **Files**: `src/renderer.js:3513-3671`, `src/index.html:427-466`
### 📝 Technical Improvements ### 📝 Technical Improvements
- Enhanced ASCII art detection in Word template exporter - Enhanced ASCII art detection in Word template exporter
- Improved monospace font rendering across all export formats - Improved monospace font rendering across all export formats
- Better code block preservation in PDF and Word exports - Better code block preservation in PDF and Word exports
- Optimized template categorization and organization - Optimized template categorization and organization
### 🔧 Files Modified ### 🔧 Files Modified
- `src/styles.css` - Preview popout button styling - `src/styles.css` - Preview popout button styling
- `src/styles-modern.css` - Table header simplification - `src/styles-modern.css` - Table header simplification
- `src/main.js` - Enhanced import function, version update - `src/main.js` - Enhanced import function, version update
- `src/renderer.js` - ASCII art generator enhancements - `src/renderer.js` - ASCII art generator enhancements
- `src/index.html` - ASCII template UI organization - `src/index.html` - ASCII template UI organization
- `package.json` - Version bump to 2.1.0 - `package.json` - Version bump to 2.1.0
--- ---
## Version 2.0.0 (Previous Release) ## Version 2.0.0 (Previous Release)
### Major Features ### Major Features
- Export Profiles - Save and reuse export configurations - Export Profiles - Save and reuse export configurations
- Mermaid.js diagram support - Mermaid.js diagram support
- Command Palette (Ctrl+Shift+P) - Command Palette (Ctrl+Shift+P)
- GitHub Light/Dark preview themes - GitHub Light/Dark preview themes
- Table Generator - Table Generator
- ASCII Art Generator (basic) - ASCII Art Generator (basic)
- Resizable Preview Pane - Resizable Preview Pane
- Pop-out Preview Window - Pop-out Preview Window
- Configurable page sizes (A3-A5, B4-B5, Letter, Legal, Tabloid, Custom) - Configurable page sizes (A3-A5, B4-B5, Letter, Legal, Tabloid, Custom)
- Custom Headers & Footers for exports - Custom Headers & Footers for exports
- Enhanced PDF and Word export with templates - Enhanced PDF and Word export with templates
- 22 beautiful themes - 22 beautiful themes
### Core Capabilities ### Core Capabilities
- Cross-platform markdown editor with live preview - Cross-platform markdown editor with live preview
- Universal document conversion (30+ formats) - Universal document conversion (30+ formats)
- PDF Editor (merge, split, compress, rotate, watermark, encrypt) - PDF Editor (merge, split, compress, rotate, watermark, encrypt)
- Batch file conversion - Batch file conversion
- File association support - File association support
- Advanced export options - Advanced export options
- Multi-tab interface - Multi-tab interface
--- ---
## Installation & Usage ## Installation & Usage
### Prerequisites ### Prerequisites
- **Pandoc** - Required for document conversion - **Pandoc** - Required for document conversion
- **Optional**: LibreOffice, ImageMagick, FFmpeg for universal converter - **Optional**: LibreOffice, ImageMagick, FFmpeg for universal converter
### Download ### Download
Get the latest release from: https://github.com/amitwh/pan-converter/releases Get the latest release from: https://github.com/amitwh/pan-converter/releases
### Supported Platforms ### Supported Platforms
- Windows (x64) - Windows (x64)
- Linux (AppImage, .deb, .snap) - Linux (AppImage, .deb, .snap)
- macOS (planned) - macOS (planned)
--- ---
## Contributing ## Contributing
Contributions are welcome! Please see [CLAUDE.md](CLAUDE.md) for development guidelines. Contributions are welcome! Please see [CLAUDE.md](CLAUDE.md) for development guidelines.
**Author**: Amit Haridas (amit.wh@gmail.com) **Author**: Amit Haridas (amit.wh@gmail.com)
**License**: MIT **License**: MIT
**Repository**: https://github.com/amitwh/pan-converter **Repository**: https://github.com/amitwh/pan-converter
+89 -89
View File
@@ -1,89 +1,89 @@
/** /**
* ESLint Configuration for PanConverter * ESLint Configuration for PanConverter
* Uses flat config format (ESLint 9+) * Uses flat config format (ESLint 9+)
*/ */
module.exports = [ module.exports = [
{ {
// Global ignores // Global ignores
ignores: [ ignores: [
'node_modules/**', 'node_modules/**',
'dist/**', 'dist/**',
'coverage/**', 'coverage/**',
'*.min.js' '*.min.js'
] ]
}, },
{ {
// JavaScript files // JavaScript files
files: ['**/*.js'], files: ['**/*.js'],
languageOptions: { languageOptions: {
ecmaVersion: 2022, ecmaVersion: 2022,
sourceType: 'module', sourceType: 'module',
globals: { globals: {
// Node.js // Node.js
require: 'readonly', require: 'readonly',
module: 'readonly', module: 'readonly',
exports: 'readonly', exports: 'readonly',
__dirname: 'readonly', __dirname: 'readonly',
__filename: 'readonly', __filename: 'readonly',
process: 'readonly', process: 'readonly',
Buffer: 'readonly', Buffer: 'readonly',
console: 'readonly', console: 'readonly',
setTimeout: 'readonly', setTimeout: 'readonly',
setInterval: 'readonly', setInterval: 'readonly',
clearTimeout: 'readonly', clearTimeout: 'readonly',
clearInterval: 'readonly', clearInterval: 'readonly',
// Browser // Browser
window: 'readonly', window: 'readonly',
document: 'readonly', document: 'readonly',
localStorage: 'readonly', localStorage: 'readonly',
alert: 'readonly', alert: 'readonly',
Event: 'readonly', Event: 'readonly',
CustomEvent: 'readonly', CustomEvent: 'readonly',
HTMLElement: 'readonly', HTMLElement: 'readonly',
MutationObserver: 'readonly', MutationObserver: 'readonly',
// Electron // Electron
electronAPI: 'readonly', electronAPI: 'readonly',
// Libraries // Libraries
marked: 'readonly', marked: 'readonly',
DOMPurify: 'readonly', DOMPurify: 'readonly',
hljs: 'readonly', hljs: 'readonly',
mermaid: 'readonly', mermaid: 'readonly',
// Jest // Jest
jest: 'readonly', jest: 'readonly',
describe: 'readonly', describe: 'readonly',
test: 'readonly', test: 'readonly',
expect: 'readonly', expect: 'readonly',
beforeEach: 'readonly', beforeEach: 'readonly',
afterEach: 'readonly', afterEach: 'readonly',
beforeAll: 'readonly', beforeAll: 'readonly',
afterAll: 'readonly' afterAll: 'readonly'
} }
}, },
rules: { rules: {
// Error prevention // Error prevention
'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }], 'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'no-undef': 'error', 'no-undef': 'error',
'no-console': 'off', // Allow console for Electron apps 'no-console': 'off', // Allow console for Electron apps
// Code quality // Code quality
'eqeqeq': ['warn', 'always'], 'eqeqeq': ['warn', 'always'],
'no-var': 'warn', 'no-var': 'warn',
'prefer-const': 'warn', 'prefer-const': 'warn',
// Style (handled by Prettier) // Style (handled by Prettier)
'semi': 'off', 'semi': 'off',
'quotes': 'off', 'quotes': 'off',
'indent': 'off', 'indent': 'off',
// Async handling // Async handling
'no-async-promise-executor': 'warn', 'no-async-promise-executor': 'warn',
'require-await': 'off', 'require-await': 'off',
// Security // Security
'no-eval': 'error', 'no-eval': 'error',
'no-implied-eval': 'error', 'no-implied-eval': 'error',
'no-new-func': 'error' 'no-new-func': 'error'
} }
} }
]; ];
+59 -59
View File
@@ -1,59 +1,59 @@
/** /**
* Jest Configuration for PanConverter * Jest Configuration for PanConverter
* @version 2.2.0 * @version 2.2.0
*/ */
module.exports = { module.exports = {
// Test environment // Test environment
testEnvironment: 'jsdom', testEnvironment: 'jsdom',
// Root directory // Root directory
rootDir: '.', rootDir: '.',
// Test file patterns // Test file patterns
testMatch: [ testMatch: [
'**/tests/**/*.test.js', '**/tests/**/*.test.js',
'**/tests/**/*.spec.js' '**/tests/**/*.spec.js'
], ],
// Coverage configuration // Coverage configuration
collectCoverageFrom: [ collectCoverageFrom: [
'src/**/*.js', 'src/**/*.js',
'!src/main.js', // Main process needs electron-mock '!src/main.js', // Main process needs electron-mock
'!**/node_modules/**' '!**/node_modules/**'
], ],
// Coverage thresholds (start low, increase over time) // Coverage thresholds (start low, increase over time)
coverageThreshold: { coverageThreshold: {
global: { global: {
branches: 10, branches: 10,
functions: 10, functions: 10,
lines: 10, lines: 10,
statements: 10 statements: 10
} }
}, },
// Transform settings (no transpilation needed for vanilla JS) // Transform settings (no transpilation needed for vanilla JS)
transform: {}, transform: {},
// Module paths // Module paths
moduleDirectories: ['node_modules', 'src'], moduleDirectories: ['node_modules', 'src'],
// Setup files // Setup files
setupFilesAfterEnv: ['<rootDir>/tests/setup.js'], setupFilesAfterEnv: ['<rootDir>/tests/setup.js'],
// Ignore patterns // Ignore patterns
testPathIgnorePatterns: [ testPathIgnorePatterns: [
'/node_modules/', '/node_modules/',
'/dist/' '/dist/'
], ],
// Verbose output // Verbose output
verbose: true, verbose: true,
// Clear mocks between tests // Clear mocks between tests
clearMocks: true, clearMocks: true,
// Reset modules between tests // Reset modules between tests
resetModules: true resetModules: true
}; };
+181 -182
View File
@@ -1,182 +1,181 @@
{ {
"name": "markdown-converter", "name": "markdown-converter",
"version": "3.0.0", "version": "3.0.0",
"description": "Professional Markdown editor and universal file converter with PDF editing, batch processing, and syntax highlighting", "description": "Professional Markdown editor and universal file converter with PDF editing, batch processing, and syntax highlighting",
"main": "src/main.js", "main": "src/main.js",
"scripts": { "scripts": {
"start": "electron .", "start": "electron .",
"test": "jest", "test": "jest",
"test:watch": "jest --watch", "test:watch": "jest --watch",
"test:coverage": "jest --coverage", "test:coverage": "jest --coverage",
"lint": "eslint src tests", "lint": "eslint src tests",
"lint:fix": "eslint src tests --fix", "lint:fix": "eslint src tests --fix",
"format": "prettier --write src tests", "format": "prettier --write src tests",
"format:check": "prettier --check src tests", "format:check": "prettier --check src tests",
"build": "electron-builder", "build": "electron-builder",
"build:win": "electron-builder --win", "build:win": "electron-builder --win",
"build:win-signed": "cross-env CSC_LINK=code-signing-cert.pfx CSC_KEY_PASSWORD=%CSC_KEY_PASSWORD% electron-builder --win", "build:win-signed": "cross-env CSC_LINK=code-signing-cert.pfx CSC_KEY_PASSWORD=%CSC_KEY_PASSWORD% electron-builder --win",
"build:win-unsigned": "cross-env CSC_IDENTITY_AUTO_DISCOVERY=false electron-builder --win", "build:win-unsigned": "cross-env CSC_IDENTITY_AUTO_DISCOVERY=false electron-builder --win",
"build:mac": "electron-builder --mac", "build:mac": "electron-builder --mac",
"build:linux": "electron-builder --linux", "build:linux": "electron-builder --linux",
"dist": "electron-builder --publish=never", "dist": "electron-builder --publish=never",
"dist:all": "electron-builder -mwl", "dist:all": "electron-builder -mwl",
"generate-icons": "node scripts/generate-icons.js" "generate-icons": "node scripts/generate-icons.js"
}, },
"keywords": [ "keywords": [
"markdown", "markdown",
"pandoc", "pandoc",
"converter", "converter",
"editor", "editor",
"pdf", "pdf",
"audio", "audio",
"video", "video",
"image" "image"
], ],
"author": "ConcreteInfo <amit.wh@gmail.com>", "author": "ConcreteInfo <amit.wh@gmail.com>",
"license": "MIT", "license": "MIT",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/amitwh/markdown-converter" "url": "https://github.com/amitwh/markdown-converter"
}, },
"devDependencies": { "devDependencies": {
"@testing-library/dom": "^10.4.1", "@testing-library/dom": "^10.4.1",
"cross-env": "^10.0.0", "cross-env": "^10.0.0",
"electron": "^37.4.0", "electron": "^37.4.0",
"electron-builder": "^26.0.12", "electron-builder": "^26.0.12",
"eslint": "^9.39.2", "eslint": "^9.39.2",
"eslint-config-prettier": "^10.1.8", "eslint-config-prettier": "^10.1.8",
"eslint-plugin-prettier": "^5.5.4", "eslint-plugin-prettier": "^5.5.4",
"jest": "^30.2.0", "jest": "^30.2.0",
"jest-environment-jsdom": "^30.2.0", "jest-environment-jsdom": "^30.2.0",
"prettier": "^3.7.4", "prettier": "^3.7.4",
"sharp": "^0.34.3" "sharp": "^0.34.3"
}, },
"dependencies": { "dependencies": {
"codemirror": "^6.0.2", "codemirror": "^6.0.2",
"core-util-is": "^1.0.3", "core-util-is": "^1.0.3",
"docx": "^9.5.1", "docx": "^9.5.1",
"docx4js": "^3.3.0", "docx4js": "^3.3.0",
"dompurify": "^3.2.6", "dompurify": "^3.2.6",
"electron-store": "^10.1.0", "electron-store": "^10.1.0",
"highlight.js": "^11.11.1", "highlight.js": "^11.11.1",
"html2pdf.js": "^0.10.1", "html2pdf.js": "^0.10.1",
"marked": "^16.2.1", "marked": "^16.2.1",
"pdf-lib": "^1.17.1", "pdf-lib": "^1.17.1",
"pdfjs-dist": "^3.11.174", "pdfjs-dist": "^3.11.174",
"pdfkit": "^0.14.0", "pdfkit": "^0.14.0",
"pizzip": "^3.2.0", "pizzip": "^3.2.0",
"tslib": "^2.8.1", "tslib": "^2.8.1",
"xlsx": "^0.18.5" "xlsx": "^0.18.5"
}, },
"build": { "build": {
"appId": "com.concreteinfo.markdownconverter", "appId": "com.concreteinfo.markdownconverter",
"productName": "MarkdownConverter", "productName": "MarkdownConverter",
"directories": { "directories": {
"output": "dist" "output": "dist"
}, },
"icon": "assets/icon", "icon": "assets/icon",
"files": [ "files": [
"src/**/*", "src/**/*",
"assets/**/*", "assets/**/*",
"scripts/**/*", "scripts/**/*",
"node_modules/**/*", "node_modules/**/*",
"package.json" "package.json"
], ],
"fileAssociations": [ "fileAssociations": [
{ {
"ext": "md", "ext": "md",
"name": "Markdown Document", "name": "Markdown Document",
"description": "Markdown Document", "description": "Markdown Document",
"mimeType": "text/markdown", "mimeType": "text/markdown",
"role": "Editor" "role": "Editor"
}, },
{ {
"ext": "markdown", "ext": "markdown",
"name": "Markdown Document", "name": "Markdown Document",
"description": "Markdown Document", "description": "Markdown Document",
"mimeType": "text/markdown", "mimeType": "text/markdown",
"role": "Editor" "role": "Editor"
}, },
{ {
"ext": "pdf", "ext": "pdf",
"name": "PDF Document", "name": "PDF Document",
"description": "PDF Document", "description": "PDF Document",
"mimeType": "application/pdf", "mimeType": "application/pdf",
"role": "Editor" "role": "Editor"
} }
], ],
"mac": { "mac": {
"category": "public.app-category.productivity", "category": "public.app-category.productivity",
"identity": null "identity": null
}, },
"win": { "win": {
"target": [ "target": [
{ {
"target": "nsis", "target": "nsis",
"arch": [ "arch": [
"x64" "x64"
] ]
}, },
{ {
"target": "portable", "target": "portable",
"arch": [ "arch": [
"x64" "x64"
] ]
}, },
{ {
"target": "zip", "target": "zip",
"arch": [ "arch": [
"x64" "x64"
] ]
} }
], ],
"artifactName": "${productName}-${version}-${arch}.${ext}", "artifactName": "${productName}-${version}-${arch}.${ext}",
"requestedExecutionLevel": "asInvoker", "requestedExecutionLevel": "asInvoker",
"signAndEditExecutable": false "signAndEditExecutable": false
}, },
"nsis": { "nsis": {
"oneClick": false, "oneClick": false,
"perMachine": false, "perMachine": false,
"allowToChangeInstallationDirectory": true, "allowToChangeInstallationDirectory": true,
"displayLanguageSelector": true, "displayLanguageSelector": true,
"createDesktopShortcut": true, "createDesktopShortcut": true,
"createStartMenuShortcut": true, "createStartMenuShortcut": true,
"shortcutName": "MarkdownConverter", "shortcutName": "MarkdownConverter",
"runAfterFinish": true, "runAfterFinish": true,
"menuCategory": "Productivity", "menuCategory": "Productivity",
"license": "LICENSE", "license": "LICENSE",
"warningsAsErrors": false, "warningsAsErrors": false,
"artifactName": "${productName}-Setup-${version}.${ext}", "artifactName": "${productName}-Setup-${version}.${ext}",
"deleteAppDataOnUninstall": false, "deleteAppDataOnUninstall": false,
"differentialPackage": true "differentialPackage": true
}, },
"linux": { "linux": {
"target": [ "target": [
"deb", "deb",
"AppImage", "AppImage",
"snap", "snap"
"rpm" ],
], "category": "Utility",
"category": "Utility", "maintainer": "ConcreteInfo <amit.wh@gmail.com>"
"maintainer": "ConcreteInfo <amit.wh@gmail.com>" },
}, "deb": {
"deb": { "depends": [
"depends": [ "pandoc",
"pandoc", "ffmpeg",
"ffmpeg", "imagemagick",
"imagemagick", "libreoffice-common"
"libreoffice-common" ],
], "description": "Professional Markdown editor and universal file converter",
"description": "Professional Markdown editor and universal file converter", "maintainer": "ConcreteInfo <amit.wh@gmail.com>"
"maintainer": "ConcreteInfo <amit.wh@gmail.com>" },
}, "rpm": {
"rpm": { "depends": [
"depends": [ "pandoc",
"pandoc", "ffmpeg",
"ffmpeg", "ImageMagick",
"ImageMagick", "libreoffice-core"
"libreoffice-core" ]
] }
} }
} }
}
+82 -82
View File
@@ -1,83 +1,83 @@
#!/bin/bash #!/bin/bash
echo "==========================================" echo "=========================================="
echo "Pan Converter - GitHub Push Helper" echo "Pan Converter - GitHub Push Helper"
echo "==========================================" echo "=========================================="
echo "" echo ""
echo "Before running this script, please ensure:" echo "Before running this script, please ensure:"
echo "1. You have created a repository named 'pan-converter' on GitHub" echo "1. You have created a repository named 'pan-converter' on GitHub"
echo "2. The repository is empty (no README, .gitignore, or license)" echo "2. The repository is empty (no README, .gitignore, or license)"
echo "3. You have set up authentication (SSH key or Personal Access Token)" echo "3. You have set up authentication (SSH key or Personal Access Token)"
echo "" echo ""
read -p "Have you completed the above steps? (y/n): " -n 1 -r read -p "Have you completed the above steps? (y/n): " -n 1 -r
echo "" echo ""
if [[ ! $REPLY =~ ^[Yy]$ ]]; then if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "Please complete the setup first:" echo "Please complete the setup first:"
echo "1. Go to https://github.com/new" echo "1. Go to https://github.com/new"
echo "2. Create a new repository named 'pan-converter'" echo "2. Create a new repository named 'pan-converter'"
echo "3. DO NOT initialize with README, .gitignore, or license" echo "3. DO NOT initialize with README, .gitignore, or license"
echo "4. Set up SSH key or Personal Access Token for authentication" echo "4. Set up SSH key or Personal Access Token for authentication"
exit 1 exit 1
fi fi
echo "" echo ""
echo "Choose authentication method:" echo "Choose authentication method:"
echo "1. SSH (Recommended if you have SSH keys set up)" echo "1. SSH (Recommended if you have SSH keys set up)"
echo "2. HTTPS (Requires Personal Access Token)" echo "2. HTTPS (Requires Personal Access Token)"
read -p "Enter your choice (1 or 2): " AUTH_CHOICE read -p "Enter your choice (1 or 2): " AUTH_CHOICE
if [ "$AUTH_CHOICE" = "1" ]; then if [ "$AUTH_CHOICE" = "1" ]; then
echo "Using SSH authentication..." echo "Using SSH authentication..."
git remote set-url origin git@github.com:amitwh/pan-converter.git git remote set-url origin git@github.com:amitwh/pan-converter.git
elif [ "$AUTH_CHOICE" = "2" ]; then elif [ "$AUTH_CHOICE" = "2" ]; then
echo "Using HTTPS authentication..." echo "Using HTTPS authentication..."
echo "You'll need to enter your GitHub username and Personal Access Token" echo "You'll need to enter your GitHub username and Personal Access Token"
git remote set-url origin https://github.com/amitwh/pan-converter.git git remote set-url origin https://github.com/amitwh/pan-converter.git
else else
echo "Invalid choice. Exiting." echo "Invalid choice. Exiting."
exit 1 exit 1
fi fi
echo "" echo ""
echo "Pushing branches to GitHub..." echo "Pushing branches to GitHub..."
echo "==============================" echo "=============================="
# Push master branch with upstream tracking # Push master branch with upstream tracking
echo "Pushing master branch..." echo "Pushing master branch..."
if git push -u origin master; then if git push -u origin master; then
echo "✓ Master branch pushed successfully" echo "✓ Master branch pushed successfully"
else else
echo "✗ Failed to push master branch" echo "✗ Failed to push master branch"
echo "Please check your authentication and try again" echo "Please check your authentication and try again"
exit 1 exit 1
fi fi
# Push other branches # Push other branches
echo "Pushing linux branch..." echo "Pushing linux branch..."
if git push origin linux; then if git push origin linux; then
echo "✓ Linux branch pushed successfully" echo "✓ Linux branch pushed successfully"
else else
echo "✗ Failed to push linux branch" echo "✗ Failed to push linux branch"
fi fi
echo "Pushing macos branch..." echo "Pushing macos branch..."
if git push origin macos; then if git push origin macos; then
echo "✓ macOS branch pushed successfully" echo "✓ macOS branch pushed successfully"
else else
echo "✗ Failed to push macos branch" echo "✗ Failed to push macos branch"
fi fi
echo "Pushing windows branch..." echo "Pushing windows branch..."
if git push origin windows; then if git push origin windows; then
echo "✓ Windows branch pushed successfully" echo "✓ Windows branch pushed successfully"
else else
echo "✗ Failed to push windows branch" echo "✗ Failed to push windows branch"
fi fi
echo "" echo ""
echo "==========================================" echo "=========================================="
echo "Push complete!" echo "Push complete!"
echo "Your repository is available at:" echo "Your repository is available at:"
echo "https://github.com/amitwh/pan-converter" echo "https://github.com/amitwh/pan-converter"
echo "==========================================" echo "=========================================="
+115 -115
View File
@@ -1,116 +1,116 @@
# PanConverter Windows Explorer Context Menu Integration # PanConverter Windows Explorer Context Menu Integration
This directory contains scripts to add PanConverter to the Windows Explorer context menu, allowing you to right-click on files and convert them directly without opening the full application. This directory contains scripts to add PanConverter to the Windows Explorer context menu, allowing you to right-click on files and convert them directly without opening the full application.
## Features ## Features
### Context Menu Options ### Context Menu Options
- **Convert with PanConverter**: Shows a format selection dialog for any supported file - **Convert with PanConverter**: Shows a format selection dialog for any supported file
- **PanConverter > Convert to...**: Direct conversion options (for Markdown files) - **PanConverter > Convert to...**: Direct conversion options (for Markdown files)
- PDF - PDF
- HTML - HTML
- DOCX - DOCX
- LaTeX - LaTeX
- PowerPoint - PowerPoint
### Supported File Types ### Supported File Types
- **Markdown**: `.md`, `.markdown` - **Markdown**: `.md`, `.markdown`
- **HTML**: `.html`, `.htm` - **HTML**: `.html`, `.htm`
- **Documents**: `.docx`, `.odt`, `.rtf` - **Documents**: `.docx`, `.odt`, `.rtf`
- **LaTeX**: `.tex` - **LaTeX**: `.tex`
- **PDF**: `.pdf` - **PDF**: `.pdf`
- **Presentations**: `.pptx`, `.ppt`, `.odp` - **Presentations**: `.pptx`, `.ppt`, `.odp`
## Installation Methods ## Installation Methods
### Method 1: Automatic (During PanConverter Installation) ### Method 1: Automatic (During PanConverter Installation)
When installing PanConverter using the Windows installer, you'll be prompted to install context menu integration automatically. When installing PanConverter using the Windows installer, you'll be prompted to install context menu integration automatically.
### Method 2: Manual Installation ### Method 2: Manual Installation
#### Using PowerShell (Recommended) #### Using PowerShell (Recommended)
1. Right-click on `install-context-menu.ps1` 1. Right-click on `install-context-menu.ps1`
2. Select "Run with PowerShell" 2. Select "Run with PowerShell"
3. Follow the prompts (will request administrator privileges) 3. Follow the prompts (will request administrator privileges)
#### Using Batch File #### Using Batch File
1. Right-click on `install-context-menu.bat` 1. Right-click on `install-context-menu.bat`
2. Select "Run as administrator" 2. Select "Run as administrator"
3. Follow the prompts 3. Follow the prompts
#### Using Registry File Directly #### Using Registry File Directly
1. Right-click on `install-context-menu.reg` 1. Right-click on `install-context-menu.reg`
2. Select "Merge" 2. Select "Merge"
3. Confirm the registry modification 3. Confirm the registry modification
## Uninstallation ## Uninstallation
### Using PowerShell ### Using PowerShell
```powershell ```powershell
.\install-context-menu.ps1 -Uninstall .\install-context-menu.ps1 -Uninstall
``` ```
### Using Batch File ### Using Batch File
Run `uninstall-context-menu.bat` as administrator Run `uninstall-context-menu.bat` as administrator
### Using Registry File ### Using Registry File
Run `uninstall-context-menu.reg` Run `uninstall-context-menu.reg`
## How It Works ## How It Works
### Command Line Interface ### Command Line Interface
The context menu integration works by passing command line arguments to PanConverter: The context menu integration works by passing command line arguments to PanConverter:
- `--convert <file>`: Shows conversion dialog for the specified file - `--convert <file>`: Shows conversion dialog for the specified file
- `--convert-to <format> <file>`: Directly converts to the specified format - `--convert-to <format> <file>`: Directly converts to the specified format
### Examples ### Examples
```batch ```batch
# Show conversion dialog # Show conversion dialog
PanConverter.exe --convert "document.md" PanConverter.exe --convert "document.md"
# Direct conversion to PDF # Direct conversion to PDF
PanConverter.exe --convert-to pdf "document.md" PanConverter.exe --convert-to pdf "document.md"
``` ```
### Conversion Process ### Conversion Process
1. PanConverter reads the input file 1. PanConverter reads the input file
2. Creates a temporary file if needed 2. Creates a temporary file if needed
3. Uses Pandoc to convert to the target format 3. Uses Pandoc to convert to the target format
4. Saves the output in the same directory as the input file 4. Saves the output in the same directory as the input file
5. Shows a Windows notification when complete 5. Shows a Windows notification when complete
## Requirements ## Requirements
- PanConverter must be installed in the default location: `%LOCALAPPDATA%\Programs\PanConverter\` - PanConverter must be installed in the default location: `%LOCALAPPDATA%\Programs\PanConverter\`
- Pandoc must be installed and accessible from the command line - Pandoc must be installed and accessible from the command line
- Administrator privileges required for registry modifications - Administrator privileges required for registry modifications
## Troubleshooting ## Troubleshooting
### Context Menu Not Appearing ### Context Menu Not Appearing
1. Ensure you ran the installation script as administrator 1. Ensure you ran the installation script as administrator
2. Try logging out and back in, or restart Windows Explorer 2. Try logging out and back in, or restart Windows Explorer
3. Check if PanConverter is installed in the expected location 3. Check if PanConverter is installed in the expected location
### Conversion Failures ### Conversion Failures
1. Verify Pandoc is installed: `pandoc --version` 1. Verify Pandoc is installed: `pandoc --version`
2. Check if the input file is not corrupted or locked 2. Check if the input file is not corrupted or locked
3. Ensure you have write permissions in the output directory 3. Ensure you have write permissions in the output directory
### Permission Errors ### Permission Errors
- The installation scripts require administrator privileges to modify the registry - The installation scripts require administrator privileges to modify the registry
- If you get permission errors, right-click and "Run as administrator" - If you get permission errors, right-click and "Run as administrator"
## File Descriptions ## File Descriptions
- `install-context-menu.reg`: Registry entries for context menu - `install-context-menu.reg`: Registry entries for context menu
- `uninstall-context-menu.reg`: Registry entries removal - `uninstall-context-menu.reg`: Registry entries removal
- `install-context-menu.ps1`: PowerShell installation script - `install-context-menu.ps1`: PowerShell installation script
- `install-context-menu.bat`: Batch installation script - `install-context-menu.bat`: Batch installation script
- `uninstall-context-menu.bat`: Batch uninstallation script - `uninstall-context-menu.bat`: Batch uninstallation script
- `nsis-installer.nsh`: NSIS installer integration script - `nsis-installer.nsh`: NSIS installer integration script
## Security Note ## Security Note
The scripts modify the Windows registry to add context menu entries. Only run these scripts if you trust the source and understand the changes being made to your system. The scripts modify the Windows registry to add context menu entries. Only run these scripts if you trust the source and understand the changes being made to your system.
+82 -82
View File
@@ -1,82 +1,82 @@
/** /**
* Icon Generator for MarkdownConverter * Icon Generator for MarkdownConverter
* Generates all required icon sizes from NewIcon.jpg * Generates all required icon sizes from NewIcon.jpg
*/ */
const sharp = require('sharp'); const sharp = require('sharp');
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');
// Source image // Source image
const sourceImage = path.join(__dirname, '..', 'assets', 'docico1.png'); const sourceImage = path.join(__dirname, '..', 'assets', 'docico1.png');
const assetsDir = path.join(__dirname, '..', 'assets'); const assetsDir = path.join(__dirname, '..', 'assets');
// Icon sizes needed for different platforms // Icon sizes needed for different platforms
const iconSizes = [16, 24, 32, 48, 64, 128, 256, 512, 1024]; const iconSizes = [16, 24, 32, 48, 64, 128, 256, 512, 1024];
async function generateIcons() { async function generateIcons() {
console.log('Generating icons from docico1.png...'); console.log('Generating icons from docico1.png...');
// Check if source exists // Check if source exists
if (!fs.existsSync(sourceImage)) { if (!fs.existsSync(sourceImage)) {
console.error('Source image not found:', sourceImage); console.error('Source image not found:', sourceImage);
process.exit(1); process.exit(1);
} }
try { try {
// Generate main icon.png (512x512) // Generate main icon.png (512x512)
await sharp(sourceImage) await sharp(sourceImage)
.resize(512, 512, { fit: 'contain', background: { r: 255, g: 255, b: 255, alpha: 0 } }) .resize(512, 512, { fit: 'contain', background: { r: 255, g: 255, b: 255, alpha: 0 } })
.png() .png()
.toFile(path.join(assetsDir, 'icon.png')); .toFile(path.join(assetsDir, 'icon.png'));
console.log('Generated icon.png (512x512)'); console.log('Generated icon.png (512x512)');
// Generate icon@2x.png (1024x1024) // Generate icon@2x.png (1024x1024)
await sharp(sourceImage) await sharp(sourceImage)
.resize(1024, 1024, { fit: 'contain', background: { r: 255, g: 255, b: 255, alpha: 0 } }) .resize(1024, 1024, { fit: 'contain', background: { r: 255, g: 255, b: 255, alpha: 0 } })
.png() .png()
.toFile(path.join(assetsDir, 'icon@2x.png')); .toFile(path.join(assetsDir, 'icon@2x.png'));
console.log('Generated icon@2x.png (1024x1024)'); console.log('Generated icon@2x.png (1024x1024)');
// Create icons directory for multi-size icons // Create icons directory for multi-size icons
const iconsDir = path.join(assetsDir, 'icons'); const iconsDir = path.join(assetsDir, 'icons');
if (!fs.existsSync(iconsDir)) { if (!fs.existsSync(iconsDir)) {
fs.mkdirSync(iconsDir, { recursive: true }); fs.mkdirSync(iconsDir, { recursive: true });
} }
// Generate all sizes // Generate all sizes
for (const size of iconSizes) { for (const size of iconSizes) {
await sharp(sourceImage) await sharp(sourceImage)
.resize(size, size, { fit: 'contain', background: { r: 255, g: 255, b: 255, alpha: 0 } }) .resize(size, size, { fit: 'contain', background: { r: 255, g: 255, b: 255, alpha: 0 } })
.png() .png()
.toFile(path.join(iconsDir, `${size}x${size}.png`)); .toFile(path.join(iconsDir, `${size}x${size}.png`));
console.log(`Generated icons/${size}x${size}.png`); console.log(`Generated icons/${size}x${size}.png`);
} }
// Generate favicon // Generate favicon
await sharp(sourceImage) await sharp(sourceImage)
.resize(32, 32, { fit: 'contain', background: { r: 255, g: 255, b: 255, alpha: 0 } }) .resize(32, 32, { fit: 'contain', background: { r: 255, g: 255, b: 255, alpha: 0 } })
.png() .png()
.toFile(path.join(assetsDir, 'favicon.png')); .toFile(path.join(assetsDir, 'favicon.png'));
console.log('Generated favicon.png (32x32)'); console.log('Generated favicon.png (32x32)');
// Generate tray icon (smaller, for system tray) // Generate tray icon (smaller, for system tray)
await sharp(sourceImage) await sharp(sourceImage)
.resize(24, 24, { fit: 'contain', background: { r: 255, g: 255, b: 255, alpha: 0 } }) .resize(24, 24, { fit: 'contain', background: { r: 255, g: 255, b: 255, alpha: 0 } })
.png() .png()
.toFile(path.join(assetsDir, 'tray-icon.png')); .toFile(path.join(assetsDir, 'tray-icon.png'));
console.log('Generated tray-icon.png (24x24)'); console.log('Generated tray-icon.png (24x24)');
console.log('\nIcon generation complete!'); console.log('\nIcon generation complete!');
console.log('\nFor Windows .ico file, use an online converter or:'); console.log('\nFor Windows .ico file, use an online converter or:');
console.log(' magick convert assets/icons/*.png assets/icon.ico'); console.log(' magick convert assets/icons/*.png assets/icon.ico');
console.log('\nFor macOS .icns file, use:'); console.log('\nFor macOS .icns file, use:');
console.log(' iconutil -c icns assets/icon.iconset -o assets/icon.icns'); console.log(' iconutil -c icns assets/icon.iconset -o assets/icon.icns');
} catch (error) { } catch (error) {
console.error('Error generating icons:', error); console.error('Error generating icons:', error);
process.exit(1); process.exit(1);
} }
} }
generateIcons(); generateIcons();
+47 -47
View File
@@ -1,48 +1,48 @@
@echo off @echo off
echo PanConverter Context Menu Installation echo PanConverter Context Menu Installation
echo ===================================== echo =====================================
echo. echo.
REM Check for administrator privileges REM Check for administrator privileges
net session >nul 2>&1 net session >nul 2>&1
if %errorLevel% == 0 ( if %errorLevel% == 0 (
echo Running with administrator privileges... echo Running with administrator privileges...
) else ( ) else (
echo This script requires administrator privileges. echo This script requires administrator privileges.
echo Please right-click and select "Run as administrator" echo Please right-click and select "Run as administrator"
echo. echo.
pause pause
exit /b 1 exit /b 1
) )
REM Check if PanConverter is installed REM Check if PanConverter is installed
if not exist "%LOCALAPPDATA%\Programs\PanConverter\PanConverter.exe" ( if not exist "%LOCALAPPDATA%\Programs\PanConverter\PanConverter.exe" (
echo Warning: PanConverter not found at the expected location. echo Warning: PanConverter not found at the expected location.
echo Please ensure PanConverter is installed before continuing. echo Please ensure PanConverter is installed before continuing.
echo Expected location: %LOCALAPPDATA%\Programs\PanConverter\PanConverter.exe echo Expected location: %LOCALAPPDATA%\Programs\PanConverter\PanConverter.exe
echo. echo.
set /p continue="Continue anyway? (y/N): " set /p continue="Continue anyway? (y/N): "
if /i not "%continue%"=="y" exit /b 1 if /i not "%continue%"=="y" exit /b 1
) )
echo Installing context menu entries... echo Installing context menu entries...
reg import "%~dp0install-context-menu.reg" reg import "%~dp0install-context-menu.reg"
if %errorLevel% == 0 ( if %errorLevel% == 0 (
echo. echo.
echo Context menu integration installed successfully! echo Context menu integration installed successfully!
echo. echo.
echo You can now right-click on supported files and select: echo You can now right-click on supported files and select:
echo"Convert with PanConverter" - Shows conversion dialog echo"Convert with PanConverter" - Shows conversion dialog
echo"PanConverter > Convert to..." - Direct conversion ^(for Markdown^) echo"PanConverter > Convert to..." - Direct conversion ^(for Markdown^)
echo. echo.
echo Supported file types: echo Supported file types:
echo .md .markdown .html .htm .docx .odt .rtf .tex .pdf .pptx .ppt .odp echo .md .markdown .html .htm .docx .odt .rtf .tex .pdf .pptx .ppt .odp
) else ( ) else (
echo. echo.
echo Failed to install context menu entries. echo Failed to install context menu entries.
echo Please check that the registry file exists and try again. echo Please check that the registry file exists and try again.
) )
echo. echo.
pause pause
+66 -66
View File
@@ -1,67 +1,67 @@
# PanConverter Context Menu Installation Script # PanConverter Context Menu Installation Script
# This script installs PanConverter context menu integration for Windows Explorer # This script installs PanConverter context menu integration for Windows Explorer
param( param(
[switch]$Uninstall = $false [switch]$Uninstall = $false
) )
# Check if running as administrator # Check if running as administrator
if (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { if (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
Write-Host "This script requires Administrator privileges. Restarting with elevated permissions..." -ForegroundColor Yellow Write-Host "This script requires Administrator privileges. Restarting with elevated permissions..." -ForegroundColor Yellow
Start-Process PowerShell -Verb RunAs "-File `"$PSCommandPath`" $(if ($Uninstall) { '-Uninstall' })" Start-Process PowerShell -Verb RunAs "-File `"$PSCommandPath`" $(if ($Uninstall) { '-Uninstall' })"
exit exit
} }
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path $scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$appPath = "${env:LOCALAPPDATA}\Programs\PanConverter\PanConverter.exe" $appPath = "${env:LOCALAPPDATA}\Programs\PanConverter\PanConverter.exe"
if ($Uninstall) { if ($Uninstall) {
Write-Host "Uninstalling PanConverter context menu integration..." -ForegroundColor Yellow Write-Host "Uninstalling PanConverter context menu integration..." -ForegroundColor Yellow
$regFile = Join-Path $scriptDir "uninstall-context-menu.reg" $regFile = Join-Path $scriptDir "uninstall-context-menu.reg"
if (Test-Path $regFile) { if (Test-Path $regFile) {
reg import $regFile reg import $regFile
if ($LASTEXITCODE -eq 0) { if ($LASTEXITCODE -eq 0) {
Write-Host "PanConverter context menu has been successfully removed!" -ForegroundColor Green Write-Host "PanConverter context menu has been successfully removed!" -ForegroundColor Green
} else { } else {
Write-Host "Failed to remove context menu entries." -ForegroundColor Red Write-Host "Failed to remove context menu entries." -ForegroundColor Red
} }
} else { } else {
Write-Host "Uninstall registry file not found: $regFile" -ForegroundColor Red Write-Host "Uninstall registry file not found: $regFile" -ForegroundColor Red
} }
} else { } else {
Write-Host "Installing PanConverter context menu integration..." -ForegroundColor Yellow Write-Host "Installing PanConverter context menu integration..." -ForegroundColor Yellow
# Check if PanConverter is installed # Check if PanConverter is installed
if (-not (Test-Path $appPath)) { if (-not (Test-Path $appPath)) {
Write-Host "Warning: PanConverter executable not found at: $appPath" -ForegroundColor Yellow Write-Host "Warning: PanConverter executable not found at: $appPath" -ForegroundColor Yellow
Write-Host "Please make sure PanConverter is installed before running this script." -ForegroundColor Yellow Write-Host "Please make sure PanConverter is installed before running this script." -ForegroundColor Yellow
$continue = Read-Host "Continue anyway? (y/N)" $continue = Read-Host "Continue anyway? (y/N)"
if ($continue -ne 'y' -and $continue -ne 'Y') { if ($continue -ne 'y' -and $continue -ne 'Y') {
exit exit
} }
} }
$regFile = Join-Path $scriptDir "install-context-menu.reg" $regFile = Join-Path $scriptDir "install-context-menu.reg"
if (Test-Path $regFile) { if (Test-Path $regFile) {
reg import $regFile reg import $regFile
if ($LASTEXITCODE -eq 0) { if ($LASTEXITCODE -eq 0) {
Write-Host "PanConverter context menu has been successfully installed!" -ForegroundColor Green Write-Host "PanConverter context menu has been successfully installed!" -ForegroundColor Green
Write-Host "" Write-Host ""
Write-Host "You can now right-click on supported files (MD, HTML, DOCX, PDF, etc.) and select:" -ForegroundColor Cyan Write-Host "You can now right-click on supported files (MD, HTML, DOCX, PDF, etc.) and select:" -ForegroundColor Cyan
Write-Host "• 'Convert with PanConverter' - Shows conversion dialog" -ForegroundColor Cyan Write-Host "• 'Convert with PanConverter' - Shows conversion dialog" -ForegroundColor Cyan
Write-Host "• 'PanConverter > Convert to...' - Direct conversion options (for Markdown files)" -ForegroundColor Cyan Write-Host "• 'PanConverter > Convert to...' - Direct conversion options (for Markdown files)" -ForegroundColor Cyan
Write-Host "" Write-Host ""
Write-Host "Supported file types: .md, .markdown, .html, .htm, .docx, .odt, .rtf, .tex, .pdf, .pptx, .ppt, .odp" -ForegroundColor Gray Write-Host "Supported file types: .md, .markdown, .html, .htm, .docx, .odt, .rtf, .tex, .pdf, .pptx, .ppt, .odp" -ForegroundColor Gray
} else { } else {
Write-Host "Failed to install context menu entries." -ForegroundColor Red Write-Host "Failed to install context menu entries." -ForegroundColor Red
} }
} else { } else {
Write-Host "Install registry file not found: $regFile" -ForegroundColor Red Write-Host "Install registry file not found: $regFile" -ForegroundColor Red
} }
} }
Write-Host "" Write-Host ""
Write-Host "Press any key to exit..." Write-Host "Press any key to exit..."
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
+133 -133
View File
@@ -1,134 +1,134 @@
Windows Registry Editor Version 5.00 Windows Registry Editor Version 5.00
; PanConverter Context Menu Integration ; PanConverter Context Menu Integration
; This registry file adds context menu options for converting files using PanConverter ; This registry file adds context menu options for converting files using PanConverter
; Add context menu for Markdown files (.md, .markdown) ; Add context menu for Markdown files (.md, .markdown)
[HKEY_CLASSES_ROOT\.md\shell\PanConverter] [HKEY_CLASSES_ROOT\.md\shell\PanConverter]
@="Convert with PanConverter" @="Convert with PanConverter"
"Icon"="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\"" "Icon"="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\""
[HKEY_CLASSES_ROOT\.md\shell\PanConverter\command] [HKEY_CLASSES_ROOT\.md\shell\PanConverter\command]
@="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert \"%1\"" @="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert \"%1\""
[HKEY_CLASSES_ROOT\.markdown\shell\PanConverter] [HKEY_CLASSES_ROOT\.markdown\shell\PanConverter]
@="Convert with PanConverter" @="Convert with PanConverter"
"Icon"="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\"" "Icon"="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\""
[HKEY_CLASSES_ROOT\.markdown\shell\PanConverter\command] [HKEY_CLASSES_ROOT\.markdown\shell\PanConverter\command]
@="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert \"%1\"" @="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert \"%1\""
; Add context menu for HTML files ; Add context menu for HTML files
[HKEY_CLASSES_ROOT\.html\shell\PanConverter] [HKEY_CLASSES_ROOT\.html\shell\PanConverter]
@="Convert with PanConverter" @="Convert with PanConverter"
"Icon"="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\"" "Icon"="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\""
[HKEY_CLASSES_ROOT\.html\shell\PanConverter\command] [HKEY_CLASSES_ROOT\.html\shell\PanConverter\command]
@="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert \"%1\"" @="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert \"%1\""
[HKEY_CLASSES_ROOT\.htm\shell\PanConverter] [HKEY_CLASSES_ROOT\.htm\shell\PanConverter]
@="Convert with PanConverter" @="Convert with PanConverter"
"Icon"="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\"" "Icon"="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\""
[HKEY_CLASSES_ROOT\.htm\shell\PanConverter\command] [HKEY_CLASSES_ROOT\.htm\shell\PanConverter\command]
@="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert \"%1\"" @="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert \"%1\""
; Add context menu for DOCX files ; Add context menu for DOCX files
[HKEY_CLASSES_ROOT\.docx\shell\PanConverter] [HKEY_CLASSES_ROOT\.docx\shell\PanConverter]
@="Convert with PanConverter" @="Convert with PanConverter"
"Icon"="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\"" "Icon"="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\""
[HKEY_CLASSES_ROOT\.docx\shell\PanConverter\command] [HKEY_CLASSES_ROOT\.docx\shell\PanConverter\command]
@="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert \"%1\"" @="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert \"%1\""
; Add context menu for ODT files ; Add context menu for ODT files
[HKEY_CLASSES_ROOT\.odt\shell\PanConverter] [HKEY_CLASSES_ROOT\.odt\shell\PanConverter]
@="Convert with PanConverter" @="Convert with PanConverter"
"Icon"="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\"" "Icon"="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\""
[HKEY_CLASSES_ROOT\.odt\shell\PanConverter\command] [HKEY_CLASSES_ROOT\.odt\shell\PanConverter\command]
@="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert \"%1\"" @="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert \"%1\""
; Add context menu for RTF files ; Add context menu for RTF files
[HKEY_CLASSES_ROOT\.rtf\shell\PanConverter] [HKEY_CLASSES_ROOT\.rtf\shell\PanConverter]
@="Convert with PanConverter" @="Convert with PanConverter"
"Icon"="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\"" "Icon"="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\""
[HKEY_CLASSES_ROOT\.rtf\shell\PanConverter\command] [HKEY_CLASSES_ROOT\.rtf\shell\PanConverter\command]
@="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert \"%1\"" @="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert \"%1\""
; Add context menu for LaTeX files ; Add context menu for LaTeX files
[HKEY_CLASSES_ROOT\.tex\shell\PanConverter] [HKEY_CLASSES_ROOT\.tex\shell\PanConverter]
@="Convert with PanConverter" @="Convert with PanConverter"
"Icon"="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\"" "Icon"="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\""
[HKEY_CLASSES_ROOT\.tex\shell\PanConverter\command] [HKEY_CLASSES_ROOT\.tex\shell\PanConverter\command]
@="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert \"%1\"" @="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert \"%1\""
; Add context menu for PDF files ; Add context menu for PDF files
[HKEY_CLASSES_ROOT\.pdf\shell\PanConverter] [HKEY_CLASSES_ROOT\.pdf\shell\PanConverter]
@="Convert with PanConverter" @="Convert with PanConverter"
"Icon"="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\"" "Icon"="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\""
[HKEY_CLASSES_ROOT\.pdf\shell\PanConverter\command] [HKEY_CLASSES_ROOT\.pdf\shell\PanConverter\command]
@="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert \"%1\"" @="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert \"%1\""
; Add context menu for PowerPoint files ; Add context menu for PowerPoint files
[HKEY_CLASSES_ROOT\.pptx\shell\PanConverter] [HKEY_CLASSES_ROOT\.pptx\shell\PanConverter]
@="Convert with PanConverter" @="Convert with PanConverter"
"Icon"="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\"" "Icon"="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\""
[HKEY_CLASSES_ROOT\.pptx\shell\PanConverter\command] [HKEY_CLASSES_ROOT\.pptx\shell\PanConverter\command]
@="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert \"%1\"" @="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert \"%1\""
[HKEY_CLASSES_ROOT\.ppt\shell\PanConverter] [HKEY_CLASSES_ROOT\.ppt\shell\PanConverter]
@="Convert with PanConverter" @="Convert with PanConverter"
"Icon"="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\"" "Icon"="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\""
[HKEY_CLASSES_ROOT\.ppt\shell\PanConverter\command] [HKEY_CLASSES_ROOT\.ppt\shell\PanConverter\command]
@="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert \"%1\"" @="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert \"%1\""
; Add context menu for OpenDocument Presentation files ; Add context menu for OpenDocument Presentation files
[HKEY_CLASSES_ROOT\.odp\shell\PanConverter] [HKEY_CLASSES_ROOT\.odp\shell\PanConverter]
@="Convert with PanConverter" @="Convert with PanConverter"
"Icon"="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\"" "Icon"="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\""
[HKEY_CLASSES_ROOT\.odp\shell\PanConverter\command] [HKEY_CLASSES_ROOT\.odp\shell\PanConverter\command]
@="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert \"%1\"" @="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert \"%1\""
; Add submenu with specific conversion options for Markdown files ; Add submenu with specific conversion options for Markdown files
[HKEY_CLASSES_ROOT\.md\shell\PanConverterMenu] [HKEY_CLASSES_ROOT\.md\shell\PanConverterMenu]
@="PanConverter" @="PanConverter"
"MUIVerb"="Convert to..." "MUIVerb"="Convert to..."
"Icon"="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\"" "Icon"="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\""
"SubCommands"="" "SubCommands"=""
[HKEY_CLASSES_ROOT\.md\shell\PanConverterMenu\shell\PDF] [HKEY_CLASSES_ROOT\.md\shell\PanConverterMenu\shell\PDF]
@="PDF" @="PDF"
[HKEY_CLASSES_ROOT\.md\shell\PanConverterMenu\shell\PDF\command] [HKEY_CLASSES_ROOT\.md\shell\PanConverterMenu\shell\PDF\command]
@="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert-to pdf \"%1\"" @="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert-to pdf \"%1\""
[HKEY_CLASSES_ROOT\.md\shell\PanConverterMenu\shell\HTML] [HKEY_CLASSES_ROOT\.md\shell\PanConverterMenu\shell\HTML]
@="HTML" @="HTML"
[HKEY_CLASSES_ROOT\.md\shell\PanConverterMenu\shell\HTML\command] [HKEY_CLASSES_ROOT\.md\shell\PanConverterMenu\shell\HTML\command]
@="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert-to html \"%1\"" @="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert-to html \"%1\""
[HKEY_CLASSES_ROOT\.md\shell\PanConverterMenu\shell\DOCX] [HKEY_CLASSES_ROOT\.md\shell\PanConverterMenu\shell\DOCX]
@="DOCX" @="DOCX"
[HKEY_CLASSES_ROOT\.md\shell\PanConverterMenu\shell\DOCX\command] [HKEY_CLASSES_ROOT\.md\shell\PanConverterMenu\shell\DOCX\command]
@="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert-to docx \"%1\"" @="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert-to docx \"%1\""
[HKEY_CLASSES_ROOT\.md\shell\PanConverterMenu\shell\LaTeX] [HKEY_CLASSES_ROOT\.md\shell\PanConverterMenu\shell\LaTeX]
@="LaTeX" @="LaTeX"
[HKEY_CLASSES_ROOT\.md\shell\PanConverterMenu\shell\LaTeX\command] [HKEY_CLASSES_ROOT\.md\shell\PanConverterMenu\shell\LaTeX\command]
@="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert-to latex \"%1\"" @="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert-to latex \"%1\""
[HKEY_CLASSES_ROOT\.md\shell\PanConverterMenu\shell\PPTX] [HKEY_CLASSES_ROOT\.md\shell\PanConverterMenu\shell\PPTX]
@="PowerPoint" @="PowerPoint"
[HKEY_CLASSES_ROOT\.md\shell\PanConverterMenu\shell\PPTX\command] [HKEY_CLASSES_ROOT\.md\shell\PanConverterMenu\shell\PPTX\command]
@="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert-to pptx \"%1\"" @="\"%LOCALAPPDATA%\\Programs\\PanConverter\\PanConverter.exe\" --convert-to pptx \"%1\""
+144 -144
View File
@@ -1,145 +1,145 @@
; PanConverter NSIS Installer Include File ; PanConverter NSIS Installer Include File
; Handles context menu installation and uninstallation ; Handles context menu installation and uninstallation
!include "LogicLib.nsh" !include "LogicLib.nsh"
!include "MUI2.nsh" !include "MUI2.nsh"
; Custom installation page for context menu option ; Custom installation page for context menu option
Var ContextMenuCheckbox Var ContextMenuCheckbox
Var ContextMenuState Var ContextMenuState
Function ContextMenuPage Function ContextMenuPage
!insertmacro MUI_HEADER_TEXT "Additional Options" "Choose additional installation options" !insertmacro MUI_HEADER_TEXT "Additional Options" "Choose additional installation options"
nsDialogs::Create 1018 nsDialogs::Create 1018
Pop $0 Pop $0
${If} $0 == error ${If} $0 == error
Abort Abort
${EndIf} ${EndIf}
${NSD_CreateLabel} 0 0 100% 20u "Select additional features to install:" ${NSD_CreateLabel} 0 0 100% 20u "Select additional features to install:"
Pop $0 Pop $0
${NSD_CreateCheckbox} 20u 30u 280u 15u "Add PanConverter to Windows Explorer context menu" ${NSD_CreateCheckbox} 20u 30u 280u 15u "Add PanConverter to Windows Explorer context menu"
Pop $ContextMenuCheckbox Pop $ContextMenuCheckbox
${NSD_SetState} $ContextMenuCheckbox ${BST_CHECKED} ${NSD_SetState} $ContextMenuCheckbox ${BST_CHECKED}
${NSD_CreateLabel} 20u 50u 280u 30u "This will allow you to right-click on supported files and convert them directly using PanConverter." ${NSD_CreateLabel} 20u 50u 280u 30u "This will allow you to right-click on supported files and convert them directly using PanConverter."
Pop $0 Pop $0
nsDialogs::Show nsDialogs::Show
FunctionEnd FunctionEnd
Function ContextMenuPageLeave Function ContextMenuPageLeave
${NSD_GetState} $ContextMenuCheckbox $ContextMenuState ${NSD_GetState} $ContextMenuCheckbox $ContextMenuState
FunctionEnd FunctionEnd
; Install context menu entries ; Install context menu entries
Function InstallContextMenu Function InstallContextMenu
${If} $ContextMenuState == ${BST_CHECKED} ${If} $ContextMenuState == ${BST_CHECKED}
DetailPrint "Installing context menu integration..." DetailPrint "Installing context menu integration..."
; Create registry entries for context menu ; Create registry entries for context menu
WriteRegStr HKCR ".md\shell\PanConverter" "" "Convert with PanConverter" WriteRegStr HKCR ".md\shell\PanConverter" "" "Convert with PanConverter"
WriteRegStr HKCR ".md\shell\PanConverter" "Icon" "$INSTDIR\PanConverter.exe" WriteRegStr HKCR ".md\shell\PanConverter" "Icon" "$INSTDIR\PanConverter.exe"
WriteRegStr HKCR ".md\shell\PanConverter\command" "" '"$INSTDIR\PanConverter.exe" --convert "%1"' WriteRegStr HKCR ".md\shell\PanConverter\command" "" '"$INSTDIR\PanConverter.exe" --convert "%1"'
WriteRegStr HKCR ".markdown\shell\PanConverter" "" "Convert with PanConverter" WriteRegStr HKCR ".markdown\shell\PanConverter" "" "Convert with PanConverter"
WriteRegStr HKCR ".markdown\shell\PanConverter" "Icon" "$INSTDIR\PanConverter.exe" WriteRegStr HKCR ".markdown\shell\PanConverter" "Icon" "$INSTDIR\PanConverter.exe"
WriteRegStr HKCR ".markdown\shell\PanConverter\command" "" '"$INSTDIR\PanConverter.exe" --convert "%1"' WriteRegStr HKCR ".markdown\shell\PanConverter\command" "" '"$INSTDIR\PanConverter.exe" --convert "%1"'
; Context menu for HTML files ; Context menu for HTML files
WriteRegStr HKCR ".html\shell\PanConverter" "" "Convert with PanConverter" WriteRegStr HKCR ".html\shell\PanConverter" "" "Convert with PanConverter"
WriteRegStr HKCR ".html\shell\PanConverter" "Icon" "$INSTDIR\PanConverter.exe" WriteRegStr HKCR ".html\shell\PanConverter" "Icon" "$INSTDIR\PanConverter.exe"
WriteRegStr HKCR ".html\shell\PanConverter\command" "" '"$INSTDIR\PanConverter.exe" --convert "%1"' WriteRegStr HKCR ".html\shell\PanConverter\command" "" '"$INSTDIR\PanConverter.exe" --convert "%1"'
WriteRegStr HKCR ".htm\shell\PanConverter" "" "Convert with PanConverter" WriteRegStr HKCR ".htm\shell\PanConverter" "" "Convert with PanConverter"
WriteRegStr HKCR ".htm\shell\PanConverter" "Icon" "$INSTDIR\PanConverter.exe" WriteRegStr HKCR ".htm\shell\PanConverter" "Icon" "$INSTDIR\PanConverter.exe"
WriteRegStr HKCR ".htm\shell\PanConverter\command" "" '"$INSTDIR\PanConverter.exe" --convert "%1"' WriteRegStr HKCR ".htm\shell\PanConverter\command" "" '"$INSTDIR\PanConverter.exe" --convert "%1"'
; Context menu for DOCX files ; Context menu for DOCX files
WriteRegStr HKCR ".docx\shell\PanConverter" "" "Convert with PanConverter" WriteRegStr HKCR ".docx\shell\PanConverter" "" "Convert with PanConverter"
WriteRegStr HKCR ".docx\shell\PanConverter" "Icon" "$INSTDIR\PanConverter.exe" WriteRegStr HKCR ".docx\shell\PanConverter" "Icon" "$INSTDIR\PanConverter.exe"
WriteRegStr HKCR ".docx\shell\PanConverter\command" "" '"$INSTDIR\PanConverter.exe" --convert "%1"' WriteRegStr HKCR ".docx\shell\PanConverter\command" "" '"$INSTDIR\PanConverter.exe" --convert "%1"'
; Context menu for ODT files ; Context menu for ODT files
WriteRegStr HKCR ".odt\shell\PanConverter" "" "Convert with PanConverter" WriteRegStr HKCR ".odt\shell\PanConverter" "" "Convert with PanConverter"
WriteRegStr HKCR ".odt\shell\PanConverter" "Icon" "$INSTDIR\PanConverter.exe" WriteRegStr HKCR ".odt\shell\PanConverter" "Icon" "$INSTDIR\PanConverter.exe"
WriteRegStr HKCR ".odt\shell\PanConverter\command" "" '"$INSTDIR\PanConverter.exe" --convert "%1"' WriteRegStr HKCR ".odt\shell\PanConverter\command" "" '"$INSTDIR\PanConverter.exe" --convert "%1"'
; Context menu for RTF files ; Context menu for RTF files
WriteRegStr HKCR ".rtf\shell\PanConverter" "" "Convert with PanConverter" WriteRegStr HKCR ".rtf\shell\PanConverter" "" "Convert with PanConverter"
WriteRegStr HKCR ".rtf\shell\PanConverter" "Icon" "$INSTDIR\PanConverter.exe" WriteRegStr HKCR ".rtf\shell\PanConverter" "Icon" "$INSTDIR\PanConverter.exe"
WriteRegStr HKCR ".rtf\shell\PanConverter\command" "" '"$INSTDIR\PanConverter.exe" --convert "%1"' WriteRegStr HKCR ".rtf\shell\PanConverter\command" "" '"$INSTDIR\PanConverter.exe" --convert "%1"'
; Context menu for LaTeX files ; Context menu for LaTeX files
WriteRegStr HKCR ".tex\shell\PanConverter" "" "Convert with PanConverter" WriteRegStr HKCR ".tex\shell\PanConverter" "" "Convert with PanConverter"
WriteRegStr HKCR ".tex\shell\PanConverter" "Icon" "$INSTDIR\PanConverter.exe" WriteRegStr HKCR ".tex\shell\PanConverter" "Icon" "$INSTDIR\PanConverter.exe"
WriteRegStr HKCR ".tex\shell\PanConverter\command" "" '"$INSTDIR\PanConverter.exe" --convert "%1"' WriteRegStr HKCR ".tex\shell\PanConverter\command" "" '"$INSTDIR\PanConverter.exe" --convert "%1"'
; Context menu for PDF files ; Context menu for PDF files
WriteRegStr HKCR ".pdf\shell\PanConverter" "" "Convert with PanConverter" WriteRegStr HKCR ".pdf\shell\PanConverter" "" "Convert with PanConverter"
WriteRegStr HKCR ".pdf\shell\PanConverter" "Icon" "$INSTDIR\PanConverter.exe" WriteRegStr HKCR ".pdf\shell\PanConverter" "Icon" "$INSTDIR\PanConverter.exe"
WriteRegStr HKCR ".pdf\shell\PanConverter\command" "" '"$INSTDIR\PanConverter.exe" --convert "%1"' WriteRegStr HKCR ".pdf\shell\PanConverter\command" "" '"$INSTDIR\PanConverter.exe" --convert "%1"'
; Context menu for PowerPoint files ; Context menu for PowerPoint files
WriteRegStr HKCR ".pptx\shell\PanConverter" "" "Convert with PanConverter" WriteRegStr HKCR ".pptx\shell\PanConverter" "" "Convert with PanConverter"
WriteRegStr HKCR ".pptx\shell\PanConverter" "Icon" "$INSTDIR\PanConverter.exe" WriteRegStr HKCR ".pptx\shell\PanConverter" "Icon" "$INSTDIR\PanConverter.exe"
WriteRegStr HKCR ".pptx\shell\PanConverter\command" "" '"$INSTDIR\PanConverter.exe" --convert "%1"' WriteRegStr HKCR ".pptx\shell\PanConverter\command" "" '"$INSTDIR\PanConverter.exe" --convert "%1"'
WriteRegStr HKCR ".ppt\shell\PanConverter" "" "Convert with PanConverter" WriteRegStr HKCR ".ppt\shell\PanConverter" "" "Convert with PanConverter"
WriteRegStr HKCR ".ppt\shell\PanConverter" "Icon" "$INSTDIR\PanConverter.exe" WriteRegStr HKCR ".ppt\shell\PanConverter" "Icon" "$INSTDIR\PanConverter.exe"
WriteRegStr HKCR ".ppt\shell\PanConverter\command" "" '"$INSTDIR\PanConverter.exe" --convert "%1"' WriteRegStr HKCR ".ppt\shell\PanConverter\command" "" '"$INSTDIR\PanConverter.exe" --convert "%1"'
; Context menu for ODP files ; Context menu for ODP files
WriteRegStr HKCR ".odp\shell\PanConverter" "" "Convert with PanConverter" WriteRegStr HKCR ".odp\shell\PanConverter" "" "Convert with PanConverter"
WriteRegStr HKCR ".odp\shell\PanConverter" "Icon" "$INSTDIR\PanConverter.exe" WriteRegStr HKCR ".odp\shell\PanConverter" "Icon" "$INSTDIR\PanConverter.exe"
WriteRegStr HKCR ".odp\shell\PanConverter\command" "" '"$INSTDIR\PanConverter.exe" --convert "%1"' WriteRegStr HKCR ".odp\shell\PanConverter\command" "" '"$INSTDIR\PanConverter.exe" --convert "%1"'
; Submenu for Markdown files with direct conversion options ; Submenu for Markdown files with direct conversion options
WriteRegStr HKCR ".md\shell\PanConverterMenu" "" "PanConverter" WriteRegStr HKCR ".md\shell\PanConverterMenu" "" "PanConverter"
WriteRegStr HKCR ".md\shell\PanConverterMenu" "MUIVerb" "Convert to..." WriteRegStr HKCR ".md\shell\PanConverterMenu" "MUIVerb" "Convert to..."
WriteRegStr HKCR ".md\shell\PanConverterMenu" "Icon" "$INSTDIR\PanConverter.exe" WriteRegStr HKCR ".md\shell\PanConverterMenu" "Icon" "$INSTDIR\PanConverter.exe"
WriteRegStr HKCR ".md\shell\PanConverterMenu" "SubCommands" "" WriteRegStr HKCR ".md\shell\PanConverterMenu" "SubCommands" ""
WriteRegStr HKCR ".md\shell\PanConverterMenu\shell\PDF" "" "PDF" WriteRegStr HKCR ".md\shell\PanConverterMenu\shell\PDF" "" "PDF"
WriteRegStr HKCR ".md\shell\PanConverterMenu\shell\PDF\command" "" '"$INSTDIR\PanConverter.exe" --convert-to pdf "%1"' WriteRegStr HKCR ".md\shell\PanConverterMenu\shell\PDF\command" "" '"$INSTDIR\PanConverter.exe" --convert-to pdf "%1"'
WriteRegStr HKCR ".md\shell\PanConverterMenu\shell\HTML" "" "HTML" WriteRegStr HKCR ".md\shell\PanConverterMenu\shell\HTML" "" "HTML"
WriteRegStr HKCR ".md\shell\PanConverterMenu\shell\HTML\command" "" '"$INSTDIR\PanConverter.exe" --convert-to html "%1"' WriteRegStr HKCR ".md\shell\PanConverterMenu\shell\HTML\command" "" '"$INSTDIR\PanConverter.exe" --convert-to html "%1"'
WriteRegStr HKCR ".md\shell\PanConverterMenu\shell\DOCX" "" "DOCX" WriteRegStr HKCR ".md\shell\PanConverterMenu\shell\DOCX" "" "DOCX"
WriteRegStr HKCR ".md\shell\PanConverterMenu\shell\DOCX\command" "" '"$INSTDIR\PanConverter.exe" --convert-to docx "%1"' WriteRegStr HKCR ".md\shell\PanConverterMenu\shell\DOCX\command" "" '"$INSTDIR\PanConverter.exe" --convert-to docx "%1"'
WriteRegStr HKCR ".md\shell\PanConverterMenu\shell\LaTeX" "" "LaTeX" WriteRegStr HKCR ".md\shell\PanConverterMenu\shell\LaTeX" "" "LaTeX"
WriteRegStr HKCR ".md\shell\PanConverterMenu\shell\LaTeX\command" "" '"$INSTDIR\PanConverter.exe" --convert-to latex "%1"' WriteRegStr HKCR ".md\shell\PanConverterMenu\shell\LaTeX\command" "" '"$INSTDIR\PanConverter.exe" --convert-to latex "%1"'
WriteRegStr HKCR ".md\shell\PanConverterMenu\shell\PPTX" "" "PowerPoint" WriteRegStr HKCR ".md\shell\PanConverterMenu\shell\PPTX" "" "PowerPoint"
WriteRegStr HKCR ".md\shell\PanConverterMenu\shell\PPTX\command" "" '"$INSTDIR\PanConverter.exe" --convert-to pptx "%1"' WriteRegStr HKCR ".md\shell\PanConverterMenu\shell\PPTX\command" "" '"$INSTDIR\PanConverter.exe" --convert-to pptx "%1"'
DetailPrint "Context menu integration installed successfully!" DetailPrint "Context menu integration installed successfully!"
${EndIf} ${EndIf}
FunctionEnd FunctionEnd
; Uninstall context menu entries ; Uninstall context menu entries
Function un.RemoveContextMenu Function un.RemoveContextMenu
DetailPrint "Removing context menu integration..." DetailPrint "Removing context menu integration..."
; Remove context menu entries for all file types ; Remove context menu entries for all file types
DeleteRegKey HKCR ".md\shell\PanConverter" DeleteRegKey HKCR ".md\shell\PanConverter"
DeleteRegKey HKCR ".md\shell\PanConverterMenu" DeleteRegKey HKCR ".md\shell\PanConverterMenu"
DeleteRegKey HKCR ".markdown\shell\PanConverter" DeleteRegKey HKCR ".markdown\shell\PanConverter"
DeleteRegKey HKCR ".html\shell\PanConverter" DeleteRegKey HKCR ".html\shell\PanConverter"
DeleteRegKey HKCR ".htm\shell\PanConverter" DeleteRegKey HKCR ".htm\shell\PanConverter"
DeleteRegKey HKCR ".docx\shell\PanConverter" DeleteRegKey HKCR ".docx\shell\PanConverter"
DeleteRegKey HKCR ".odt\shell\PanConverter" DeleteRegKey HKCR ".odt\shell\PanConverter"
DeleteRegKey HKCR ".rtf\shell\PanConverter" DeleteRegKey HKCR ".rtf\shell\PanConverter"
DeleteRegKey HKCR ".tex\shell\PanConverter" DeleteRegKey HKCR ".tex\shell\PanConverter"
DeleteRegKey HKCR ".pdf\shell\PanConverter" DeleteRegKey HKCR ".pdf\shell\PanConverter"
DeleteRegKey HKCR ".pptx\shell\PanConverter" DeleteRegKey HKCR ".pptx\shell\PanConverter"
DeleteRegKey HKCR ".ppt\shell\PanConverter" DeleteRegKey HKCR ".ppt\shell\PanConverter"
DeleteRegKey HKCR ".odp\shell\PanConverter" DeleteRegKey HKCR ".odp\shell\PanConverter"
DetailPrint "Context menu integration removed successfully!" DetailPrint "Context menu integration removed successfully!"
FunctionEnd FunctionEnd
+31 -31
View File
@@ -1,32 +1,32 @@
@echo off @echo off
echo PanConverter Context Menu Uninstallation echo PanConverter Context Menu Uninstallation
echo ======================================== echo ========================================
echo. echo.
REM Check for administrator privileges REM Check for administrator privileges
net session >nul 2>&1 net session >nul 2>&1
if %errorLevel% == 0 ( if %errorLevel% == 0 (
echo Running with administrator privileges... echo Running with administrator privileges...
) else ( ) else (
echo This script requires administrator privileges. echo This script requires administrator privileges.
echo Please right-click and select "Run as administrator" echo Please right-click and select "Run as administrator"
echo. echo.
pause pause
exit /b 1 exit /b 1
) )
echo Removing context menu entries... echo Removing context menu entries...
reg import "%~dp0uninstall-context-menu.reg" reg import "%~dp0uninstall-context-menu.reg"
if %errorLevel% == 0 ( if %errorLevel% == 0 (
echo. echo.
echo Context menu integration removed successfully! echo Context menu integration removed successfully!
echo PanConverter entries have been removed from the Windows Explorer context menu. echo PanConverter entries have been removed from the Windows Explorer context menu.
) else ( ) else (
echo. echo.
echo Failed to remove context menu entries. echo Failed to remove context menu entries.
echo Please check that the registry file exists and try again. echo Please check that the registry file exists and try again.
) )
echo. echo.
pause pause
+35 -35
View File
@@ -1,36 +1,36 @@
Windows Registry Editor Version 5.00 Windows Registry Editor Version 5.00
; PanConverter Context Menu Uninstall Script ; PanConverter Context Menu Uninstall Script
; This registry file removes PanConverter context menu entries ; This registry file removes PanConverter context menu entries
; Remove context menu for Markdown files (.md, .markdown) ; Remove context menu for Markdown files (.md, .markdown)
[-HKEY_CLASSES_ROOT\.md\shell\PanConverter] [-HKEY_CLASSES_ROOT\.md\shell\PanConverter]
[-HKEY_CLASSES_ROOT\.md\shell\PanConverterMenu] [-HKEY_CLASSES_ROOT\.md\shell\PanConverterMenu]
[-HKEY_CLASSES_ROOT\.markdown\shell\PanConverter] [-HKEY_CLASSES_ROOT\.markdown\shell\PanConverter]
; Remove context menu for HTML files ; Remove context menu for HTML files
[-HKEY_CLASSES_ROOT\.html\shell\PanConverter] [-HKEY_CLASSES_ROOT\.html\shell\PanConverter]
[-HKEY_CLASSES_ROOT\.htm\shell\PanConverter] [-HKEY_CLASSES_ROOT\.htm\shell\PanConverter]
; Remove context menu for DOCX files ; Remove context menu for DOCX files
[-HKEY_CLASSES_ROOT\.docx\shell\PanConverter] [-HKEY_CLASSES_ROOT\.docx\shell\PanConverter]
; Remove context menu for ODT files ; Remove context menu for ODT files
[-HKEY_CLASSES_ROOT\.odt\shell\PanConverter] [-HKEY_CLASSES_ROOT\.odt\shell\PanConverter]
; Remove context menu for RTF files ; Remove context menu for RTF files
[-HKEY_CLASSES_ROOT\.rtf\shell\PanConverter] [-HKEY_CLASSES_ROOT\.rtf\shell\PanConverter]
; Remove context menu for LaTeX files ; Remove context menu for LaTeX files
[-HKEY_CLASSES_ROOT\.tex\shell\PanConverter] [-HKEY_CLASSES_ROOT\.tex\shell\PanConverter]
; Remove context menu for PDF files ; Remove context menu for PDF files
[-HKEY_CLASSES_ROOT\.pdf\shell\PanConverter] [-HKEY_CLASSES_ROOT\.pdf\shell\PanConverter]
; Remove context menu for PowerPoint files ; Remove context menu for PowerPoint files
[-HKEY_CLASSES_ROOT\.pptx\shell\PanConverter] [-HKEY_CLASSES_ROOT\.pptx\shell\PanConverter]
[-HKEY_CLASSES_ROOT\.ppt\shell\PanConverter] [-HKEY_CLASSES_ROOT\.ppt\shell\PanConverter]
; Remove context menu for OpenDocument Presentation files ; Remove context menu for OpenDocument Presentation files
[-HKEY_CLASSES_ROOT\.odp\shell\PanConverter] [-HKEY_CLASSES_ROOT\.odp\shell\PanConverter]
+37 -37
View File
@@ -1,37 +1,37 @@
#!/bin/bash #!/bin/bash
# Pan Converter - Git Remote Setup Script # Pan Converter - Git Remote Setup Script
# #
# Instructions: # Instructions:
# 1. Create a new repository on GitHub named "pan-converter" # 1. Create a new repository on GitHub named "pan-converter"
# 2. Replace YOUR_GITHUB_USERNAME with your actual GitHub username # 2. Replace YOUR_GITHUB_USERNAME with your actual GitHub username
# 3. Run this script: bash setup-upstream.sh # 3. Run this script: bash setup-upstream.sh
GITHUB_USERNAME="amitwh" GITHUB_USERNAME="amitwh"
REPO_NAME="pan-converter" REPO_NAME="pan-converter"
echo "Setting up remote repository..." echo "Setting up remote repository..."
# Add remote origin # Add remote origin
git remote add origin "https://github.com/$GITHUB_USERNAME/$REPO_NAME.git" git remote add origin "https://github.com/$GITHUB_USERNAME/$REPO_NAME.git"
echo "Pushing all branches to remote..." echo "Pushing all branches to remote..."
# Push master branch # Push master branch
git push -u origin master git push -u origin master
# Push platform-specific branches # Push platform-specific branches
git push origin linux git push origin linux
git push origin macos git push origin macos
git push origin windows git push origin windows
echo "Repository setup complete!" echo "Repository setup complete!"
echo "" echo ""
echo "Your repository is now available at:" echo "Your repository is now available at:"
echo "https://github.com/$GITHUB_USERNAME/$REPO_NAME" echo "https://github.com/$GITHUB_USERNAME/$REPO_NAME"
echo "" echo ""
echo "Branch structure:" echo "Branch structure:"
echo " - master (main development)" echo " - master (main development)"
echo " - linux (Linux-specific)" echo " - linux (Linux-specific)"
echo " - macos (macOS-specific)" echo " - macos (macOS-specific)"
echo " - windows (Windows-specific)" echo " - windows (Windows-specific)"
+601 -601
View File
File diff suppressed because it is too large Load Diff
+75 -75
View File
@@ -1,75 +1,75 @@
/* Local Font Definitions for MarkdownConverter */ /* Local Font Definitions for MarkdownConverter */
/* Inter Font Family */ /* Inter Font Family */
@font-face { @font-face {
font-family: 'Inter'; font-family: 'Inter';
font-style: normal; font-style: normal;
font-weight: 300; font-weight: 300;
font-display: swap; font-display: swap;
src: url('../assets/fonts/Inter-Light.woff2') format('woff2'); src: url('../assets/fonts/Inter-Light.woff2') format('woff2');
} }
@font-face { @font-face {
font-family: 'Inter'; font-family: 'Inter';
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
font-display: swap; font-display: swap;
src: url('../assets/fonts/Inter-Regular.woff2') format('woff2'); src: url('../assets/fonts/Inter-Regular.woff2') format('woff2');
} }
@font-face { @font-face {
font-family: 'Inter'; font-family: 'Inter';
font-style: normal; font-style: normal;
font-weight: 500; font-weight: 500;
font-display: swap; font-display: swap;
src: url('../assets/fonts/Inter-Medium.woff2') format('woff2'); src: url('../assets/fonts/Inter-Medium.woff2') format('woff2');
} }
@font-face { @font-face {
font-family: 'Inter'; font-family: 'Inter';
font-style: normal; font-style: normal;
font-weight: 600; font-weight: 600;
font-display: swap; font-display: swap;
src: url('../assets/fonts/Inter-SemiBold.woff2') format('woff2'); src: url('../assets/fonts/Inter-SemiBold.woff2') format('woff2');
} }
@font-face { @font-face {
font-family: 'Inter'; font-family: 'Inter';
font-style: normal; font-style: normal;
font-weight: 700; font-weight: 700;
font-display: swap; font-display: swap;
src: url('../assets/fonts/Inter-Bold.woff2') format('woff2'); src: url('../assets/fonts/Inter-Bold.woff2') format('woff2');
} }
/* JetBrains Mono Font Family - For code, markdown editor, and ASCII art */ /* JetBrains Mono Font Family - For code, markdown editor, and ASCII art */
@font-face { @font-face {
font-family: 'JetBrains Mono'; font-family: 'JetBrains Mono';
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
font-display: swap; font-display: swap;
src: url('../assets/fonts/JetBrainsMono-Regular.woff2') format('woff2'); src: url('../assets/fonts/JetBrainsMono-Regular.woff2') format('woff2');
} }
@font-face { @font-face {
font-family: 'JetBrains Mono'; font-family: 'JetBrains Mono';
font-style: normal; font-style: normal;
font-weight: 500; font-weight: 500;
font-display: swap; font-display: swap;
src: url('../assets/fonts/JetBrainsMono-Medium.woff2') format('woff2'); src: url('../assets/fonts/JetBrainsMono-Medium.woff2') format('woff2');
} }
@font-face { @font-face {
font-family: 'JetBrains Mono'; font-family: 'JetBrains Mono';
font-style: normal; font-style: normal;
font-weight: 600; font-weight: 600;
font-display: swap; font-display: swap;
src: url('../assets/fonts/JetBrainsMono-SemiBold.woff2') format('woff2'); src: url('../assets/fonts/JetBrainsMono-SemiBold.woff2') format('woff2');
} }
@font-face { @font-face {
font-family: 'JetBrains Mono'; font-family: 'JetBrains Mono';
font-style: normal; font-style: normal;
font-weight: 700; font-weight: 700;
font-display: swap; font-display: swap;
src: url('../assets/fonts/JetBrainsMono-Bold.woff2') format('woff2'); src: url('../assets/fonts/JetBrainsMono-Bold.woff2') format('woff2');
} }
+1413 -1413
View File
File diff suppressed because it is too large Load Diff
+3794 -3794
View File
File diff suppressed because it is too large Load Diff
+376 -376
View File
@@ -1,376 +1,376 @@
/** /**
* Preload Script for PanConverter * Preload Script for PanConverter
* *
* This script creates a secure bridge between the main process and renderer process. * This script creates a secure bridge between the main process and renderer process.
* It exposes only specific IPC channels, preventing direct Node.js access in the renderer. * It exposes only specific IPC channels, preventing direct Node.js access in the renderer.
* *
* Security Benefits: * Security Benefits:
* - No direct access to Node.js APIs (fs, path, child_process, etc.) * - No direct access to Node.js APIs (fs, path, child_process, etc.)
* - All IPC channels are explicitly whitelisted * - All IPC channels are explicitly whitelisted
* - Prevents XSS from escalating to full system access * - Prevents XSS from escalating to full system access
* *
* @version 2.2.0 * @version 2.2.0
*/ */
const { contextBridge, ipcRenderer } = require('electron'); const { contextBridge, ipcRenderer } = require('electron');
// Define allowed IPC channels for security // Define allowed IPC channels for security
const ALLOWED_SEND_CHANNELS = [ const ALLOWED_SEND_CHANNELS = [
// File operations // File operations
'save-file', 'save-file',
'save-current-file', 'save-current-file',
'set-current-file', 'set-current-file',
'save-recent-files', 'save-recent-files',
'clear-recent-files', 'clear-recent-files',
'renderer-ready', 'renderer-ready',
// Theme // Theme
'get-theme', 'get-theme',
// Print // Print
'do-print', 'do-print',
// Export // Export
'export-with-options', 'export-with-options',
'export-spreadsheet', 'export-spreadsheet',
// Batch conversion // Batch conversion
'batch-convert', 'batch-convert',
'select-folder', 'select-folder',
// Universal converter // Universal converter
'universal-convert', 'universal-convert',
'universal-convert-batch', 'universal-convert-batch',
// Image converter // Image converter
'image-convert', 'image-convert',
'image-batch-convert', 'image-batch-convert',
'image-resize', 'image-resize',
'image-compress', 'image-compress',
'image-rotate', 'image-rotate',
// Audio converter // Audio converter
'audio-convert', 'audio-convert',
'audio-batch-convert', 'audio-batch-convert',
'audio-extract', 'audio-extract',
'audio-trim', 'audio-trim',
'audio-merge', 'audio-merge',
// Video converter // Video converter
'video-convert', 'video-convert',
'video-batch-convert', 'video-batch-convert',
'video-compress', 'video-compress',
'video-trim', 'video-trim',
'video-frames', 'video-frames',
'video-gif', 'video-gif',
// Header/Footer // Header/Footer
'get-header-footer-settings', 'get-header-footer-settings',
'save-header-footer-settings', 'save-header-footer-settings',
'browse-header-footer-logo', 'browse-header-footer-logo',
'save-header-footer-logo', 'save-header-footer-logo',
'clear-header-footer-logo', 'clear-header-footer-logo',
// Page settings // Page settings
'get-page-settings', 'get-page-settings',
'update-page-settings', 'update-page-settings',
// Template settings // Template settings
'set-custom-start-page', 'set-custom-start-page',
// PDF operations // PDF operations
'process-pdf-operation', 'process-pdf-operation',
'get-pdf-page-count', 'get-pdf-page-count',
'select-pdf-folder', 'select-pdf-folder',
// ASCII generator (separate window) // ASCII generator (separate window)
'open-ascii-generator', 'open-ascii-generator',
// Table generator (separate window) // Table generator (separate window)
'open-table-generator', 'open-table-generator',
// Insert generated content // Insert generated content
'insert-generated-content' 'insert-generated-content'
]; ];
const ALLOWED_RECEIVE_CHANNELS = [ const ALLOWED_RECEIVE_CHANNELS = [
// File operations // File operations
'file-new', 'file-new',
'file-opened', 'file-opened',
'file-save', 'file-save',
'get-content-for-save', 'get-content-for-save',
'get-content-for-spreadsheet', 'get-content-for-spreadsheet',
'recent-files-cleared', 'recent-files-cleared',
// UI toggles // UI toggles
'toggle-preview', 'toggle-preview',
'toggle-find', 'toggle-find',
// Theme // Theme
'theme-changed', 'theme-changed',
'theme-data', 'theme-data',
// Edit operations // Edit operations
'undo', 'undo',
'redo', 'redo',
// Font // Font
'adjust-font-size', 'adjust-font-size',
// Print // Print
'print-preview', 'print-preview',
'print-preview-styled', 'print-preview-styled',
// Export dialogs // Export dialogs
'show-export-dialog', 'show-export-dialog',
'show-batch-dialog', 'show-batch-dialog',
'show-universal-converter-dialog', 'show-universal-converter-dialog',
'show-table-generator', 'show-table-generator',
'show-pdf-editor-dialog', 'show-pdf-editor-dialog',
// Converter dialogs // Converter dialogs
'show-image-converter', 'show-image-converter',
'show-audio-converter', 'show-audio-converter',
'show-video-converter', 'show-video-converter',
// PDF viewer // PDF viewer
'open-pdf-viewer', 'open-pdf-viewer',
// Conversion status // Conversion status
'conversion-status', 'conversion-status',
'conversion-complete', 'conversion-complete',
'batch-progress', 'batch-progress',
'image-conversion-complete', 'image-conversion-complete',
'audio-conversion-complete', 'audio-conversion-complete',
'video-conversion-complete', 'video-conversion-complete',
// Folder selection // Folder selection
'folder-selected', 'folder-selected',
'pdf-folder-selected', 'pdf-folder-selected',
// Header/Footer // Header/Footer
'header-footer-settings-data', 'header-footer-settings-data',
'header-footer-logo-selected', 'header-footer-logo-selected',
'header-footer-logo-saved', 'header-footer-logo-saved',
// Page settings // Page settings
'page-settings-data', 'page-settings-data',
// PDF operations // PDF operations
'pdf-page-count', 'pdf-page-count',
'pdf-operation-complete', 'pdf-operation-complete',
'pdf-operation-error', 'pdf-operation-error',
// ASCII Art Generator // ASCII Art Generator
'show-ascii-generator-window', 'show-ascii-generator-window',
'show-ascii-generator', 'show-ascii-generator',
// Table Generator // Table Generator
'show-table-generator-window', 'show-table-generator-window',
// Header/Footer dialog // Header/Footer dialog
'open-header-footer-dialog', 'open-header-footer-dialog',
'header-footer-logo-cleared', 'header-footer-logo-cleared',
// PDF operation progress // PDF operation progress
'pdf-operation-progress', 'pdf-operation-progress',
// Insert content from generator windows // Insert content from generator windows
'insert-content' 'insert-content'
]; ];
/** /**
* Secure API exposed to renderer process * Secure API exposed to renderer process
* Access via window.electronAPI in renderer * Access via window.electronAPI in renderer
*/ */
contextBridge.exposeInMainWorld('electronAPI', { contextBridge.exposeInMainWorld('electronAPI', {
// ============================================ // ============================================
// SEND METHODS (Renderer -> Main) // SEND METHODS (Renderer -> Main)
// ============================================ // ============================================
/** /**
* Send a message to the main process * Send a message to the main process
* @param {string} channel - IPC channel name * @param {string} channel - IPC channel name
* @param {any} data - Data to send * @param {any} data - Data to send
*/ */
send: (channel, data) => { send: (channel, data) => {
if (ALLOWED_SEND_CHANNELS.includes(channel)) { if (ALLOWED_SEND_CHANNELS.includes(channel)) {
ipcRenderer.send(channel, data); ipcRenderer.send(channel, data);
} else { } else {
console.warn(`[Preload] Blocked send to unauthorized channel: ${channel}`); console.warn(`[Preload] Blocked send to unauthorized channel: ${channel}`);
} }
}, },
/** /**
* Invoke a main process handler and get a response * Invoke a main process handler and get a response
* @param {string} channel - IPC channel name * @param {string} channel - IPC channel name
* @param {any} data - Data to send * @param {any} data - Data to send
* @returns {Promise<any>} Response from main process * @returns {Promise<any>} Response from main process
*/ */
invoke: async (channel, data) => { invoke: async (channel, data) => {
if (ALLOWED_SEND_CHANNELS.includes(channel)) { if (ALLOWED_SEND_CHANNELS.includes(channel)) {
return await ipcRenderer.invoke(channel, data); return await ipcRenderer.invoke(channel, data);
} else { } else {
console.warn(`[Preload] Blocked invoke to unauthorized channel: ${channel}`); console.warn(`[Preload] Blocked invoke to unauthorized channel: ${channel}`);
return null; return null;
} }
}, },
// ============================================ // ============================================
// RECEIVE METHODS (Main -> Renderer) // RECEIVE METHODS (Main -> Renderer)
// ============================================ // ============================================
/** /**
* Register a listener for messages from main process * Register a listener for messages from main process
* @param {string} channel - IPC channel name * @param {string} channel - IPC channel name
* @param {Function} callback - Function to call with received data * @param {Function} callback - Function to call with received data
* @returns {Function} Cleanup function to remove listener * @returns {Function} Cleanup function to remove listener
*/ */
on: (channel, callback) => { on: (channel, callback) => {
if (ALLOWED_RECEIVE_CHANNELS.includes(channel)) { if (ALLOWED_RECEIVE_CHANNELS.includes(channel)) {
const subscription = (event, ...args) => callback(...args); const subscription = (event, ...args) => callback(...args);
ipcRenderer.on(channel, subscription); ipcRenderer.on(channel, subscription);
// Return cleanup function // Return cleanup function
return () => { return () => {
ipcRenderer.removeListener(channel, subscription); ipcRenderer.removeListener(channel, subscription);
}; };
} else { } else {
console.warn(`[Preload] Blocked listener for unauthorized channel: ${channel}`); console.warn(`[Preload] Blocked listener for unauthorized channel: ${channel}`);
return () => {}; // No-op cleanup return () => {}; // No-op cleanup
} }
}, },
/** /**
* Register a one-time listener for messages from main process * Register a one-time listener for messages from main process
* @param {string} channel - IPC channel name * @param {string} channel - IPC channel name
* @param {Function} callback - Function to call with received data * @param {Function} callback - Function to call with received data
*/ */
once: (channel, callback) => { once: (channel, callback) => {
if (ALLOWED_RECEIVE_CHANNELS.includes(channel)) { if (ALLOWED_RECEIVE_CHANNELS.includes(channel)) {
ipcRenderer.once(channel, (event, ...args) => callback(...args)); ipcRenderer.once(channel, (event, ...args) => callback(...args));
} else { } else {
console.warn(`[Preload] Blocked once listener for unauthorized channel: ${channel}`); console.warn(`[Preload] Blocked once listener for unauthorized channel: ${channel}`);
} }
}, },
/** /**
* Remove all listeners for a channel * Remove all listeners for a channel
* @param {string} channel - IPC channel name * @param {string} channel - IPC channel name
*/ */
removeAllListeners: (channel) => { removeAllListeners: (channel) => {
if (ALLOWED_RECEIVE_CHANNELS.includes(channel)) { if (ALLOWED_RECEIVE_CHANNELS.includes(channel)) {
ipcRenderer.removeAllListeners(channel); ipcRenderer.removeAllListeners(channel);
} }
}, },
// ============================================ // ============================================
// CONVENIENCE METHODS // CONVENIENCE METHODS
// ============================================ // ============================================
// File Operations // File Operations
file: { file: {
save: (filePath, content) => ipcRenderer.send('save-file', { path: filePath, content }), save: (filePath, content) => ipcRenderer.send('save-file', { path: filePath, content }),
saveCurrent: (content) => ipcRenderer.send('save-current-file', content), saveCurrent: (content) => ipcRenderer.send('save-current-file', content),
setCurrent: (filePath) => ipcRenderer.send('set-current-file', filePath), setCurrent: (filePath) => ipcRenderer.send('set-current-file', filePath),
saveRecent: (recentFiles) => ipcRenderer.send('save-recent-files', recentFiles), saveRecent: (recentFiles) => ipcRenderer.send('save-recent-files', recentFiles),
clearRecent: () => ipcRenderer.send('clear-recent-files'), clearRecent: () => ipcRenderer.send('clear-recent-files'),
rendererReady: () => ipcRenderer.send('renderer-ready') rendererReady: () => ipcRenderer.send('renderer-ready')
}, },
// Theme Operations // Theme Operations
theme: { theme: {
get: () => ipcRenderer.send('get-theme') get: () => ipcRenderer.send('get-theme')
}, },
// Print Operations // Print Operations
print: { print: {
doPrint: (options) => ipcRenderer.send('do-print', options) doPrint: (options) => ipcRenderer.send('do-print', options)
}, },
// Export Operations // Export Operations
export: { export: {
withOptions: (format, options) => ipcRenderer.send('export-with-options', { format, options }), withOptions: (format, options) => ipcRenderer.send('export-with-options', { format, options }),
spreadsheet: (content, format) => ipcRenderer.send('export-spreadsheet', { content, format }) spreadsheet: (content, format) => ipcRenderer.send('export-spreadsheet', { content, format })
}, },
// Batch Conversion // Batch Conversion
batch: { batch: {
convert: (inputFolder, outputFolder, format, options) => { convert: (inputFolder, outputFolder, format, options) => {
ipcRenderer.send('batch-convert', { inputFolder, outputFolder, format, options }); ipcRenderer.send('batch-convert', { inputFolder, outputFolder, format, options });
}, },
selectFolder: (type) => ipcRenderer.send('select-folder', type) selectFolder: (type) => ipcRenderer.send('select-folder', type)
}, },
// Universal Converter // Universal Converter
converter: { converter: {
convert: (tool, fromFormat, toFormat, filePath) => { convert: (tool, fromFormat, toFormat, filePath) => {
ipcRenderer.send('universal-convert', { tool, fromFormat, toFormat, filePath }); ipcRenderer.send('universal-convert', { tool, fromFormat, toFormat, filePath });
}, },
convertBatch: (tool, fromFormat, toFormat, inputFolder, outputFolder) => { convertBatch: (tool, fromFormat, toFormat, inputFolder, outputFolder) => {
ipcRenderer.send('universal-convert-batch', { tool, fromFormat, toFormat, inputFolder, outputFolder }); ipcRenderer.send('universal-convert-batch', { tool, fromFormat, toFormat, inputFolder, outputFolder });
} }
}, },
// Header/Footer Operations // Header/Footer Operations
headerFooter: { headerFooter: {
getSettings: () => ipcRenderer.send('get-header-footer-settings'), getSettings: () => ipcRenderer.send('get-header-footer-settings'),
saveSettings: (settings) => ipcRenderer.send('save-header-footer-settings', settings), saveSettings: (settings) => ipcRenderer.send('save-header-footer-settings', settings),
browseLogo: (position) => ipcRenderer.send('browse-header-footer-logo', position), browseLogo: (position) => ipcRenderer.send('browse-header-footer-logo', position),
saveLogo: (position, filePath) => ipcRenderer.send('save-header-footer-logo', { position, filePath }), saveLogo: (position, filePath) => ipcRenderer.send('save-header-footer-logo', { position, filePath }),
clearLogo: (position) => ipcRenderer.send('clear-header-footer-logo', position) clearLogo: (position) => ipcRenderer.send('clear-header-footer-logo', position)
}, },
// Page Settings // Page Settings
page: { page: {
getSettings: () => ipcRenderer.send('get-page-settings'), getSettings: () => ipcRenderer.send('get-page-settings'),
updateSettings: (settings) => ipcRenderer.send('update-page-settings', settings), updateSettings: (settings) => ipcRenderer.send('update-page-settings', settings),
setCustomStartPage: (pageNumber) => ipcRenderer.send('set-custom-start-page', pageNumber) setCustomStartPage: (pageNumber) => ipcRenderer.send('set-custom-start-page', pageNumber)
}, },
// PDF Operations // PDF Operations
pdf: { pdf: {
processOperation: (data) => ipcRenderer.send('process-pdf-operation', data), processOperation: (data) => ipcRenderer.send('process-pdf-operation', data),
getPageCount: (filePath) => ipcRenderer.send('get-pdf-page-count', filePath), getPageCount: (filePath) => ipcRenderer.send('get-pdf-page-count', filePath),
selectFolder: (inputId) => ipcRenderer.send('select-pdf-folder', inputId) selectFolder: (inputId) => ipcRenderer.send('select-pdf-folder', inputId)
}, },
// Image Converter Operations // Image Converter Operations
image: { image: {
convert: (data) => ipcRenderer.send('image-convert', data), convert: (data) => ipcRenderer.send('image-convert', data),
batchConvert: (data) => ipcRenderer.send('image-batch-convert', data), batchConvert: (data) => ipcRenderer.send('image-batch-convert', data),
resize: (data) => ipcRenderer.send('image-resize', data), resize: (data) => ipcRenderer.send('image-resize', data),
compress: (data) => ipcRenderer.send('image-compress', data), compress: (data) => ipcRenderer.send('image-compress', data),
rotate: (data) => ipcRenderer.send('image-rotate', data) rotate: (data) => ipcRenderer.send('image-rotate', data)
}, },
// Audio Converter Operations // Audio Converter Operations
audio: { audio: {
convert: (data) => ipcRenderer.send('audio-convert', data), convert: (data) => ipcRenderer.send('audio-convert', data),
batchConvert: (data) => ipcRenderer.send('audio-batch-convert', data), batchConvert: (data) => ipcRenderer.send('audio-batch-convert', data),
extract: (data) => ipcRenderer.send('audio-extract', data), extract: (data) => ipcRenderer.send('audio-extract', data),
trim: (data) => ipcRenderer.send('audio-trim', data), trim: (data) => ipcRenderer.send('audio-trim', data),
merge: (data) => ipcRenderer.send('audio-merge', data) merge: (data) => ipcRenderer.send('audio-merge', data)
}, },
// Video Converter Operations // Video Converter Operations
video: { video: {
convert: (data) => ipcRenderer.send('video-convert', data), convert: (data) => ipcRenderer.send('video-convert', data),
batchConvert: (data) => ipcRenderer.send('video-batch-convert', data), batchConvert: (data) => ipcRenderer.send('video-batch-convert', data),
compress: (data) => ipcRenderer.send('video-compress', data), compress: (data) => ipcRenderer.send('video-compress', data),
trim: (data) => ipcRenderer.send('video-trim', data), trim: (data) => ipcRenderer.send('video-trim', data),
extractFrames: (data) => ipcRenderer.send('video-frames', data), extractFrames: (data) => ipcRenderer.send('video-frames', data),
toGif: (data) => ipcRenderer.send('video-gif', data) toGif: (data) => ipcRenderer.send('video-gif', data)
}, },
// Generator Windows // Generator Windows
generators: { generators: {
openAscii: () => ipcRenderer.send('open-ascii-generator'), openAscii: () => ipcRenderer.send('open-ascii-generator'),
openTable: () => ipcRenderer.send('open-table-generator') openTable: () => ipcRenderer.send('open-table-generator')
} }
}); });
// Log successful preload initialization // Log successful preload initialization
console.log('[Preload] Secure IPC bridge initialized'); console.log('[Preload] Secure IPC bridge initialized');
console.log('[Preload] Allowed send channels:', ALLOWED_SEND_CHANNELS.length); console.log('[Preload] Allowed send channels:', ALLOWED_SEND_CHANNELS.length);
console.log('[Preload] Allowed receive channels:', ALLOWED_RECEIVE_CHANNELS.length); console.log('[Preload] Allowed receive channels:', ALLOWED_RECEIVE_CHANNELS.length);
+4514 -4514
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+2113 -2113
View File
File diff suppressed because it is too large Load Diff
+4080 -4080
View File
File diff suppressed because it is too large Load Diff
+545 -545
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+12 -12
View File
@@ -1,12 +1,12 @@
# Test Double-Click File Opening # Test Double-Click File Opening
This is a test file to verify double-click functionality. This is a test file to verify double-click functionality.
## Features to Test ## Features to Test
- File should load automatically - File should load automatically
- Content should display in editor - Content should display in editor
- Tab should show filename - Tab should show filename
- Preview should render markdown - Preview should render markdown
**This text should be bold** **This text should be bold**
*This text should be italic* *This text should be italic*
+48 -48
View File
@@ -1,49 +1,49 @@
// Test script to verify export functionality // Test script to verify export functionality
const { exec } = require('child_process'); const { exec } = require('child_process');
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');
console.log('Testing export functionality...'); console.log('Testing export functionality...');
// Test 1: Check if pandoc is available // Test 1: Check if pandoc is available
console.log('\n1. Checking Pandoc availability...'); console.log('\n1. Checking Pandoc availability...');
exec('pandoc --version', (error, stdout, stderr) => { exec('pandoc --version', (error, stdout, stderr) => {
if (error) { if (error) {
console.log('❌ Pandoc not available:', error.message); console.log('❌ Pandoc not available:', error.message);
console.log('✅ Built-in HTML and PDF export should work'); console.log('✅ Built-in HTML and PDF export should work');
} else { } else {
console.log('✅ Pandoc is available'); console.log('✅ Pandoc is available');
console.log(' Version info:', stdout.split('\n')[0]); console.log(' Version info:', stdout.split('\n')[0]);
} }
}); });
// Test 2: Check if test markdown file exists // Test 2: Check if test markdown file exists
console.log('\n2. Checking test file...'); console.log('\n2. Checking test file...');
const testFile = path.join(__dirname, 'test-export.md'); const testFile = path.join(__dirname, 'test-export.md');
if (fs.existsSync(testFile)) { if (fs.existsSync(testFile)) {
console.log('✅ Test markdown file exists:', testFile); console.log('✅ Test markdown file exists:', testFile);
const content = fs.readFileSync(testFile, 'utf8'); const content = fs.readFileSync(testFile, 'utf8');
console.log(' File size:', content.length, 'characters'); console.log(' File size:', content.length, 'characters');
} else { } else {
console.log('❌ Test markdown file not found'); console.log('❌ Test markdown file not found');
} }
// Test 3: Check marked library // Test 3: Check marked library
console.log('\n3. Testing marked library...'); console.log('\n3. Testing marked library...');
try { try {
const marked = require('marked'); const marked = require('marked');
const testMarkdown = '# Test\nThis is a **test** markdown.'; const testMarkdown = '# Test\nThis is a **test** markdown.';
const html = marked.parse(testMarkdown); const html = marked.parse(testMarkdown);
console.log('✅ Marked library working'); console.log('✅ Marked library working');
console.log(' Sample output:', html.substring(0, 50) + '...'); console.log(' Sample output:', html.substring(0, 50) + '...');
} catch (error) { } catch (error) {
console.log('❌ Marked library error:', error.message); console.log('❌ Marked library error:', error.message);
} }
console.log('\n✅ Export functionality test completed!'); console.log('\n✅ Export functionality test completed!');
console.log('\nHow to test exports:'); console.log('\nHow to test exports:');
console.log('1. Open the application'); console.log('1. Open the application');
console.log('2. Open test-export.md file'); console.log('2. Open test-export.md file');
console.log('3. Try exporting to HTML (should work without Pandoc)'); console.log('3. Try exporting to HTML (should work without Pandoc)');
console.log('4. Try exporting to PDF (should work without Pandoc)'); console.log('4. Try exporting to PDF (should work without Pandoc)');
console.log('5. Try exporting to DOCX (requires Pandoc)'); console.log('5. Try exporting to DOCX (requires Pandoc)');
+25 -25
View File
@@ -1,26 +1,26 @@
# Test Document # Test Document
This is a test markdown document for export testing. This is a test markdown document for export testing.
## Features ## Features
- **Bold text** - **Bold text**
- *Italic text* - *Italic text*
- [Links](https://example.com) - [Links](https://example.com)
## Code Example ## Code Example
```javascript ```javascript
function hello() { function hello() {
console.log("Hello World!"); console.log("Hello World!");
} }
``` ```
## Table ## Table
| Column 1 | Column 2 | Column 3 | | Column 1 | Column 2 | Column 3 |
|----------|----------|----------| |----------|----------|----------|
| Value 1 | Value 2 | Value 3 | | Value 1 | Value 2 | Value 3 |
| Value 4 | Value 5 | Value 6 | | Value 4 | Value 5 | Value 6 |
This is a test document to verify export functionality. This is a test document to verify export functionality.
+14 -14
View File
@@ -1,14 +1,14 @@
# Test File Opening # Test File Opening
This is a test file to verify that double-click file opening works correctly. This is a test file to verify that double-click file opening works correctly.
## Features ## Features
- **Bold text** - **Bold text**
- *Italic text* - *Italic text*
- `Code` - `Code`
```javascript ```javascript
console.log("Hello World"); console.log("Hello World");
``` ```
This should appear when you double-click to open the file! This should appear when you double-click to open the file!
+22 -22
View File
@@ -1,23 +1,23 @@
# Test Document # Test Document
This is a **test** markdown document. This is a **test** markdown document.
## Features ## Features
- Item 1 - Item 1
- Item 2 - Item 2
- Item 3 - Item 3
### Code Example ### Code Example
```javascript ```javascript
console.log("Hello World"); console.log("Hello World");
``` ```
> Tqweqweqweqweqweqweqeweqweqweqwe > Tqweqweqweqweqweqweqeweqweqweqwe
dfe dfe
qwe qwe
qwe qwe
qwe qwe
qwe qwe
+121 -121
View File
@@ -1,121 +1,121 @@
/** /**
* Tests for Preload Script Security * Tests for Preload Script Security
* Verifies that the IPC bridge is properly configured * Verifies that the IPC bridge is properly configured
*/ */
describe('Preload Security', () => { describe('Preload Security', () => {
describe('Allowed Channels', () => { describe('Allowed Channels', () => {
const EXPECTED_SEND_CHANNELS = [ const EXPECTED_SEND_CHANNELS = [
'save-file', 'save-file',
'save-current-file', 'save-current-file',
'set-current-file', 'set-current-file',
'save-recent-files', 'save-recent-files',
'clear-recent-files', 'clear-recent-files',
'renderer-ready', 'renderer-ready',
'get-theme', 'get-theme',
'do-print', 'do-print',
'export-with-options', 'export-with-options',
'export-spreadsheet', 'export-spreadsheet',
'batch-convert', 'batch-convert',
'select-folder', 'select-folder',
'universal-convert', 'universal-convert',
'universal-convert-batch', 'universal-convert-batch',
'get-header-footer-settings', 'get-header-footer-settings',
'save-header-footer-settings', 'save-header-footer-settings',
'browse-header-footer-logo', 'browse-header-footer-logo',
'save-header-footer-logo', 'save-header-footer-logo',
'clear-header-footer-logo', 'clear-header-footer-logo',
'get-page-settings', 'get-page-settings',
'update-page-settings', 'update-page-settings',
'set-custom-start-page', 'set-custom-start-page',
'process-pdf-operation', 'process-pdf-operation',
'get-pdf-page-count', 'get-pdf-page-count',
'select-pdf-folder' 'select-pdf-folder'
]; ];
const EXPECTED_RECEIVE_CHANNELS = [ const EXPECTED_RECEIVE_CHANNELS = [
'file-new', 'file-new',
'file-opened', 'file-opened',
'file-save', 'file-save',
'get-content-for-save', 'get-content-for-save',
'get-content-for-spreadsheet', 'get-content-for-spreadsheet',
'recent-files-cleared', 'recent-files-cleared',
'toggle-preview', 'toggle-preview',
'toggle-find', 'toggle-find',
'theme-changed', 'theme-changed',
'theme-data', 'theme-data',
'undo', 'undo',
'redo', 'redo',
'adjust-font-size', 'adjust-font-size',
'print-preview', 'print-preview',
'print-preview-styled', 'print-preview-styled',
'show-export-dialog', 'show-export-dialog',
'show-batch-dialog', 'show-batch-dialog',
'show-universal-converter-dialog', 'show-universal-converter-dialog',
'show-table-generator', 'show-table-generator',
'show-pdf-editor-dialog', 'show-pdf-editor-dialog',
'conversion-status', 'conversion-status',
'conversion-complete', 'conversion-complete',
'batch-progress', 'batch-progress',
'folder-selected', 'folder-selected',
'pdf-folder-selected', 'pdf-folder-selected',
'header-footer-settings-data', 'header-footer-settings-data',
'header-footer-logo-selected', 'header-footer-logo-selected',
'header-footer-logo-saved', 'header-footer-logo-saved',
'page-settings-data', 'page-settings-data',
'pdf-page-count', 'pdf-page-count',
'pdf-operation-complete', 'pdf-operation-complete',
'pdf-operation-error' 'pdf-operation-error'
]; ];
test('should define all expected send channels', () => { test('should define all expected send channels', () => {
// This test documents expected channels // This test documents expected channels
expect(EXPECTED_SEND_CHANNELS.length).toBeGreaterThan(0); expect(EXPECTED_SEND_CHANNELS.length).toBeGreaterThan(0);
}); });
test('should define all expected receive channels', () => { test('should define all expected receive channels', () => {
// This test documents expected channels // This test documents expected channels
expect(EXPECTED_RECEIVE_CHANNELS.length).toBeGreaterThan(0); expect(EXPECTED_RECEIVE_CHANNELS.length).toBeGreaterThan(0);
}); });
}); });
describe('electronAPI Interface', () => { describe('electronAPI Interface', () => {
test('should expose send method', () => { test('should expose send method', () => {
expect(window.electronAPI.send).toBeDefined(); expect(window.electronAPI.send).toBeDefined();
expect(typeof window.electronAPI.send).toBe('function'); expect(typeof window.electronAPI.send).toBe('function');
}); });
test('should expose on method', () => { test('should expose on method', () => {
expect(window.electronAPI.on).toBeDefined(); expect(window.electronAPI.on).toBeDefined();
expect(typeof window.electronAPI.on).toBe('function'); expect(typeof window.electronAPI.on).toBe('function');
}); });
test('should expose once method', () => { test('should expose once method', () => {
expect(window.electronAPI.once).toBeDefined(); expect(window.electronAPI.once).toBeDefined();
expect(typeof window.electronAPI.once).toBe('function'); expect(typeof window.electronAPI.once).toBe('function');
}); });
test('should expose invoke method', () => { test('should expose invoke method', () => {
expect(window.electronAPI.invoke).toBeDefined(); expect(window.electronAPI.invoke).toBeDefined();
expect(typeof window.electronAPI.invoke).toBe('function'); expect(typeof window.electronAPI.invoke).toBe('function');
}); });
test('should expose file convenience methods', () => { test('should expose file convenience methods', () => {
expect(window.electronAPI.file).toBeDefined(); expect(window.electronAPI.file).toBeDefined();
expect(window.electronAPI.file.save).toBeDefined(); expect(window.electronAPI.file.save).toBeDefined();
expect(window.electronAPI.file.saveCurrent).toBeDefined(); expect(window.electronAPI.file.saveCurrent).toBeDefined();
expect(window.electronAPI.file.setCurrent).toBeDefined(); expect(window.electronAPI.file.setCurrent).toBeDefined();
}); });
test('should expose theme convenience methods', () => { test('should expose theme convenience methods', () => {
expect(window.electronAPI.theme).toBeDefined(); expect(window.electronAPI.theme).toBeDefined();
expect(window.electronAPI.theme.get).toBeDefined(); expect(window.electronAPI.theme.get).toBeDefined();
}); });
test('should expose pdf convenience methods', () => { test('should expose pdf convenience methods', () => {
expect(window.electronAPI.pdf).toBeDefined(); expect(window.electronAPI.pdf).toBeDefined();
expect(window.electronAPI.pdf.processOperation).toBeDefined(); expect(window.electronAPI.pdf.processOperation).toBeDefined();
expect(window.electronAPI.pdf.getPageCount).toBeDefined(); expect(window.electronAPI.pdf.getPageCount).toBeDefined();
}); });
}); });
}); });
+100 -100
View File
@@ -1,100 +1,100 @@
/** /**
* Jest Test Setup * Jest Test Setup
* Provides mocks and utilities for PanConverter tests * Provides mocks and utilities for PanConverter tests
*/ */
// Mock window.electronAPI for renderer tests // Mock window.electronAPI for renderer tests
global.window = global.window || {}; global.window = global.window || {};
global.window.electronAPI = { global.window.electronAPI = {
send: jest.fn(), send: jest.fn(),
on: jest.fn(() => jest.fn()), // Returns cleanup function on: jest.fn(() => jest.fn()), // Returns cleanup function
once: jest.fn(), once: jest.fn(),
invoke: jest.fn(() => Promise.resolve(null)), invoke: jest.fn(() => Promise.resolve(null)),
removeAllListeners: jest.fn(), removeAllListeners: jest.fn(),
file: { file: {
save: jest.fn(), save: jest.fn(),
saveCurrent: jest.fn(), saveCurrent: jest.fn(),
setCurrent: jest.fn(), setCurrent: jest.fn(),
saveRecent: jest.fn(), saveRecent: jest.fn(),
clearRecent: jest.fn(), clearRecent: jest.fn(),
rendererReady: jest.fn() rendererReady: jest.fn()
}, },
theme: { theme: {
get: jest.fn() get: jest.fn()
}, },
print: { print: {
doPrint: jest.fn() doPrint: jest.fn()
}, },
export: { export: {
withOptions: jest.fn(), withOptions: jest.fn(),
spreadsheet: jest.fn() spreadsheet: jest.fn()
}, },
batch: { batch: {
convert: jest.fn(), convert: jest.fn(),
selectFolder: jest.fn() selectFolder: jest.fn()
}, },
converter: { converter: {
convert: jest.fn(), convert: jest.fn(),
convertBatch: jest.fn() convertBatch: jest.fn()
}, },
headerFooter: { headerFooter: {
getSettings: jest.fn(), getSettings: jest.fn(),
saveSettings: jest.fn(), saveSettings: jest.fn(),
browseLogo: jest.fn(), browseLogo: jest.fn(),
saveLogo: jest.fn(), saveLogo: jest.fn(),
clearLogo: jest.fn() clearLogo: jest.fn()
}, },
page: { page: {
getSettings: jest.fn(), getSettings: jest.fn(),
updateSettings: jest.fn(), updateSettings: jest.fn(),
setCustomStartPage: jest.fn() setCustomStartPage: jest.fn()
}, },
pdf: { pdf: {
processOperation: jest.fn(), processOperation: jest.fn(),
getPageCount: jest.fn(), getPageCount: jest.fn(),
selectFolder: jest.fn() selectFolder: jest.fn()
} }
}; };
// Mock marked library // Mock marked library
global.window.marked = { global.window.marked = {
parse: jest.fn((text) => `<p>${text}</p>`), parse: jest.fn((text) => `<p>${text}</p>`),
setOptions: jest.fn() setOptions: jest.fn()
}; };
// Mock DOMPurify // Mock DOMPurify
global.window.DOMPurify = { global.window.DOMPurify = {
sanitize: jest.fn((html) => html) sanitize: jest.fn((html) => html)
}; };
// Mock highlight.js // Mock highlight.js
global.window.hljs = { global.window.hljs = {
highlight: jest.fn((code, options) => ({ value: code })), highlight: jest.fn((code, options) => ({ value: code })),
highlightAuto: jest.fn((code) => ({ value: code })), highlightAuto: jest.fn((code) => ({ value: code })),
getLanguage: jest.fn(() => true) getLanguage: jest.fn(() => true)
}; };
// Mock localStorage // Mock localStorage
const localStorageMock = { const localStorageMock = {
getItem: jest.fn(), getItem: jest.fn(),
setItem: jest.fn(), setItem: jest.fn(),
removeItem: jest.fn(), removeItem: jest.fn(),
clear: jest.fn() clear: jest.fn()
}; };
global.localStorage = localStorageMock; global.localStorage = localStorageMock;
// Console spy to catch unintended console logs in tests // Console spy to catch unintended console logs in tests
const originalConsoleError = console.error; const originalConsoleError = console.error;
console.error = (...args) => { console.error = (...args) => {
// Allow certain expected errors // Allow certain expected errors
const message = args[0]?.toString() || ''; const message = args[0]?.toString() || '';
if (message.includes('Warning:') || message.includes('React')) { if (message.includes('Warning:') || message.includes('React')) {
return; return;
} }
originalConsoleError.apply(console, args); originalConsoleError.apply(console, args);
}; };
// Cleanup after each test // Cleanup after each test
afterEach(() => { afterEach(() => {
jest.clearAllMocks(); jest.clearAllMocks();
}); });
+137 -137
View File
@@ -1,137 +1,137 @@
/** /**
* Tests for Utility Functions * Tests for Utility Functions
* Tests helper functions that can be extracted and tested * Tests helper functions that can be extracted and tested
*/ */
describe('Utility Functions', () => { describe('Utility Functions', () => {
describe('parseCommand', () => { describe('parseCommand', () => {
// This function parses command strings into command and args // This function parses command strings into command and args
function parseCommand(cmdString) { function parseCommand(cmdString) {
const parts = []; const parts = [];
let current = ''; let current = '';
let inQuotes = false; let inQuotes = false;
let quoteChar = ''; let quoteChar = '';
for (let i = 0; i < cmdString.length; i++) { for (let i = 0; i < cmdString.length; i++) {
const char = cmdString[i]; const char = cmdString[i];
if ((char === '"' || char === "'") && !inQuotes) { if ((char === '"' || char === "'") && !inQuotes) {
inQuotes = true; inQuotes = true;
quoteChar = char; quoteChar = char;
} else if (char === quoteChar && inQuotes) { } else if (char === quoteChar && inQuotes) {
inQuotes = false; inQuotes = false;
quoteChar = ''; quoteChar = '';
} else if (char === ' ' && !inQuotes) { } else if (char === ' ' && !inQuotes) {
if (current) { if (current) {
parts.push(current); parts.push(current);
current = ''; current = '';
} }
} else { } else {
current += char; current += char;
} }
} }
if (current) { if (current) {
parts.push(current); parts.push(current);
} }
return { return {
command: parts[0], command: parts[0],
args: parts.slice(1) args: parts.slice(1)
}; };
} }
test('should parse simple command', () => { test('should parse simple command', () => {
const result = parseCommand('pandoc input.md -o output.pdf'); const result = parseCommand('pandoc input.md -o output.pdf');
expect(result.command).toBe('pandoc'); expect(result.command).toBe('pandoc');
expect(result.args).toEqual(['input.md', '-o', 'output.pdf']); expect(result.args).toEqual(['input.md', '-o', 'output.pdf']);
}); });
test('should handle double-quoted paths', () => { test('should handle double-quoted paths', () => {
const result = parseCommand('pandoc "C:/path with spaces/file.md" -o output.pdf'); const result = parseCommand('pandoc "C:/path with spaces/file.md" -o output.pdf');
expect(result.command).toBe('pandoc'); expect(result.command).toBe('pandoc');
expect(result.args).toEqual(['C:/path with spaces/file.md', '-o', 'output.pdf']); expect(result.args).toEqual(['C:/path with spaces/file.md', '-o', 'output.pdf']);
}); });
test('should handle single-quoted paths', () => { test('should handle single-quoted paths', () => {
const result = parseCommand("pandoc 'file name.md' -o output.pdf"); const result = parseCommand("pandoc 'file name.md' -o output.pdf");
expect(result.command).toBe('pandoc'); expect(result.command).toBe('pandoc');
expect(result.args).toEqual(['file name.md', '-o', 'output.pdf']); expect(result.args).toEqual(['file name.md', '-o', 'output.pdf']);
}); });
test('should handle multiple options', () => { test('should handle multiple options', () => {
const result = parseCommand('pandoc input.md --pdf-engine=xelatex -V geometry:margin=1in -o output.pdf'); const result = parseCommand('pandoc input.md --pdf-engine=xelatex -V geometry:margin=1in -o output.pdf');
expect(result.command).toBe('pandoc'); expect(result.command).toBe('pandoc');
expect(result.args).toContain('--pdf-engine=xelatex'); expect(result.args).toContain('--pdf-engine=xelatex');
expect(result.args).toContain('-V'); expect(result.args).toContain('-V');
}); });
test('should handle empty command', () => { test('should handle empty command', () => {
const result = parseCommand(''); const result = parseCommand('');
expect(result.command).toBeUndefined(); expect(result.command).toBeUndefined();
expect(result.args).toEqual([]); expect(result.args).toEqual([]);
}); });
}); });
describe('hexToRgb', () => { describe('hexToRgb', () => {
// This function converts hex colors to RGB // This function converts hex colors to RGB
function hexToRgb(hex) { function hexToRgb(hex) {
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result ? { return result ? {
r: parseInt(result[1], 16) / 255, r: parseInt(result[1], 16) / 255,
g: parseInt(result[2], 16) / 255, g: parseInt(result[2], 16) / 255,
b: parseInt(result[3], 16) / 255 b: parseInt(result[3], 16) / 255
} : null; } : null;
} }
test('should convert black hex to RGB', () => { test('should convert black hex to RGB', () => {
const result = hexToRgb('#000000'); const result = hexToRgb('#000000');
expect(result).toEqual({ r: 0, g: 0, b: 0 }); expect(result).toEqual({ r: 0, g: 0, b: 0 });
}); });
test('should convert white hex to RGB', () => { test('should convert white hex to RGB', () => {
const result = hexToRgb('#ffffff'); const result = hexToRgb('#ffffff');
expect(result).toEqual({ r: 1, g: 1, b: 1 }); expect(result).toEqual({ r: 1, g: 1, b: 1 });
}); });
test('should convert red hex to RGB', () => { test('should convert red hex to RGB', () => {
const result = hexToRgb('#ff0000'); const result = hexToRgb('#ff0000');
expect(result.r).toBeCloseTo(1); expect(result.r).toBeCloseTo(1);
expect(result.g).toBeCloseTo(0); expect(result.g).toBeCloseTo(0);
expect(result.b).toBeCloseTo(0); expect(result.b).toBeCloseTo(0);
}); });
test('should handle hex without hash', () => { test('should handle hex without hash', () => {
const result = hexToRgb('00ff00'); const result = hexToRgb('00ff00');
expect(result.r).toBeCloseTo(0); expect(result.r).toBeCloseTo(0);
expect(result.g).toBeCloseTo(1); expect(result.g).toBeCloseTo(1);
expect(result.b).toBeCloseTo(0); expect(result.b).toBeCloseTo(0);
}); });
test('should return null for invalid hex', () => { test('should return null for invalid hex', () => {
expect(hexToRgb('invalid')).toBeNull(); expect(hexToRgb('invalid')).toBeNull();
expect(hexToRgb('#xyz')).toBeNull(); expect(hexToRgb('#xyz')).toBeNull();
}); });
}); });
describe('File Path Utilities', () => { describe('File Path Utilities', () => {
test('should extract file extension', () => { test('should extract file extension', () => {
const getExtension = (filepath) => { const getExtension = (filepath) => {
const match = filepath.match(/\.([^/.]+)$/); const match = filepath.match(/\.([^/.]+)$/);
return match ? match[1].toLowerCase() : ''; return match ? match[1].toLowerCase() : '';
}; };
expect(getExtension('file.md')).toBe('md'); expect(getExtension('file.md')).toBe('md');
expect(getExtension('document.PDF')).toBe('pdf'); expect(getExtension('document.PDF')).toBe('pdf');
expect(getExtension('path/to/file.docx')).toBe('docx'); expect(getExtension('path/to/file.docx')).toBe('docx');
expect(getExtension('noextension')).toBe(''); expect(getExtension('noextension')).toBe('');
}); });
test('should replace file extension', () => { test('should replace file extension', () => {
const replaceExtension = (filepath, newExt) => { const replaceExtension = (filepath, newExt) => {
return filepath.replace(/\.[^/.]+$/, `.${newExt}`); return filepath.replace(/\.[^/.]+$/, `.${newExt}`);
}; };
expect(replaceExtension('file.md', 'pdf')).toBe('file.pdf'); expect(replaceExtension('file.md', 'pdf')).toBe('file.pdf');
expect(replaceExtension('path/to/doc.docx', 'html')).toBe('path/to/doc.html'); expect(replaceExtension('path/to/doc.docx', 'html')).toBe('path/to/doc.html');
}); });
}); });
}); });