@rhwp/core 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-2026 Edward Kim
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,69 @@
1
+ # rhwp
2
+
3
+ **알(R), 모두의 한글** — HWP/HWPX 파일 파서 & 렌더러 (Rust + WebAssembly)
4
+
5
+ [![npm](https://img.shields.io/npm/v/@rhwp/core)](https://www.npmjs.com/package/@rhwp/core)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ ## 설치
9
+
10
+ ```bash
11
+ npm install @rhwp/core
12
+ ```
13
+
14
+ ## 사용법
15
+
16
+ ```javascript
17
+ import init, { HwpDocument } from '@rhwp/core';
18
+
19
+ // WASM 초기화
20
+ await init();
21
+
22
+ // HWP 파일 로드
23
+ const response = await fetch('document.hwp');
24
+ const buffer = new Uint8Array(await response.arrayBuffer());
25
+ const doc = HwpDocument.load(buffer, 'document.hwp');
26
+
27
+ // 문서 정보
28
+ console.log(doc.pageCount);
29
+
30
+ // SVG 렌더링
31
+ const svg = doc.renderPageToSvg(0); // 첫 번째 페이지
32
+ document.getElementById('viewer').innerHTML = svg;
33
+ ```
34
+
35
+ ## Canvas 렌더링
36
+
37
+ ```javascript
38
+ import init, { HwpDocument } from '@rhwp/core';
39
+
40
+ await init();
41
+ const doc = HwpDocument.load(buffer, 'document.hwp');
42
+
43
+ // Canvas에 렌더링
44
+ const canvas = document.getElementById('canvas');
45
+ const ctx = canvas.getContext('2d');
46
+ doc.renderPageToCanvas(0, ctx, canvas.width, canvas.height);
47
+ ```
48
+
49
+ ## 기능
50
+
51
+ - **HWP 5.0** (바이너리) + **HWPX** (XML) 파싱
52
+ - 문단, 표, 수식, 이미지, 차트 렌더링
53
+ - 페이지네이션 (다단, 표 분할)
54
+ - SVG / Canvas 출력
55
+ - 머리말/꼬리말/바탕쪽/각주
56
+
57
+ ## 링크
58
+
59
+ - [온라인 데모](https://edwardkim.github.io/rhwp/)
60
+ - [GitHub](https://github.com/edwardkim/rhwp)
61
+ - [VS Code 확장](https://marketplace.visualstudio.com/items?itemName=edwardkim.rhwp-vscode)
62
+
63
+ ## Notice
64
+
65
+ 본 제품은 한글과컴퓨터의 한글 문서 파일(.hwp) 공개 문서를 참고하여 개발하였습니다.
66
+
67
+ ## License
68
+
69
+ MIT
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@rhwp/core",
3
+ "version": "0.6.0",
4
+ "description": "HWP/HWPX file parser and renderer — Rust + WebAssembly",
5
+ "type": "module",
6
+ "main": "rhwp.js",
7
+ "types": "rhwp.d.ts",
8
+ "files": [
9
+ "rhwp_bg.wasm",
10
+ "rhwp.js",
11
+ "rhwp.d.ts",
12
+ "rhwp_bg.wasm.d.ts"
13
+ ],
14
+ "keywords": [
15
+ "hwp",
16
+ "hwpx",
17
+ "hancom",
18
+ "hangul",
19
+ "한글",
20
+ "document",
21
+ "parser",
22
+ "renderer",
23
+ "wasm",
24
+ "webassembly",
25
+ "rust"
26
+ ],
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "https://github.com/edwardkim/rhwp"
30
+ },
31
+ "homepage": "https://edwardkim.github.io/rhwp/",
32
+ "bugs": {
33
+ "url": "https://github.com/edwardkim/rhwp/issues"
34
+ },
35
+ "license": "MIT",
36
+ "author": "Edward Kim",
37
+ "sideEffects": [
38
+ "./snippets/*"
39
+ ]
40
+ }