Markdown Editor & Preview

Write Markdown with live preview - free and open source

Markdown
Words: 0
Chars: 0
Lines: 0
Preview Live Preview

Saved Documents

No saved documents yet. Start writing and save your first document!

Markdown Quick Reference

# H1 Heading 1
## H2 Heading 2
**bold** Bold text
*italic* Italic text
~~strike~~ Strikethrough
[text](url) Link
![alt](url) Image
`code` Inline code
```lang Code block
> quote Blockquote
- item Unordered list
1. item Ordered list
- [ ] task Task list
--- Horizontal rule
| a | b | Table
`; const blob = new Blob([htmlContent], { type: 'text/html' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = 'document.html'; a.click(); URL.revokeObjectURL(url); } function copyToClipboard() { navigator.clipboard.writeText(preview.innerHTML).then(() => { alert('HTML copied to clipboard!'); }); } // Event listeners input.addEventListener('input', updatePreview); input.addEventListener('keydown', (e) => { if (e.key === 'Tab') { e.preventDefault(); const start = input.selectionStart; input.value = input.value.substring(0, start) + ' ' + input.value.substring(input.selectionEnd); input.selectionStart = input.selectionEnd = start + 4; updatePreview(); } }); document.getElementById('docName').addEventListener('keydown', (e) => { if (e.key === 'Enter') { saveDocument(); } }); // Initialize renderDocList(); updatePreview();