qwen-code-fde999bc-50e4-465e-9252-6b06a2462a2b
- Added `app.py` with Flask backend for real-time Markdown to Word conversion using python-docx - Implemented `convert_md_to_docx` function with support for headings, tables, code blocks, images, and blockquote styling - Created `templates/index.html` with responsive UI featuring dual-panel editor/preview layout - Added `static/script.js` for client-side functionality including live preview, toolbar buttons, and export workflow - Enhanced `static/style.css` with modern styling for editor, preview, and settings panels - Updated `README.md` to document features, usage, and customization options - Added `requirements.txt` with dependencies: Flask, python-docx, markdown - Implemented auto-captioning for images and tables with sequential numbering - Added table pagination support with header repetition across page breaks - Integrated configuration settings panel for customizing styles, captions, and document options
GhostEditor - Markdown to Word Converter
A web-based application that converts Markdown to Word documents with advanced features including real-time preview, styling options, auto-captioning, and table pagination.
Features
- Real-time Conversion: See your Markdown text convert to Word format in real-time
- Styling Options: Apply different styles to text elements (headings, quotes, code blocks, etc.)
- Auto Captioning: Automatic captions for images, tables, and figures
- Table Pagination: Support for tables that span across pages with repeating headers
- Custom Settings: Configure document settings and styling preferences
Requirements
- Python 3.7+
- Flask
- python-docx
- markdown
Installation
-
Install the required packages:
pip install -r requirements.txt -
Run the application:
python app.py -
Open your browser and navigate to
http://localhost:5000
Usage
- Enter or paste your Markdown content in the left editor panel
- See the real-time conversion in the right preview panel
- Use the settings panel to configure document options:
- Set document title
- Choose default text style
- Enable/disable auto-captioning for images, tables, and figures
- Enable/disable table pagination
- Use the toolbar buttons to format text directly in the editor
- Select block type and apply custom styles to specific elements
- Add custom captions to elements as needed
- Click "Export to Word" to download your document
Features Explained
Real-time Preview
- The application converts Markdown to Word format as you type
- Preview updates automatically as you make changes
Auto Captioning
- Images automatically receive "Figure X" captions
- Tables automatically receive "Table X" captions
- Captions are numbered sequentially
Table Pagination
- When enabled, tables that span multiple pages will repeat their header row
- This ensures readability when tables cross page boundaries
Block Styling
- Select different block types (paragraph, heading, list, etc.)
- Apply specific styles to different content blocks
- Add custom captions to any element
File Structure
/workspace/
├── app.py # Main Flask application
├── requirements.txt # Python dependencies
├── templates/
│ └── index.html # Main HTML template
└── static/
├── style.css # CSS styling
└── script.js # JavaScript functionality
Technologies Used
- Frontend: HTML, CSS, JavaScript, Bootstrap 5, Marked.js
- Backend: Flask (Python)
- Document Processing: python-docx
- Markdown Processing: markdown (Python library)
Customization
You can customize the application by modifying:
static/style.cssfor visual stylingstatic/script.jsfor client-side functionalityapp.pyfor server-side processing and document generation
Description
Languages
Python
98.2%
Batchfile
0.9%
TeX
0.3%
VBA
0.3%
HTML
0.2%