@minjun0219/mdwire 0.1.10 → 0.1.11

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/README.md CHANGED
@@ -10,7 +10,7 @@ escaping rules, and its own length limit. Existing converters assume the input i
10
10
  well-formed CommonMark and target one channel at a time. Neither assumption holds for
11
11
  agent output.
12
12
 
13
- **Status: v0.1.10.** Normalizing, rendering, splitting and streaming work for six
13
+ **Status: v0.1.11.** Normalizing, rendering, splitting and streaming work for six
14
14
  targets — Telegram HTML, Slack `markdown_text`, GitHub comments (GFM), Notion pages, plain text,
15
15
  and HTML for the browser — from a Rust core, a CLI,
16
16
  an npm package (WASM), and a Go port. See `SPEC.md` for what is in v0.1 and what was
@@ -171,13 +171,13 @@ Every release also carries its own artifacts, if you would rather not go through
171
171
 
172
172
  ```sh
173
173
  # npm package (works under a bundler and in plain Node)
174
- npm install https://github.com/minjun0219/mdwire/releases/download/v0.1.10/mdwire-0.1.10.tgz
174
+ npm install https://github.com/minjun0219/mdwire/releases/download/v0.1.11/mdwire-0.1.11.tgz
175
175
 
176
176
  # CLI binary — pick your platform
177
- curl -L https://github.com/minjun0219/mdwire/releases/download/v0.1.10/mdwire-v0.1.10-aarch64-apple-darwin.tar.gz | tar xz # macOS, Apple silicon
178
- curl -L https://github.com/minjun0219/mdwire/releases/download/v0.1.10/mdwire-v0.1.10-x86_64-unknown-linux-gnu.tar.gz | tar xz # Linux x86_64 (glibc)
179
- curl -L https://github.com/minjun0219/mdwire/releases/download/v0.1.10/mdwire-v0.1.10-aarch64-unknown-linux-gnu.tar.gz | tar xz # Linux arm64 (glibc)
180
- curl -LO https://github.com/minjun0219/mdwire/releases/download/v0.1.10/mdwire-v0.1.10-x86_64-pc-windows-msvc.zip # Windows x86_64
177
+ curl -L https://github.com/minjun0219/mdwire/releases/download/v0.1.11/mdwire-v0.1.11-aarch64-apple-darwin.tar.gz | tar xz # macOS, Apple silicon
178
+ curl -L https://github.com/minjun0219/mdwire/releases/download/v0.1.11/mdwire-v0.1.11-x86_64-unknown-linux-gnu.tar.gz | tar xz # Linux x86_64 (glibc)
179
+ curl -L https://github.com/minjun0219/mdwire/releases/download/v0.1.11/mdwire-v0.1.11-aarch64-unknown-linux-gnu.tar.gz | tar xz # Linux arm64 (glibc)
180
+ curl -LO https://github.com/minjun0219/mdwire/releases/download/v0.1.11/mdwire-v0.1.11-x86_64-pc-windows-msvc.zip # Windows x86_64
181
181
  ```
182
182
 
183
183
  The release notes list a SHA-256 for every artifact — verify the download against it when installing by URL.
@@ -202,6 +202,20 @@ out := mdwire.RenderWith(input, mdwire.SlackMarkdown, mdwire.Options{})
202
202
  log.Printf("%+v", out.Repairs)
203
203
  ```
204
204
 
205
+ ## For coding agents
206
+
207
+ mdwire ships an [agent skill](skills/mdwire/SKILL.md) that tells a coding agent when to reach for it,
208
+ which channel and entry point to pick, and how to stream. It follows the Agent Skills format, so agents
209
+ that read `SKILL.md` can use it directly. In Claude Code it installs as a plugin:
210
+
211
+ ```sh
212
+ /plugin marketplace add minjun0219/mdwire
213
+ /plugin install mdwire@mdwire
214
+ ```
215
+
216
+ The site also serves [`llms.txt`](https://mdwire.minjun.dev/llms.txt), and its pages register a WebMCP
217
+ tool, `mdwire_render`, so a browser agent on the site can run mdwire in the page.
218
+
205
219
  ## Building
206
220
 
207
221
  ```sh
@@ -1,17 +1,17 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
 
4
- /** 변환 옵션. 생략하면 채널의 기본값이다. */
4
+ /** Conversion options. Anything omitted uses the channel's default. */
5
5
  export interface RenderOptions {
6
- /** 조각 한도(글자 수). 생략하면 채널의 한도다 — plain 을 텔레그램에 보내면 4096. 스트리밍은 나누지 않는다. */
6
+ /** Part size limit (in characters). Defaults to the channel's limit; for example, 4096 when sending plain to Telegram. Streaming does not split. */
7
7
  limit?: number;
8
- /** 브라우저 채널("html")의 정책. 기본값이 가장 보수적이다. */
8
+ /** Policy for the browser channel ("html"). The defaults are the most conservative. */
9
9
  html?: {
10
- /** 블록 안 줄바꿈. "br"(기본) 은 `<br>`, "space" 는 브라우저가 공백으로 접게 둔다. */
10
+ /** Line breaks inside a block. "br" (default) emits `<br>`; "space" lets the browser collapse them into spaces. */
11
11
  lineBreaks?: "br" | "space";
12
- /** 이미지. "link"(기본) 는 누르기 전에 아무것도 안 불러온다, "load" 는 `<img>`. */
12
+ /** Images. "link" (default) loads nothing until clicked; "load" emits `<img>`. */
13
13
  images?: "link" | "load";
14
- /** 링크·이미지 주소로 받는 스킴(콜론 없이). 주면 그것만 받는다. 기본 ["http","https","mailto"]. */
14
+ /** Schemes allowed in link and image URLs (without the colon). If given, only these are allowed. Default ["http","https","mailto"]. */
15
15
  schemes?: string[];
16
16
  };
17
17
  }
@@ -19,133 +19,136 @@ export interface RenderOptions {
19
19
 
20
20
 
21
21
  /**
22
- * `renderWithReport` 의 결과.
22
+ * The result of `renderWithReport`.
23
23
  */
24
24
  export class Rendered {
25
25
  private constructor();
26
26
  free(): void;
27
27
  [Symbol.dispose](): void;
28
28
  /**
29
- * 조각들. 한도를 넘지 않았으면 하나다.
29
+ * The parts. Just one if the text fit within the limit.
30
30
  */
31
31
  readonly parts: string[];
32
32
  /**
33
- * 정규화가 고친 것.
33
+ * What normalization repaired.
34
34
  */
35
35
  readonly repairs: Repairs;
36
36
  }
37
37
 
38
38
  /**
39
- * 정규화가 고친 것과 채널에 맞춰 바꾼 것의 개수.
39
+ * Counts of what normalization repaired and what was changed to fit the channel.
40
40
  */
41
41
  export class Repairs {
42
42
  private constructor();
43
43
  free(): void;
44
44
  [Symbol.dispose](): void;
45
45
  /**
46
- * 블록이 끝나도록 안 닫혀서 닫아 준 강조.
46
+ * Emphasis left open at the end of a block, closed for you.
47
47
  */
48
48
  closedEmphasis: number;
49
49
  /**
50
- * 문서 끝까지 안 닫혀서 닫아 준 코드펜스.
50
+ * Code fences left open at the end of the document, closed for you.
51
51
  */
52
52
  closedFence: number;
53
53
  /**
54
- * 다른 표기로 바꿔 쓴 강조 마커와 `<url|텍스트>` 링크.
54
+ * Emphasis markers and `<url|text>` links rewritten in a different notation.
55
55
  */
56
56
  convertedMarker: number;
57
57
  /**
58
- * 짝 잃은 채 버린 `**`.
58
+ * Unmatched `**` markers that were dropped.
59
59
  */
60
60
  droppedMarker: number;
61
61
  /**
62
- * 채널이 구문으로 읽을 글자를 이스케이프한 수(GitHub 의 `\~`·`\<`·`\*`).
62
+ * Characters escaped because the channel would read them as syntax (GitHub's `\~`, `\<`, `\*`).
63
63
  */
64
64
  escapedChar: number;
65
65
  /**
66
- * 짝이 없어 글자로 되돌린 백틱 런.
66
+ * Unmatched backtick runs, turned back into literal text.
67
67
  */
68
68
  revertedCodeSpan: number;
69
69
  /**
70
- * 다른 기호로 바꿔 쓴 목록 불릿.
70
+ * List bullets rewritten with a different symbol.
71
71
  */
72
72
  rewrittenBullet: number;
73
73
  /**
74
- * 원문과 다른 모양으로 다시 쓴 표.
74
+ * Tables rewritten in a different shape from the source.
75
75
  */
76
76
  rewrittenTable: number;
77
77
  /**
78
- * 벗긴 원문 HTML(태그·주석·줄바꿈으로 바꾼 `<br>`).
78
+ * Raw HTML stripped from the source (tags, comments, and `<br>` turned into line breaks).
79
79
  */
80
80
  strippedHtml: number;
81
81
  /**
82
- * 채널이 마커로 못 읽는 자리라 다르게 낸 강조(GitHub 의 `<strong>`, 슬랙의 U+2060).
82
+ * Emphasis emitted differently because the channel would not read the marker in that position (GitHub's `<strong>`, Slack's U+2060).
83
83
  */
84
84
  tagEmphasis: number;
85
85
  }
86
86
 
87
87
  /**
88
- * 스트리밍 변환기.
88
+ * Streaming converter.
89
89
  *
90
- * 조각을 넣으면 지금 안전하게 내보낼 수 있는 만큼만 돌려준다. 경계에 걸린 마크업은
91
- * 안에 남는다 — 토큰이 흘러들어오는 대로 화면에 붙이는 쪽이 이것 때문에 쓴다.
90
+ * Push a chunk and it returns only what is safe to emit now. Markup cut off at the
91
+ * chunk boundary stays inside. This is what you want when appending tokens to the
92
+ * screen as they arrive.
92
93
  */
93
94
  export class Streamer {
94
95
  free(): void;
95
96
  [Symbol.dispose](): void;
96
97
  /**
97
- * **지금까지 받은 것을 그대로 보내려면 이걸 뒤에 붙인다.**
98
+ * **To send what you have received so far as is, append this after it.**
98
99
  *
99
- * 상태는 건드리지 않으므로 붙인 뒤에도 스트리밍은 이어진다. 누적본 자체에는
100
- * 넣지 말고, 보내기 직전에만 붙인다. 토큰이 오는 대로 메시지를 편집하는 쪽이 쓴다.
100
+ * It does not touch the state, so streaming continues afterwards. Do not add it
101
+ * to the accumulated output itself; append it only right before sending. Use it
102
+ * when editing a message as tokens arrive.
101
103
  *
102
104
  * ```js
103
105
  * acc += s.push(chunk);
104
- * await edit(acc + s.closeOpen()); // 누적본은 그대로 둔다
106
+ * await edit(acc + s.closeOpen()); // leave acc unchanged
105
107
  * ```
106
108
  */
107
109
  closeOpen(): string;
108
110
  /**
109
- * 입력이 끝났다. 남은 것을 내보내고 열린 마크업을 닫는다.
111
+ * Input has ended. Emits what is left and closes open markup.
110
112
  */
111
113
  finish(): string;
112
114
  constructor(channel: string, options?: RenderOptions | null);
113
115
  /**
114
- * **지금 입력이 끝났다면 확정분 뒤에 붙을 꼬리.** `closeOpen` 과 같은 자리에 들어가지만
115
- * 붙들고 있던 것(열린 강조, 표 행, 코드 스팬)까지 그린다. 누적본을 통째로 다시 그리는 쪽의
116
- * 기본값이다. 추측이라 뒤 조각이 모양을 바꿀 수 있다 — 끝난 뒤 `revised()` 로 본다.
116
+ * **The tail that would follow the final output if input ended now.** It goes in the
117
+ * same place as `closeOpen`, but also draws what is being held back (open emphasis,
118
+ * table rows, code spans). This is the default when you redraw the whole message.
119
+ * It is a guess, so later chunks may change the shape. Check `revised()` after the end.
117
120
  *
118
121
  * ```js
119
122
  * acc += s.push(chunk);
120
- * await edit(acc + s.preview()); // 화면을 그릴 때만 부른다(열린 블록만큼 든다)
123
+ * await edit(acc + s.preview()); // call only when drawing (costs as much as the open block)
121
124
  * acc += s.finish();
122
- * if (s.revised()) await edit(acc); // 마지막 화면이 곧 완성본이면 건너뛴다
125
+ * if (s.revised()) await edit(acc); // skip if the last screen already is the final output
123
126
  * ```
124
127
  */
125
128
  preview(): string;
126
129
  push(chunk: string): string;
127
130
  /**
128
- * 지금까지 정규화가 고친 것. `finish` 뒤에 보면 문서 전체의 값이다.
131
+ * What normalization has repaired so far. After `finish`, this covers the whole document.
129
132
  */
130
133
  repairs(): Repairs;
131
134
  /**
132
- * 완성본이 마지막 `preview()` 와 다른가 — `finish` 뒤에 본다.
135
+ * Whether the final output differs from the last `preview()`. Check it after `finish`.
133
136
  */
134
137
  revised(): boolean;
135
138
  }
136
139
 
137
140
  /**
138
- * 채널의 길이 한도(문자 수). 조각을 직접 다루려는 호출자를 위해 열어 둔다.
141
+ * The channel's length limit (in characters). Exposed for callers that handle parts themselves.
139
142
  */
140
143
  export function limit(channel: string): number;
141
144
 
142
145
  /**
143
- * 완성된 문서를 변환한다. 한도를 넘으면 조각 배열로 돌아온다.
146
+ * Converts a complete document. Returns an array of parts; it has more than one when the text exceeds the limit.
144
147
  */
145
148
  export function render(input: string, channel: string, options?: RenderOptions | null): string[];
146
149
 
147
150
  /**
148
- * [`render`] 에 **정규화가 고친 것**을 같이 돌려준다. 모델이 얼마나 자주 서식을 깨는지
149
- * 로그로 남기려는 쪽이 쓴다.
151
+ * Like [`render`], but also returns **what normalization repaired**. Use it to log
152
+ * how often the model breaks formatting.
150
153
  */
151
154
  export function renderWithReport(input: string, channel: string, options?: RenderOptions | null): Rendered;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `renderWithReport` 의 결과.
2
+ * The result of `renderWithReport`.
3
3
  */
4
4
  export class Rendered {
5
5
  static __wrap(ptr) {
@@ -19,7 +19,7 @@ export class Rendered {
19
19
  wasm.__wbg_rendered_free(ptr, 0);
20
20
  }
21
21
  /**
22
- * 조각들. 한도를 넘지 않았으면 하나다.
22
+ * The parts. Just one if the text fit within the limit.
23
23
  * @returns {string[]}
24
24
  */
25
25
  get parts() {
@@ -36,7 +36,7 @@ export class Rendered {
36
36
  }
37
37
  }
38
38
  /**
39
- * 정규화가 고친 것.
39
+ * What normalization repaired.
40
40
  * @returns {Repairs}
41
41
  */
42
42
  get repairs() {
@@ -47,7 +47,7 @@ export class Rendered {
47
47
  if (Symbol.dispose) Rendered.prototype[Symbol.dispose] = Rendered.prototype.free;
48
48
 
49
49
  /**
50
- * 정규화가 고친 것과 채널에 맞춰 바꾼 것의 개수.
50
+ * Counts of what normalization repaired and what was changed to fit the channel.
51
51
  */
52
52
  export class Repairs {
53
53
  static __wrap(ptr) {
@@ -67,7 +67,7 @@ export class Repairs {
67
67
  wasm.__wbg_repairs_free(ptr, 0);
68
68
  }
69
69
  /**
70
- * 블록이 끝나도록 안 닫혀서 닫아 준 강조.
70
+ * Emphasis left open at the end of a block, closed for you.
71
71
  * @returns {number}
72
72
  */
73
73
  get closedEmphasis() {
@@ -75,7 +75,7 @@ export class Repairs {
75
75
  return ret >>> 0;
76
76
  }
77
77
  /**
78
- * 문서 끝까지 안 닫혀서 닫아 준 코드펜스.
78
+ * Code fences left open at the end of the document, closed for you.
79
79
  * @returns {number}
80
80
  */
81
81
  get closedFence() {
@@ -83,7 +83,7 @@ export class Repairs {
83
83
  return ret >>> 0;
84
84
  }
85
85
  /**
86
- * 다른 표기로 바꿔 쓴 강조 마커와 `<url|텍스트>` 링크.
86
+ * Emphasis markers and `<url|text>` links rewritten in a different notation.
87
87
  * @returns {number}
88
88
  */
89
89
  get convertedMarker() {
@@ -91,7 +91,7 @@ export class Repairs {
91
91
  return ret >>> 0;
92
92
  }
93
93
  /**
94
- * 짝 잃은 채 버린 `**`.
94
+ * Unmatched `**` markers that were dropped.
95
95
  * @returns {number}
96
96
  */
97
97
  get droppedMarker() {
@@ -99,7 +99,7 @@ export class Repairs {
99
99
  return ret >>> 0;
100
100
  }
101
101
  /**
102
- * 채널이 구문으로 읽을 글자를 이스케이프한 수(GitHub 의 `\~`·`\<`·`\*`).
102
+ * Characters escaped because the channel would read them as syntax (GitHub's `\~`, `\<`, `\*`).
103
103
  * @returns {number}
104
104
  */
105
105
  get escapedChar() {
@@ -107,7 +107,7 @@ export class Repairs {
107
107
  return ret >>> 0;
108
108
  }
109
109
  /**
110
- * 짝이 없어 글자로 되돌린 백틱 런.
110
+ * Unmatched backtick runs, turned back into literal text.
111
111
  * @returns {number}
112
112
  */
113
113
  get revertedCodeSpan() {
@@ -115,7 +115,7 @@ export class Repairs {
115
115
  return ret >>> 0;
116
116
  }
117
117
  /**
118
- * 다른 기호로 바꿔 쓴 목록 불릿.
118
+ * List bullets rewritten with a different symbol.
119
119
  * @returns {number}
120
120
  */
121
121
  get rewrittenBullet() {
@@ -123,7 +123,7 @@ export class Repairs {
123
123
  return ret >>> 0;
124
124
  }
125
125
  /**
126
- * 원문과 다른 모양으로 다시 쓴 표.
126
+ * Tables rewritten in a different shape from the source.
127
127
  * @returns {number}
128
128
  */
129
129
  get rewrittenTable() {
@@ -131,7 +131,7 @@ export class Repairs {
131
131
  return ret >>> 0;
132
132
  }
133
133
  /**
134
- * 벗긴 원문 HTML(태그·주석·줄바꿈으로 바꾼 `<br>`).
134
+ * Raw HTML stripped from the source (tags, comments, and `<br>` turned into line breaks).
135
135
  * @returns {number}
136
136
  */
137
137
  get strippedHtml() {
@@ -139,7 +139,7 @@ export class Repairs {
139
139
  return ret >>> 0;
140
140
  }
141
141
  /**
142
- * 채널이 마커로 못 읽는 자리라 다르게 낸 강조(GitHub 의 `<strong>`, 슬랙의 U+2060).
142
+ * Emphasis emitted differently because the channel would not read the marker in that position (GitHub's `<strong>`, Slack's U+2060).
143
143
  * @returns {number}
144
144
  */
145
145
  get tagEmphasis() {
@@ -147,70 +147,70 @@ export class Repairs {
147
147
  return ret >>> 0;
148
148
  }
149
149
  /**
150
- * 블록이 끝나도록 안 닫혀서 닫아 준 강조.
150
+ * Emphasis left open at the end of a block, closed for you.
151
151
  * @param {number} arg0
152
152
  */
153
153
  set closedEmphasis(arg0) {
154
154
  wasm.__wbg_set_repairs_closedEmphasis(this.__wbg_ptr, arg0);
155
155
  }
156
156
  /**
157
- * 문서 끝까지 안 닫혀서 닫아 준 코드펜스.
157
+ * Code fences left open at the end of the document, closed for you.
158
158
  * @param {number} arg0
159
159
  */
160
160
  set closedFence(arg0) {
161
161
  wasm.__wbg_set_repairs_closedFence(this.__wbg_ptr, arg0);
162
162
  }
163
163
  /**
164
- * 다른 표기로 바꿔 쓴 강조 마커와 `<url|텍스트>` 링크.
164
+ * Emphasis markers and `<url|text>` links rewritten in a different notation.
165
165
  * @param {number} arg0
166
166
  */
167
167
  set convertedMarker(arg0) {
168
168
  wasm.__wbg_set_repairs_convertedMarker(this.__wbg_ptr, arg0);
169
169
  }
170
170
  /**
171
- * 짝 잃은 채 버린 `**`.
171
+ * Unmatched `**` markers that were dropped.
172
172
  * @param {number} arg0
173
173
  */
174
174
  set droppedMarker(arg0) {
175
175
  wasm.__wbg_set_repairs_droppedMarker(this.__wbg_ptr, arg0);
176
176
  }
177
177
  /**
178
- * 채널이 구문으로 읽을 글자를 이스케이프한 수(GitHub 의 `\~`·`\<`·`\*`).
178
+ * Characters escaped because the channel would read them as syntax (GitHub's `\~`, `\<`, `\*`).
179
179
  * @param {number} arg0
180
180
  */
181
181
  set escapedChar(arg0) {
182
182
  wasm.__wbg_set_repairs_escapedChar(this.__wbg_ptr, arg0);
183
183
  }
184
184
  /**
185
- * 짝이 없어 글자로 되돌린 백틱 런.
185
+ * Unmatched backtick runs, turned back into literal text.
186
186
  * @param {number} arg0
187
187
  */
188
188
  set revertedCodeSpan(arg0) {
189
189
  wasm.__wbg_set_repairs_revertedCodeSpan(this.__wbg_ptr, arg0);
190
190
  }
191
191
  /**
192
- * 다른 기호로 바꿔 쓴 목록 불릿.
192
+ * List bullets rewritten with a different symbol.
193
193
  * @param {number} arg0
194
194
  */
195
195
  set rewrittenBullet(arg0) {
196
196
  wasm.__wbg_set_repairs_rewrittenBullet(this.__wbg_ptr, arg0);
197
197
  }
198
198
  /**
199
- * 원문과 다른 모양으로 다시 쓴 표.
199
+ * Tables rewritten in a different shape from the source.
200
200
  * @param {number} arg0
201
201
  */
202
202
  set rewrittenTable(arg0) {
203
203
  wasm.__wbg_set_repairs_rewrittenTable(this.__wbg_ptr, arg0);
204
204
  }
205
205
  /**
206
- * 벗긴 원문 HTML(태그·주석·줄바꿈으로 바꾼 `<br>`).
206
+ * Raw HTML stripped from the source (tags, comments, and `<br>` turned into line breaks).
207
207
  * @param {number} arg0
208
208
  */
209
209
  set strippedHtml(arg0) {
210
210
  wasm.__wbg_set_repairs_strippedHtml(this.__wbg_ptr, arg0);
211
211
  }
212
212
  /**
213
- * 채널이 마커로 못 읽는 자리라 다르게 낸 강조(GitHub 의 `<strong>`, 슬랙의 U+2060).
213
+ * Emphasis emitted differently because the channel would not read the marker in that position (GitHub's `<strong>`, Slack's U+2060).
214
214
  * @param {number} arg0
215
215
  */
216
216
  set tagEmphasis(arg0) {
@@ -220,10 +220,11 @@ export class Repairs {
220
220
  if (Symbol.dispose) Repairs.prototype[Symbol.dispose] = Repairs.prototype.free;
221
221
 
222
222
  /**
223
- * 스트리밍 변환기.
223
+ * Streaming converter.
224
224
  *
225
- * 조각을 넣으면 지금 안전하게 내보낼 수 있는 만큼만 돌려준다. 경계에 걸린 마크업은
226
- * 안에 남는다 — 토큰이 흘러들어오는 대로 화면에 붙이는 쪽이 이것 때문에 쓴다.
225
+ * Push a chunk and it returns only what is safe to emit now. Markup cut off at the
226
+ * chunk boundary stays inside. This is what you want when appending tokens to the
227
+ * screen as they arrive.
227
228
  */
228
229
  export class Streamer {
229
230
  __destroy_into_raw() {
@@ -237,14 +238,15 @@ export class Streamer {
237
238
  wasm.__wbg_streamer_free(ptr, 0);
238
239
  }
239
240
  /**
240
- * **지금까지 받은 것을 그대로 보내려면 이걸 뒤에 붙인다.**
241
+ * **To send what you have received so far as is, append this after it.**
241
242
  *
242
- * 상태는 건드리지 않으므로 붙인 뒤에도 스트리밍은 이어진다. 누적본 자체에는
243
- * 넣지 말고, 보내기 직전에만 붙인다. 토큰이 오는 대로 메시지를 편집하는 쪽이 쓴다.
243
+ * It does not touch the state, so streaming continues afterwards. Do not add it
244
+ * to the accumulated output itself; append it only right before sending. Use it
245
+ * when editing a message as tokens arrive.
244
246
  *
245
247
  * ```js
246
248
  * acc += s.push(chunk);
247
- * await edit(acc + s.closeOpen()); // 누적본은 그대로 둔다
249
+ * await edit(acc + s.closeOpen()); // leave acc unchanged
248
250
  * ```
249
251
  * @returns {string}
250
252
  */
@@ -265,7 +267,7 @@ export class Streamer {
265
267
  }
266
268
  }
267
269
  /**
268
- * 입력이 끝났다. 남은 것을 내보내고 열린 마크업을 닫는다.
270
+ * Input has ended. Emits what is left and closes open markup.
269
271
  * @returns {string}
270
272
  */
271
273
  finish() {
@@ -308,15 +310,16 @@ export class Streamer {
308
310
  }
309
311
  }
310
312
  /**
311
- * **지금 입력이 끝났다면 확정분 뒤에 붙을 꼬리.** `closeOpen` 과 같은 자리에 들어가지만
312
- * 붙들고 있던 것(열린 강조, 표 행, 코드 스팬)까지 그린다. 누적본을 통째로 다시 그리는 쪽의
313
- * 기본값이다. 추측이라 뒤 조각이 모양을 바꿀 수 있다 — 끝난 뒤 `revised()` 로 본다.
313
+ * **The tail that would follow the final output if input ended now.** It goes in the
314
+ * same place as `closeOpen`, but also draws what is being held back (open emphasis,
315
+ * table rows, code spans). This is the default when you redraw the whole message.
316
+ * It is a guess, so later chunks may change the shape. Check `revised()` after the end.
314
317
  *
315
318
  * ```js
316
319
  * acc += s.push(chunk);
317
- * await edit(acc + s.preview()); // 화면을 그릴 때만 부른다(열린 블록만큼 든다)
320
+ * await edit(acc + s.preview()); // call only when drawing (costs as much as the open block)
318
321
  * acc += s.finish();
319
- * if (s.revised()) await edit(acc); // 마지막 화면이 곧 완성본이면 건너뛴다
322
+ * if (s.revised()) await edit(acc); // skip if the last screen already is the final output
320
323
  * ```
321
324
  * @returns {string}
322
325
  */
@@ -359,7 +362,7 @@ export class Streamer {
359
362
  }
360
363
  }
361
364
  /**
362
- * 지금까지 정규화가 고친 것. `finish` 뒤에 보면 문서 전체의 값이다.
365
+ * What normalization has repaired so far. After `finish`, this covers the whole document.
363
366
  * @returns {Repairs}
364
367
  */
365
368
  repairs() {
@@ -367,7 +370,7 @@ export class Streamer {
367
370
  return Repairs.__wrap(ret);
368
371
  }
369
372
  /**
370
- * 완성본이 마지막 `preview()` 와 다른가 — `finish` 뒤에 본다.
373
+ * Whether the final output differs from the last `preview()`. Check it after `finish`.
371
374
  * @returns {boolean}
372
375
  */
373
376
  revised() {
@@ -378,7 +381,7 @@ export class Streamer {
378
381
  if (Symbol.dispose) Streamer.prototype[Symbol.dispose] = Streamer.prototype.free;
379
382
 
380
383
  /**
381
- * 채널의 길이 한도(문자 수). 조각을 직접 다루려는 호출자를 위해 열어 둔다.
384
+ * The channel's length limit (in characters). Exposed for callers that handle parts themselves.
382
385
  * @param {string} channel
383
386
  * @returns {number}
384
387
  */
@@ -401,7 +404,7 @@ export function limit(channel) {
401
404
  }
402
405
 
403
406
  /**
404
- * 완성된 문서를 변환한다. 한도를 넘으면 조각 배열로 돌아온다.
407
+ * Converts a complete document. Returns an array of parts; it has more than one when the text exceeds the limit.
405
408
  * @param {string} input
406
409
  * @param {string} channel
407
410
  * @param {RenderOptions | null} [options]
@@ -431,8 +434,8 @@ export function render(input, channel, options) {
431
434
  }
432
435
 
433
436
  /**
434
- * [`render`] 에 **정규화가 고친 것**을 같이 돌려준다. 모델이 얼마나 자주 서식을 깨는지
435
- * 로그로 남기려는 쪽이 쓴다.
437
+ * Like [`render`], but also returns **what normalization repaired**. Use it to log
438
+ * how often the model breaks formatting.
436
439
  * @param {string} input
437
440
  * @param {string} channel
438
441
  * @param {RenderOptions | null} [options]
@@ -472,30 +475,30 @@ export function __wbg___wbindgen_string_get_92ab86bb19cbc12f(arg0, arg1) {
472
475
  export function __wbg___wbindgen_throw_5d9e815e6fdf150f(arg0, arg1) {
473
476
  throw new Error(getStringFromWasm0(arg0, arg1));
474
477
  }
475
- export function __wbg_html_0aa47f0cff3bfe93(arg0) {
478
+ export function __wbg_html_89b49615556b2850(arg0) {
476
479
  const ret = getObject(arg0).html;
477
480
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
478
481
  }
479
- export function __wbg_images_7df1f16cee267678(arg0, arg1) {
482
+ export function __wbg_images_fc88426d1f55bdfc(arg0, arg1) {
480
483
  const ret = getObject(arg1).images;
481
484
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
482
485
  var len1 = WASM_VECTOR_LEN;
483
486
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
484
487
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
485
488
  }
486
- export function __wbg_limit_7811a23349eec87f(arg0, arg1) {
489
+ export function __wbg_limit_d1453e73fbf788db(arg0, arg1) {
487
490
  const ret = getObject(arg1).limit;
488
491
  getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
489
492
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
490
493
  }
491
- export function __wbg_lineBreaks_1d80ff3d107b92c9(arg0, arg1) {
494
+ export function __wbg_lineBreaks_8b98689e9716a2c8(arg0, arg1) {
492
495
  const ret = getObject(arg1).lineBreaks;
493
496
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
494
497
  var len1 = WASM_VECTOR_LEN;
495
498
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
496
499
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
497
500
  }
498
- export function __wbg_schemes_aa169c7c8566f577(arg0, arg1) {
501
+ export function __wbg_schemes_8e39175723a07726(arg0, arg1) {
499
502
  const ret = getObject(arg1).schemes;
500
503
  var ptr1 = isLikeNone(ret) ? 0 : passArrayJsValueToWasm0(ret, wasm.__wbindgen_export);
501
504
  var len1 = WASM_VECTOR_LEN;
Binary file
package/js/events.d.ts CHANGED
@@ -1,20 +1,20 @@
1
- /** mdwire html 출력에 나오는 태그. */
1
+ /** Tags that appear in mdwire's html output. */
2
2
  export type MdTag =
3
3
  | "p" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "ul" | "ol" | "li" | "blockquote" | "pre" | "code"
4
4
  | "strong" | "em" | "del" | "a" | "table" | "thead" | "tbody" | "tr" | "th" | "td" | "hr" | "br"
5
5
  | "sub" | "sup" | "b" | "i" | "u" | "s" | "strike" | "span" | "small" | "mark" | "kbd" | "ins" | "img";
6
6
 
7
7
  /**
8
- * 이벤트 하나. 속성은 코어가 내는 것만 담긴다 —
9
- * `a` 의 `href`, `code` 의 `class`(`language-…`), `th`·`td` 의 `style`(`text-align:…`), `ol` 의 `start`.
8
+ * A single event. Attributes hold only what the core emits:
9
+ * `href` on `a`, `class` on `code` (`language-…`), `style` on `th` and `td` (`text-align:…`), `start` on `ol`.
10
10
  */
11
11
  export type MdEvent =
12
12
  | { type: "open"; tag: MdTag; attrs: Record<string, string> }
13
13
  | { type: "close"; tag: MdTag }
14
14
  | { type: "void"; tag: "br" | "hr" }
15
- /** 이미지는 `html.images: "load"` 일 때만 나온다. `src`·`alt` 를 담는다. */
15
+ /** Images appear only with `html.images: "load"`. Holds `src` and `alt`. */
16
16
  | { type: "void"; tag: "img"; attrs: Record<string, string> }
17
17
  | { type: "text"; text: string };
18
18
 
19
- /** html 채널 출력(또는 스트리밍 누적본 + `closeOpen()`)을 이벤트 배열로 푼다. */
19
+ /** Parses html channel output (or the accumulated stream output + `closeOpen()`) into an array of events. */
20
20
  export function toEvents(html: string): MdEvent[];
package/js/events.js CHANGED
@@ -18,8 +18,8 @@ const ENTITIES = { amp: "&", lt: "<", gt: ">", quot: '"' };
18
18
  const decode = (s) => s.replace(/&(amp|lt|gt|quot);/g, (_, n) => ENTITIES[n]);
19
19
 
20
20
  /**
21
- * html 채널 출력을 이벤트 배열로 바꾼다.
22
- * @param {string} html `render(text, "html")` 의 결과, 또는 스트리밍 누적본 + `closeOpen()`.
21
+ * Converts html channel output into an array of events.
22
+ * @param {string} html The result of `render(text, "html")`, or the accumulated stream output + `closeOpen()`.
23
23
  * @returns {import("./events.d.ts").MdEvent[]}
24
24
  */
25
25
  export function toEvents(html) {