A modern, feature-rich text editor for Windows with a clean interface, dark mode support, and powerful text manipulation capabilities.
- Dark/Light Mode: Toggle between dark and light themes for comfortable viewing
- Instant Theme Switching: Revolutionary 95% performance improvement (from ~10 seconds to <500ms) using advanced CSS and JavaScript optimization
- Custom Window Controls: Sleek, borderless window design with custom minimize, maximize, and close buttons
- Responsive Design: Smooth resizing and window management
- Rich Text Formatting: Apply bold (Ctrl+B), italic (Ctrl+I), and underline (Ctrl+U) formatting
- Font Customization: Full font dialog with family, size, style, and color options
- Zoom Control: Quickly adjust text size with Ctrl+Plus/Minus or mouse wheel (Ctrl+Scroll)
- Find & Replace: Powerful search and replace functionality (Ctrl+F) with options for:
- Case-sensitive search
- Whole word matching
- Replace all occurrences
- Markdown Preview: Real-time preview mode for markdown files with WebView2-powered HTML rendering
- Instant Theme Switching: Themes change instantly in preview mode without page reloads
- Advanced Rendering: GitHub-style CSS with full markdown extensions support (tables, code blocks, task lists)
- Smart Content Sync: Seamless switching between raw text and formatted preview
- HTML Preview: Render local
.html/.htmfiles as full web pages inside the editor using WebView2 - PDF Export: Export Markdown, HTML, and DOCX-derived content as PDF with optimized print formatting (Ctrl+P)
- Print-Optimized Output: Clean, professional PDF layout using WebView2's native print dialog
- Automatic Preview Mode: Seamlessly switches to preview mode for export if needed
- Hyperlink Support: Add, edit, and navigate hyperlinks (Ctrl+K)
- Auto-Save: Automatic saving every 5 minutes with visual status indicator
- Multi-Format Support: Open and save .txt, .log, .csv, .json, .xml, .ini, .config, .cs, .srt (subtitle), .md/.markdown (markdown), .html/.htm files, and open .docx for read-only preview
- Drag & Drop: Simply drag files into the window to open them
- Undo/Redo: Standard undo functionality (Ctrl+Z)
Experience the power of instant markdown preview with seamless switching between raw editing and formatted display:
Left: Raw markdown editing mode with syntax highlighting | Right: Real-time HTML preview with GitHub-style formatting
| Action | Shortcut |
|---|---|
| Save As | Ctrl+S (when no file is open) |
| Quick Save | Ctrl+S (when file is open) |
| Find/Replace | Ctrl+F |
| Add/Edit Hyperlink | Ctrl+K |
| PDF Export | Ctrl+P |
| Bold | Ctrl+B |
| Italic | Ctrl+I |
| Underline | Ctrl+U |
| Undo | Ctrl+Z |
| Zoom In | Ctrl+Plus or Ctrl+Mouse Wheel Up |
| Zoom Out | Ctrl+Minus or Ctrl+Mouse Wheel Down |
| Select All | Ctrl+A |
| Cut | Ctrl+X |
| Copy | Ctrl+C |
| Paste | Ctrl+V |
- Windows 10 or later (version 1809+ for WebView2 support)
- .NET 8.0 Runtime (will be prompted to install if not present)
- WebView2 Runtime (automatically installed on Windows 10/11, or download from Microsoft if needed)
- Go to the Releases page
- Download the latest
ModernTextViewer.exe - Run the application - no installation required!
Prerequisites:
- .NET 8.0 SDK
- Windows 10 or later
- Visual Studio 2022 (optional, but recommended)
# Clone the repository
git clone https://github.com/yourusername/ModernTextViewer.git
cd ModernTextViewer
# Build the project
dotnet build -c Release
# Run the application
dotnet runThe compiled executable will be in bin\Release\net8.0-windows\
ModernTextViewer features breakthrough theme switching performance that delivers 95% faster theme changes compared to traditional approaches:
- Traditional Approach: ~10 seconds (page reload required)
- ModernTextViewer: <500ms (instant JavaScript-based switching)
Technical Implementation:
- CSS Custom Properties: Universal CSS with theme variables for instant color changes
- JavaScript Injection: Direct DOM manipulation via
ExecuteScriptAsync() - Smart Fallbacks: Graceful degradation to page reload if JavaScript fails
- Smooth Transitions: Built-in CSS transitions provide visual feedback
This innovation makes ModernTextViewer one of the fastest markdown editors for theme switching, providing a seamless user experience when working with different lighting conditions throughout the day.
See the revolutionary performance improvement in real-time - themes switch instantly without any page reloads:
Instant theme switching: Same document, different themes, zero waiting time. Switch between light and dark modes in under 500ms.
- Drag and Drop: Simply drag any supported file into the window
- Using Save Dialog: Click the πΎ+ button to open a file through the save dialog
- Open any
.md/.markdown,.html/.htm, or.docxfile - Press Ctrl+P or click the π button in the toolbar
- The application will automatically switch to preview mode if needed
- Use the native print dialog to save as PDF with optimized formatting
- Note: PDF export is available for Markdown, HTML, and DOCX-derived content (DOCX is loaded as plain text for preview/export)
- Select the text you want to format
- Use keyboard shortcuts (Ctrl+B/I/U) or the font button (A) in the toolbar
- For advanced formatting, click the font button to open the font dialog
- Select text you want to turn into a hyperlink
- Press Ctrl+K or click the π button
- Enter the URL in the dialog
- Click on hyperlinks to open them in your default browser
- Press Ctrl+F to open the Find/Replace dialog
- Enter your search term
- Use "Find Next" to navigate through matches
- Use "Replace" or "Replace All" for text substitution
- Open any
.mdor.markdownfile - Click the ποΈ button in the toolbar to switch to preview mode
- View your markdown rendered with GitHub-style formatting
- Click the π button to return to raw editing mode
- Theme switching: Change themes instantly while in preview mode - no waiting!
- Open any
.htmlor.htmfile - Click the ποΈ button in the toolbar to switch to preview mode
- The app will navigate the embedded WebView2 control directly to the HTML file so relative assets (CSS/JS/images) resolve correctly
- Click the π button to return to raw editing mode
- Open any
.docxfile - The document's text content is extracted and displayed in raw mode for reading/editing as plain text (the original
.docxfile is not modified) - Click the ποΈ button to preview the extracted text with the same themed Markdown-style preview
- Use Ctrl+P / π to export the DOCX-derived content to PDF via WebView2
- Note: Quick Save and Auto-save will not overwrite
.docxfiles; use Save As to save changes in a text-based format
π‘ See the Visual Showcase above for side-by-side comparisons of raw vs preview modes and instant theme switching demonstrations.
ModernTextViewer follows a Model-View-Service architecture pattern:
ModernTextViewer/
βββ Program.cs # Application entry point
βββ src/
β βββ Forms/ # UI Forms (MainForm, Dialogs)
β βββ Models/ # Data models (Document, Hyperlink)
β βββ Services/ # Business logic (File operations, Hyperlink handling)
β βββ Controls/ # Custom UI controls
- Framework: .NET 8.0
- UI Framework: Windows Forms with WebView2 integration
- Language: C# 12.0
- Markdown Processing: Markdig v0.41.3 (high-performance markdown parser)
- Web Rendering: Microsoft.Web.WebView2 v1.0.3351.48
- IDE: Visual Studio 2022 / VS Code
MainForm.cs: Main application window and UI logic with WebView2 integrationDocumentModel.cs: Document state management with preview mode supportFileService.cs: Async file I/O operationsPreviewService.cs: Markdown-to-HTML conversion with optimized theme switchingFindReplaceDialog.cs: Search and replace functionalityHyperlinkDialog.cs: Hyperlink management
- 95% Theme Switching Improvement: Advanced CSS custom properties and JavaScript injection eliminate page reloads
- Instant Preview Updates: Real-time markdown rendering with smooth transitions
- Memory Efficient: Lazy WebView2 initialization and cached CSS generation
- Responsive UI: Non-blocking operations maintain smooth user experience
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Follow C# coding conventions
- Maintain the existing architecture pattern
- Add XML documentation for public methods
- Test on Windows 10 and Windows 11
- Ensure dark mode compatibility for new features
This project is licensed under the MIT License - see the LICENSE file for details.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Built with .NET and Windows Forms
- Icon designed for modern Windows applications
- Inspired by the need for a lightweight, modern text editor
Made with β€οΈ for Windows users who appreciate clean, functional design.

