|
| 1 | +# dc-code-paste |
| 2 | + |
| 3 | +디씨인사이드 글쓰기 화면에 붙여넣을 리치 텍스트 HTML을 만드는 정적 웹 도구. |
| 4 | +프로그래밍 강의 글처럼 설명, 팁상자, 참고 링크, 코드블록이 섞인 글을 편집한 뒤 |
| 5 | +복사해서 붙여넣는 흐름을 목표로 한다. |
| 6 | + |
| 7 | +## Stack |
| 8 | + |
| 9 | +- SvelteKit 2 + Svelte 5 |
| 10 | +- Tiptap / ProseMirror |
| 11 | +- Shiki |
| 12 | +- TypeScript with `tsgo` |
| 13 | +- Oxlint + Oxfmt |
| 14 | +- Bun |
| 15 | +- GitHub Pages |
| 16 | + |
| 17 | +## Local Setup |
| 18 | + |
| 19 | +```sh |
| 20 | +bun install |
| 21 | +bun run check |
| 22 | +bun run typecheck:go |
| 23 | +bun run lint |
| 24 | +bun run format:check |
| 25 | +bun run test |
| 26 | +bun run build |
| 27 | +``` |
| 28 | + |
| 29 | +## GitHub Pages |
| 30 | + |
| 31 | +The app is built with `@sveltejs/adapter-static`. |
| 32 | + |
| 33 | +`BASE_PATH=/dc-code-paste` is set in `.github/workflows/pages.yml` so the deployed app works at: |
| 34 | + |
| 35 | +```txt |
| 36 | +https://0disoft.github.io/dc-code-paste/ |
| 37 | +``` |
| 38 | + |
| 39 | +## Paste Contract |
| 40 | + |
| 41 | +The app keeps an editor document model internally, then exports inline-style HTML for rich-text |
| 42 | +paste targets: |
| 43 | + |
| 44 | +- Paste structure: `DC 테이블` uses table wrappers with `bgcolor` fallbacks for stricter DCInside |
| 45 | + paste surfaces; `기본` keeps a lighter `div` wrapper for ordinary rich-text paste targets |
| 46 | +- Article canvas: root wrapper with an inline light background, padding, font, and text color so |
| 47 | + prose stays readable when pasted into DCInside dark mode |
| 48 | +- Prose blocks: paragraph, heading, list, quote, divider |
| 49 | +- Design blocks: `tipBox`, `warningBox`, `referenceBox`, `emphasisBox`, `linkBox` |
| 50 | +- Code blocks: Tiptap `codeBlock` rendered through Shiki on demand |
| 51 | + |
| 52 | +```html |
| 53 | +<table width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#fbfaf2" style="..."> |
| 54 | + <tbody> |
| 55 | + <tr> |
| 56 | + <td style="..."> |
| 57 | + <p style="...">...</p> |
| 58 | + <table |
| 59 | + width="100%" |
| 60 | + cellpadding="0" |
| 61 | + cellspacing="0" |
| 62 | + border="0" |
| 63 | + bgcolor="#e6fbe4" |
| 64 | + style="..." |
| 65 | + > |
| 66 | + <tbody> |
| 67 | + <tr> |
| 68 | + <td style="...">...</td> |
| 69 | + </tr> |
| 70 | + </tbody> |
| 71 | + </table> |
| 72 | + </td> |
| 73 | + </tr> |
| 74 | + </tbody> |
| 75 | +</table> |
| 76 | +``` |
| 77 | + |
| 78 | +`기본` structure keeps the same content contract with simpler block wrappers: |
| 79 | + |
| 80 | +```html |
| 81 | +<div style="..."> |
| 82 | + <p style="...">...</p> |
| 83 | + <div style="...">...</div> |
| 84 | + <pre style="..."><code><span style="color:oklch(...)">...</span></code></pre> |
| 85 | +</div> |
| 86 | +``` |
| 87 | + |
| 88 | +`디씨 복사` writes both `text/html` and `text/plain` for rich paste targets. The preview panel can |
| 89 | +also switch to `HTML` mode, where `원문 복사` copies the exported inline HTML as plain text for |
| 90 | +editors that expect raw HTML source. |
| 91 | + |
| 92 | +Older `calloutBox` documents with a `kind` attribute are still accepted by the exporter, but new |
| 93 | +editor content uses the explicit box node names above. |
| 94 | + |
| 95 | +## Manual DC Paste Check |
| 96 | + |
| 97 | +Before treating a release as ready, check both paste paths in a browser: |
| 98 | + |
| 99 | +1. Start with the default sample article, which already includes a paragraph, heading, tip box, |
| 100 | + warning box, reference box, link box, quote, lists, divider, and code block. |
| 101 | +2. Click `디씨 복사`, paste into the normal DCInside editor, and confirm the rendered style survives. |
| 102 | +3. Switch the preview panel to `HTML`, click `원문 복사`, paste into DCInside's HTML mode, and confirm |
| 103 | + the same article renders after leaving HTML mode. |
| 104 | +4. Confirm code colors, box spacing, links, and body font size match the preview closely enough. |
0 commit comments