|
| 1 | +English | [한국어](README.ko.md) |
| 2 | + |
| 3 | +# Markdown → HTML Converter |
| 4 | + |
| 5 | +Write in markdown and get HTML where **every style is baked inline** (`style="..."`), so it looks the same **wherever you paste it**. |
| 6 | + |
| 7 | +Many blogs and CMSs ignore external CSS and classes, so plain HTML often breaks on paste — line spacing, headings, and code blocks fall apart. This tool writes styles directly onto every element (paragraphs, headings, code blocks, tables, and more), so it stays intact the moment you paste it into an editor. |
| 8 | + |
| 9 | +> **Where you can use it** — Tistory, Naver Blog, WordPress, Notion, HTML email, and anywhere else that **accepts HTML input (paste)**. |
| 10 | +
|
| 11 | +## Features |
| 12 | + |
| 13 | +- **Live preview** — renders instantly on the right, exactly as it will look when pasted |
| 14 | +- **Automatic inline styles** — fixed line spacing, heading sizes, and margins to neutralize external CSS |
| 15 | +- **Rich-text copy** — `Copy HTML` puts the formatted result on your clipboard, so you can paste it straight into most editors in normal mode (the HTML source is included too, for `HTML`-mode editors) |
| 16 | +- **Syntax highlighting** — highlight.js colors are inlined so they survive wherever you paste |
| 17 | +- **Tables / blockquotes / lists / images** (GFM) |
| 18 | +- **Callout boxes** — `> [!NOTE]`, `> [!TIP]`, `> [!WARNING]`, etc. become colored highlight boxes |
| 19 | +- **Diagrams (mermaid)** — ` ```mermaid ` blocks are converted to inline SVG and embedded directly |
| 20 | +- **HTML source tab** — inspect and copy the generated HTML directly |
| 21 | +- **Dark / light background preview** — toggle to check how it looks on a dark background |
| 22 | +- **Scroll sync** — the preview follows the editor as you scroll (handy for long posts) |
| 23 | +- **Character / word counter** — shows the length of your draft in real time |
| 24 | +- **HTML size indicator** — shows the actual size of the output and warns when it gets large (some blogs cap length) |
| 25 | +- **Export to HTML file** — save the result as a standalone `.html` file |
| 26 | +- **Keyboard shortcuts** — with `Ctrl/Cmd`: `S` copy · `O` open file · `B` bold · `I` italic |
| 27 | +- **Tab indentation** — `Tab` indents, `Shift+Tab` outdents; with a multi-line selection it indents every line at once (great for nested lists) |
| 28 | +- **Open files** — load `.md` / `.markdown` / `.txt` via button or **drag & drop** |
| 29 | +- **Korean / English UI** — switch language with the button in the header (choice is saved) |
| 30 | +- **Auto-save draft** — your draft is saved in the browser (localStorage) and survives reloads (and the preview never stops even if saving fails) |
| 31 | + |
| 32 | +## How to use |
| 33 | + |
| 34 | +1. Open `index.html` in a browser. (No install or server needed.) |
| 35 | +2. Write markdown in the left pane. |
| 36 | +3. Watch the right pane render exactly how it will look when pasted. |
| 37 | +4. Click **`Copy HTML`**. |
| 38 | +5. **Paste it straight into your editor** — the formatting comes with it. |
| 39 | + |
| 40 | +> **It copies as rich text** — most editors (Tistory, Naver Blog, Notion, etc.) keep the formatting when you paste in normal mode. For editors that use an `HTML` mode, the same copy also carries the HTML source, so pasting there works too. |
| 41 | +> |
| 42 | +> If copying doesn't work (some browsers restrict the clipboard on `file://`), open the `HTML Source` tab and copy manually, or run it via the **local server** option below. |
| 43 | +
|
| 44 | +## Running locally |
| 45 | + |
| 46 | +No server or build step required. Just keep `index.html`, `styles.css`, and the `js/` folder **together**. Pick whichever option fits. |
| 47 | + |
| 48 | +### Option 1. Open the file directly (simplest) |
| 49 | + |
| 50 | +Double-click `index.html` or drag it into a browser. (CSS and JS load via plain `<link>`/`<script>`, so double-clicking via `file://` works fine.) |
| 51 | + |
| 52 | +```bash |
| 53 | +# Clone the repo |
| 54 | +git clone https://github.com/zooo-code/md2paste.git |
| 55 | +cd md2paste |
| 56 | + |
| 57 | +# Open in a browser |
| 58 | +open index.html # macOS |
| 59 | +start index.html # Windows |
| 60 | +xdg-open index.html # Linux |
| 61 | +``` |
| 62 | + |
| 63 | +### Option 2. Serve locally (recommended) |
| 64 | + |
| 65 | +Some browsers restrict **clipboard copy** when a page is opened via `file://`. In that case a small local server works reliably. (Pick one based on what you have installed.) |
| 66 | + |
| 67 | +```bash |
| 68 | +# Python (built into most OSes) |
| 69 | +python -m http.server 8000 |
| 70 | + |
| 71 | +# Node.js |
| 72 | +npx serve |
| 73 | + |
| 74 | +# VS Code |
| 75 | +# Right-click index.html → "Open with Live Server" |
| 76 | +``` |
| 77 | + |
| 78 | +Then visit `http://localhost:8000`. |
| 79 | + |
| 80 | +> An internet connection is required, since the markdown parser (marked), code highlighter (highlight.js), and diagram renderer (mermaid) are loaded from a CDN. |
| 81 | +
|
| 82 | +## Built with |
| 83 | + |
| 84 | +- **[marked](https://marked.js.org/)** — markdown → HTML parser |
| 85 | +- **[highlight.js](https://highlightjs.org/)** — code syntax highlighting |
| 86 | +- **[mermaid](https://mermaid.js.org/)** — text-based diagrams → SVG rendering |
| 87 | + |
| 88 | +There is no build step; the libraries above are loaded from a CDN. |
| 89 | + |
| 90 | +## Structure |
| 91 | + |
| 92 | +The JavaScript is split by responsibility into `js/` (plain classic scripts loaded in order, so double-click via `file://` keeps working): |
| 93 | + |
| 94 | +``` |
| 95 | +md2paste/ |
| 96 | +├── index.html # page structure (HTML) |
| 97 | +├── styles.css # app UI styles (CSS) |
| 98 | +└── js/ |
| 99 | + ├── i18n.js # translations, samples, language state |
| 100 | + ├── theme.js # inline style tables baked into the output |
| 101 | + ├── convert.js # markdown → inline-styled HTML |
| 102 | + ├── diagram.js # mermaid → inline SVG (cached) |
| 103 | + ├── storage.js # draft auto-save |
| 104 | + ├── ui.js # DOM refs, indicators, tabs, scroll sync |
| 105 | + ├── editor.js # shortcuts, file I/O, copy, export |
| 106 | + └── app.js # render pipeline, wiring, init |
| 107 | +``` |
| 108 | + |
| 109 | +## Supported markdown |
| 110 | + |
| 111 | +| Syntax | Example | |
| 112 | +|--------|---------| |
| 113 | +| Headings | `# H1` ~ `###### H6` | |
| 114 | +| Emphasis | `**bold**`, `*italic*`, `~~strikethrough~~` | |
| 115 | +| Inline code | `` `code` `` | |
| 116 | +| Code block | ` ```python ... ``` ` | |
| 117 | +| List | `- item`, `1. item` | |
| 118 | +| Checklist | `- [ ] todo`, `- [x] done` | |
| 119 | +| Blockquote | `> quote` | |
| 120 | +| Callout | `> [!NOTE]`, `> [!TIP]`, `> [!IMPORTANT]`, `> [!WARNING]`, `> [!CAUTION]` | |
| 121 | +| Table | `\| Item \| Description \|` | |
| 122 | +| Link / Image | `[text](url)`, `` | |
| 123 | +| Diagram | ` ```mermaid ... ``` ` | |
| 124 | +| Divider | `---` | |
| 125 | + |
| 126 | +> **Note on mermaid diagrams** — diagrams are converted to inline SVG and embedded in the document. They show up correctly in most environments, but some blog HTML editors may filter or alter SVG on paste, so results can vary. For maximum safety, capture the diagram from the preview as an image and upload it manually. |
| 127 | +
|
| 128 | +## License |
| 129 | + |
| 130 | +[MIT License](LICENSE) — free to use, modify, and distribute. |
0 commit comments