A lightweight, browser-based Markdown previewer with live GitHub‑flavored Markdown rendering, syntax highlighting, themes, and export tools — all in a single static HTML file.
This repository hosts the GitHub Pages site for the
markdown-previewer organization.
Live app: https://markdown-previewer.github.io/
-
Live preview
- Edit Markdown on the left, see rendered HTML on the right in real time.
-
GitHub‑flavored Markdown (GFM)
- Tables
- Task lists (
- [x],- [ ]) - Fenced code blocks (
jsetc.) - Blockquotes, lists, headings, links, images, etc.
-
Syntax highlighting
- Powered by
highlight.js - Language-aware highlighting when you specify the language after the backticks:
```js console.log("Hello, world!");
- Powered by
-
Dark / Light theme
- Toggle button in the toolbar
- Remembers your choice using
localStorage - Respects system preference on first load
-
File operations
- Open local
.md,.markdown, or.txtfiles - Save current content as
.md(download) - Autosave: current text is stored in
localStorageso you don’t lose work if you refresh
- Open local
-
Export
- Export HTML: download the rendered HTML as a standalone file
- Export PDF: uses the browser’s Print → Save as PDF functionality, with print-friendly styles
-
Zero build tooling
- Plain HTML + CSS + JavaScript
- Uses CDN-hosted libraries:
markedfor Markdown → HTMLDOMPurifyfor safe HTML sanitizationhighlight.jsfor code highlighting
The app is deployed via GitHub Pages:
Open the link in any modern browser and start typing Markdown.
You can run this app locally without any build tools.
-
Clone the repo:
git clone https://github.com/markdown-previewer/markdown-previewer.github.io.git cd markdown-previewer.github.io -
Open
index.htmlin your browser:- Double-click
index.html, or - In your browser: File → Open File… and select
index.html
- Double-click
Everything runs purely client-side.
If you prefer to run via http://localhost:
# Using Python 3
python -m http.server 8000
# then open: http://localhost:8000/You can use these examples directly in the previewer.
# Heading 1
## Heading 2
### Heading 3
#### Heading 4*Italic text* or _Italic text_
**Bold text** or __Bold text__
***Bold and italic*** or ___Bold and italic___Unordered list:
- Item 1
- Item 2
- Nested item 2.1
- Nested item 2.2Ordered list:
1. First item
2. Second item
3. Third item[Link text](https://example.com)
Inline code:
Use the `code` syntax for inline code.Code block:
```js
function hello(name) {
console.log(`Hello, ${name}!`);
}
### Blockquotes
```markdown
> This is a blockquote.
> It can span multiple lines.
| Column A | Column B | Column C |
|---------:|:--------:|---------|
| right | center | left |
| 1 | 2 | 3 |- [x] Completed task
- [ ] Incomplete task
- [ ] Another itemPaste any of the above into the left pane to see how the previewer renders it.
This repository is intentionally minimal:
markdown-previewer.github.io/
└── index.html # All HTML, CSS, and JS in a single file
- All logic is embedded in
index.html. - No bundlers, no frameworks, no build step.
- External libraries are loaded from CDNs.
If you’d like to customize the app:
-
Styling
- Update the CSS inside the
<style>block inindex.html. - Color variables live under
:rootand[data-theme="dark"].
- Update the CSS inside the
-
Default content
- Change the initial Markdown text in the
initContent()function in the JS section.
- Change the initial Markdown text in the
-
Behavior / Features
- The main behavior (rendering, theme toggle, file operations, exports) is implemented in inline
<script>tags at the bottom ofindex.html. - You can:
- Add buttons in the toolbar
- Change how exports work
- Swap highlight.js themes by changing the CSS link for
highlight.jsin the<head>.
- The main behavior (rendering, theme toggle, file operations, exports) is implemented in inline
Contributions and suggestions are welcome.
- Fork this repository.
- Create a feature branch:
git checkout -b feature/my-improvement
- Make your changes and commit:
git commit -m "Add my improvement" - Push the branch:
git push origin feature/my-improvement
- Open a Pull Request against
mainon this repo.
Please include:
- A brief description of the change
- Any UI screenshots, if applicable
- Steps to test your changes
This project is licensed under the GNU General Public License v3.0 (GPL-3.0).
You may redistribute and/or modify this software under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose. See the
GNU General Public License for more details.
See the LICENSE file in this repository for the full text of the GPLv3 license.
If you encounter a bug, have a feature request, or want to discuss ideas:
- Open an issue in this repository:
https://github.com/markdown-previewer/markdown-previewer.github.io/issues
Happy writing in Markdown!