A lightweight, browser-based markdown viewer with CommonMark support and dark mode.
- CommonMark Compliant: Full support for CommonMark markdown syntax
- Dark Mode: Toggle between light and dark themes with persistent preferences
- Drag & Drop: Simply drag markdown files onto the page to view them
- No Dependencies: Pure JavaScript implementation, no external libraries required
- Responsive Design: Clean, modern interface that works on all screen sizes
- Syntax Support:
- Headers (H1-H6)
- Bold, italic, strikethrough text
- Code blocks with language hints
- Tables
- Lists (ordered and unordered)
- Blockquotes
- Horizontal rules
- Links and images
- Clone the repository or download the
index.html
file - Open
index.html
in any modern web browser - No build process or dependencies required!
- Open a file: Click "Choose File" or drag and drop a markdown file anywhere on the page
- Toggle theme: Click the moon/sun icon to switch between light and dark modes
- Supported formats:
.md
,.markdown
, or.txt
files
Works with all modern browsers that support:
- ES6 JavaScript
- CSS Grid/Flexbox
- Local Storage API
Tested on:
- Chrome 90+
- Firefox 88+
- Safari 14+
- Edge 90+
Since this is a single HTML file with embedded CSS and JavaScript, you can:
-
Open directly in a browser:
open index.html
-
Or serve with any static server:
python -m http.server 8000 # Then navigate to http://localhost:8000
The viewer is built as a single-page application with:
- Embedded CSS: Includes both light and dark theme styles
- MarkdownParser class: Custom CommonMark-compliant parser
- Theme persistence: Saves preferences to localStorage
- File handling: Supports both file input and drag-and-drop
MIT License - See LICENSE file for details
For issues, feature requests, or questions, please open an issue on GitHub.