@minjun0219/mdwire 0.1.8 → 0.1.9
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 +20 -14
- package/bundler/mdwire.d.ts +25 -1
- package/bundler/mdwire_bg.js +97 -7
- package/bundler/mdwire_bg.wasm +0 -0
- package/bundler/mdwire_bg.wasm.d.ts +12 -0
- package/js/events.d.ts +1 -1
- package/js/events.js +1 -1
- package/node/mdwire.d.ts +25 -1
- package/node/mdwire.js +97 -7
- package/node/mdwire_bg.wasm +0 -0
- package/node/mdwire_bg.wasm.d.ts +12 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -3,15 +3,16 @@
|
|
|
3
3
|
English | [한국어](README.ko.md)
|
|
4
4
|
|
|
5
5
|
Send LLM-generated Markdown to chat channels without it breaking.
|
|
6
|
+
Docs, API reference and a live demo: [mdwire.minjun.dev](https://mdwire.minjun.dev).
|
|
6
7
|
|
|
7
8
|
Agents emit Markdown. Chat channels don't accept it — each has its own subset, its own
|
|
8
9
|
escaping rules, and its own length limit. Existing converters assume the input is
|
|
9
10
|
well-formed CommonMark and target one channel at a time. Neither assumption holds for
|
|
10
11
|
agent output.
|
|
11
12
|
|
|
12
|
-
**Status: v0.1.
|
|
13
|
-
targets — Telegram HTML, Slack `markdown_text`, GitHub comments (GFM), plain text,
|
|
14
|
-
the browser — from a Rust core, a CLI,
|
|
13
|
+
**Status: v0.1.9.** Normalizing, rendering, splitting and streaming work for six
|
|
14
|
+
targets — Telegram HTML, Slack `markdown_text`, GitHub comments (GFM), Notion pages, plain text,
|
|
15
|
+
and HTML for the browser — from a Rust core, a CLI,
|
|
15
16
|
an npm package (WASM), and a Go port. See `SPEC.md` for what is in v0.1 and what was
|
|
16
17
|
deliberately deferred. `SPEC.md` and `DESIGN.md` are written in Korean.
|
|
17
18
|
|
|
@@ -27,7 +28,9 @@ LLM markdown → normalize → render for channel → split safely → s
|
|
|
27
28
|
tags; Slack `markdown_text` takes standard Markdown directly. GitHub takes it too, but
|
|
28
29
|
reads a lone `~` as strikethrough and `<T>` as an HTML tag — so a `~` or `<` meant as a
|
|
29
30
|
character goes out escaped (`\~`, `\<`), and emphasis GFM would not close — `**(a)**`
|
|
30
|
-
followed directly by a Korean particle — goes out as `<strong>`.
|
|
31
|
+
followed directly by a Korean particle — goes out as `<strong>`. Notion draws that bold as is
|
|
32
|
+
but shows inline HTML as text, so `notion-markdown` strips the tags and escapes a literal `*`
|
|
33
|
+
or `\` instead. For the browser, `html` draws
|
|
31
34
|
blocks as tags too and is safe to set as `innerHTML`: text is escaped, inline tags from the
|
|
32
35
|
source keep no attributes, and only `http(s)`/`mailto` links become `<a>` — line breaks,
|
|
33
36
|
images and allowed schemes are options. While streaming,
|
|
@@ -37,9 +40,11 @@ LLM markdown → normalize → render for channel → split safely → s
|
|
|
37
40
|
|
|
38
41
|
Two options around that pipeline. **Input dialect:** an agent that learned Slack from its
|
|
39
42
|
docs writes legacy `mrkdwn` (`*bold*`, `~strike~`, `<url|text>`); `--from slack-mrkdwn`
|
|
40
|
-
reads it as such instead of as standard Markdown. **
|
|
43
|
+
reads it as such instead of as standard Markdown. **Change report:** how many times the
|
|
41
44
|
normalizer stepped in — unclosed emphasis, unclosed fence, unpaired backticks, dropped
|
|
42
|
-
markers —
|
|
45
|
+
markers — and what it rewrote for the channel — escaped characters, tags for emphasis,
|
|
46
|
+
stripped HTML, bullets, tables, converted markers — so you can log how often the model
|
|
47
|
+
breaks its own formatting and see what a channel changes before you adopt it.
|
|
43
48
|
|
|
44
49
|
## Use it
|
|
45
50
|
|
|
@@ -49,7 +54,8 @@ cat agent-output.md | mdwire --channel slack-markdown --stream # emit as it arri
|
|
|
49
54
|
cat agent-output.md | mdwire --channel plain --limit 4096 # plain fallback into Telegram
|
|
50
55
|
|
|
51
56
|
# The agent wrote Slack's legacy mrkdwn (*bold*, ~strike~)? Say so. --report prints what
|
|
52
|
-
# the normalizer fixed (unclosed emphasis,
|
|
57
|
+
# the normalizer fixed and rewrote (unclosed emphasis, escaped `~`, stripped tags, …) as one
|
|
58
|
+
# JSON line on stderr.
|
|
53
59
|
cat agent-output.md | mdwire --channel slack-markdown --from slack-mrkdwn --report
|
|
54
60
|
```
|
|
55
61
|
|
|
@@ -111,8 +117,8 @@ mdwire in front of Streamdown, and mdwire side by side. Measured numbers are in
|
|
|
111
117
|
and `finish` only appends the tail. So the pieces concatenated equal a one-shot `render`,
|
|
112
118
|
whatever the chunk size (unless the document is long enough to be split into parts).
|
|
113
119
|
This is tested on the corpus, by fuzzing, and by `mdwire-check --scan <dir>`, which streams
|
|
114
|
-
every file one character and 64 characters at a time and reports any divergence.
|
|
115
|
-
|
|
120
|
+
every file one character and 64 characters at a time and reports any divergence. See
|
|
121
|
+
`SPEC.md` §8.2.
|
|
116
122
|
|
|
117
123
|
The streamer holds back only what it must: a prefix it cannot classify yet, a marker run
|
|
118
124
|
at the end of a chunk, and the inside of an emphasis that has not closed. Paragraphs are
|
|
@@ -158,11 +164,11 @@ Every release also carries its own artifacts, if you would rather not go through
|
|
|
158
164
|
|
|
159
165
|
```sh
|
|
160
166
|
# npm package (works under a bundler and in plain Node)
|
|
161
|
-
npm install https://github.com/minjun0219/mdwire/releases/download/v0.1.
|
|
167
|
+
npm install https://github.com/minjun0219/mdwire/releases/download/v0.1.9/mdwire-0.1.9.tgz
|
|
162
168
|
|
|
163
169
|
# CLI binary — macOS (Apple silicon) or Linux (x86_64)
|
|
164
|
-
curl -L https://github.com/minjun0219/mdwire/releases/download/v0.1.
|
|
165
|
-
curl -L https://github.com/minjun0219/mdwire/releases/download/v0.1.
|
|
170
|
+
curl -L https://github.com/minjun0219/mdwire/releases/download/v0.1.9/mdwire-v0.1.9-aarch64-apple-darwin.tar.gz | tar xz
|
|
171
|
+
curl -L https://github.com/minjun0219/mdwire/releases/download/v0.1.9/mdwire-v0.1.9-x86_64-unknown-linux-gnu.tar.gz | tar xz
|
|
166
172
|
```
|
|
167
173
|
|
|
168
174
|
The release notes list a SHA-256 for every artifact — pin to it when installing by URL.
|
|
@@ -217,8 +223,8 @@ mdwire-check --scan ./some-directory-of-markdown # invariants only, no expecte
|
|
|
217
223
|
|
|
218
224
|
## Releasing
|
|
219
225
|
|
|
220
|
-
Nobody edits the version by hand.
|
|
221
|
-
`release: X.Y.Z` pull request open; merging it tags `vX.Y.Z` and `go/vX.Y.Z` and publishes
|
|
226
|
+
Nobody edits the version by hand. When a merge to `main` changes what ships (the core, CLI,
|
|
227
|
+
WASM or Go sources, manifests, npm packaging), a bot keeps a `release: X.Y.Z` pull request open; merging it tags `vX.Y.Z` and `go/vX.Y.Z` and publishes
|
|
222
228
|
the release with its artifacts. See `AGENTS.md`.
|
|
223
229
|
|
|
224
230
|
## License
|
package/bundler/mdwire.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export class Rendered {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
|
-
* 정규화가 고친 것의 개수.
|
|
41
|
+
* 정규화가 고친 것과 채널에 맞춰 바꾼 것의 개수.
|
|
42
42
|
*/
|
|
43
43
|
export class Repairs {
|
|
44
44
|
private constructor();
|
|
@@ -52,14 +52,38 @@ export class Repairs {
|
|
|
52
52
|
* 문서 끝까지 안 닫혀서 닫아 준 코드펜스.
|
|
53
53
|
*/
|
|
54
54
|
closedFence: number;
|
|
55
|
+
/**
|
|
56
|
+
* 다른 표기로 바꿔 쓴 강조 마커와 `<url|텍스트>` 링크.
|
|
57
|
+
*/
|
|
58
|
+
convertedMarker: number;
|
|
55
59
|
/**
|
|
56
60
|
* 짝 잃은 채 버린 `**`.
|
|
57
61
|
*/
|
|
58
62
|
droppedMarker: number;
|
|
63
|
+
/**
|
|
64
|
+
* 채널이 구문으로 읽을 글자를 탈출한 수(GitHub 의 `\~`·`\<`·`\*`).
|
|
65
|
+
*/
|
|
66
|
+
escapedChar: number;
|
|
59
67
|
/**
|
|
60
68
|
* 짝이 없어 글자로 되돌린 백틱 런.
|
|
61
69
|
*/
|
|
62
70
|
revertedCodeSpan: number;
|
|
71
|
+
/**
|
|
72
|
+
* 다른 기호로 바꿔 쓴 목록 불릿.
|
|
73
|
+
*/
|
|
74
|
+
rewrittenBullet: number;
|
|
75
|
+
/**
|
|
76
|
+
* 원문과 다른 모양으로 다시 쓴 표.
|
|
77
|
+
*/
|
|
78
|
+
rewrittenTable: number;
|
|
79
|
+
/**
|
|
80
|
+
* 벗긴 원문 HTML(태그·주석·줄바꿈으로 바꾼 `<br>`).
|
|
81
|
+
*/
|
|
82
|
+
strippedHtml: number;
|
|
83
|
+
/**
|
|
84
|
+
* 마커 대신 태그로 낸 강조(GitHub 의 `<strong>`).
|
|
85
|
+
*/
|
|
86
|
+
tagEmphasis: number;
|
|
63
87
|
}
|
|
64
88
|
|
|
65
89
|
/**
|
package/bundler/mdwire_bg.js
CHANGED
|
@@ -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
|
+
* 정규화가 고친 것과 채널에 맞춰 바꾼 것의 개수.
|
|
51
51
|
*/
|
|
52
52
|
export class Repairs {
|
|
53
53
|
static __wrap(ptr) {
|
|
@@ -82,6 +82,14 @@ export class Repairs {
|
|
|
82
82
|
const ret = wasm.__wbg_get_repairs_closedFence(this.__wbg_ptr);
|
|
83
83
|
return ret >>> 0;
|
|
84
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* 다른 표기로 바꿔 쓴 강조 마커와 `<url|텍스트>` 링크.
|
|
87
|
+
* @returns {number}
|
|
88
|
+
*/
|
|
89
|
+
get convertedMarker() {
|
|
90
|
+
const ret = wasm.__wbg_get_repairs_convertedMarker(this.__wbg_ptr);
|
|
91
|
+
return ret >>> 0;
|
|
92
|
+
}
|
|
85
93
|
/**
|
|
86
94
|
* 짝 잃은 채 버린 `**`.
|
|
87
95
|
* @returns {number}
|
|
@@ -90,6 +98,14 @@ export class Repairs {
|
|
|
90
98
|
const ret = wasm.__wbg_get_repairs_droppedMarker(this.__wbg_ptr);
|
|
91
99
|
return ret >>> 0;
|
|
92
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* 채널이 구문으로 읽을 글자를 탈출한 수(GitHub 의 `\~`·`\<`·`\*`).
|
|
103
|
+
* @returns {number}
|
|
104
|
+
*/
|
|
105
|
+
get escapedChar() {
|
|
106
|
+
const ret = wasm.__wbg_get_repairs_escapedChar(this.__wbg_ptr);
|
|
107
|
+
return ret >>> 0;
|
|
108
|
+
}
|
|
93
109
|
/**
|
|
94
110
|
* 짝이 없어 글자로 되돌린 백틱 런.
|
|
95
111
|
* @returns {number}
|
|
@@ -98,6 +114,38 @@ export class Repairs {
|
|
|
98
114
|
const ret = wasm.__wbg_get_repairs_revertedCodeSpan(this.__wbg_ptr);
|
|
99
115
|
return ret >>> 0;
|
|
100
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* 다른 기호로 바꿔 쓴 목록 불릿.
|
|
119
|
+
* @returns {number}
|
|
120
|
+
*/
|
|
121
|
+
get rewrittenBullet() {
|
|
122
|
+
const ret = wasm.__wbg_get_repairs_rewrittenBullet(this.__wbg_ptr);
|
|
123
|
+
return ret >>> 0;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* 원문과 다른 모양으로 다시 쓴 표.
|
|
127
|
+
* @returns {number}
|
|
128
|
+
*/
|
|
129
|
+
get rewrittenTable() {
|
|
130
|
+
const ret = wasm.__wbg_get_repairs_rewrittenTable(this.__wbg_ptr);
|
|
131
|
+
return ret >>> 0;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* 벗긴 원문 HTML(태그·주석·줄바꿈으로 바꾼 `<br>`).
|
|
135
|
+
* @returns {number}
|
|
136
|
+
*/
|
|
137
|
+
get strippedHtml() {
|
|
138
|
+
const ret = wasm.__wbg_get_repairs_strippedHtml(this.__wbg_ptr);
|
|
139
|
+
return ret >>> 0;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* 마커 대신 태그로 낸 강조(GitHub 의 `<strong>`).
|
|
143
|
+
* @returns {number}
|
|
144
|
+
*/
|
|
145
|
+
get tagEmphasis() {
|
|
146
|
+
const ret = wasm.__wbg_get_repairs_tagEmphasis(this.__wbg_ptr);
|
|
147
|
+
return ret >>> 0;
|
|
148
|
+
}
|
|
101
149
|
/**
|
|
102
150
|
* 블록이 끝나도록 안 닫혀서 닫아 준 강조.
|
|
103
151
|
* @param {number} arg0
|
|
@@ -112,6 +160,13 @@ export class Repairs {
|
|
|
112
160
|
set closedFence(arg0) {
|
|
113
161
|
wasm.__wbg_set_repairs_closedFence(this.__wbg_ptr, arg0);
|
|
114
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* 다른 표기로 바꿔 쓴 강조 마커와 `<url|텍스트>` 링크.
|
|
165
|
+
* @param {number} arg0
|
|
166
|
+
*/
|
|
167
|
+
set convertedMarker(arg0) {
|
|
168
|
+
wasm.__wbg_set_repairs_convertedMarker(this.__wbg_ptr, arg0);
|
|
169
|
+
}
|
|
115
170
|
/**
|
|
116
171
|
* 짝 잃은 채 버린 `**`.
|
|
117
172
|
* @param {number} arg0
|
|
@@ -119,6 +174,13 @@ export class Repairs {
|
|
|
119
174
|
set droppedMarker(arg0) {
|
|
120
175
|
wasm.__wbg_set_repairs_droppedMarker(this.__wbg_ptr, arg0);
|
|
121
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* 채널이 구문으로 읽을 글자를 탈출한 수(GitHub 의 `\~`·`\<`·`\*`).
|
|
179
|
+
* @param {number} arg0
|
|
180
|
+
*/
|
|
181
|
+
set escapedChar(arg0) {
|
|
182
|
+
wasm.__wbg_set_repairs_escapedChar(this.__wbg_ptr, arg0);
|
|
183
|
+
}
|
|
122
184
|
/**
|
|
123
185
|
* 짝이 없어 글자로 되돌린 백틱 런.
|
|
124
186
|
* @param {number} arg0
|
|
@@ -126,6 +188,34 @@ export class Repairs {
|
|
|
126
188
|
set revertedCodeSpan(arg0) {
|
|
127
189
|
wasm.__wbg_set_repairs_revertedCodeSpan(this.__wbg_ptr, arg0);
|
|
128
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* 다른 기호로 바꿔 쓴 목록 불릿.
|
|
193
|
+
* @param {number} arg0
|
|
194
|
+
*/
|
|
195
|
+
set rewrittenBullet(arg0) {
|
|
196
|
+
wasm.__wbg_set_repairs_rewrittenBullet(this.__wbg_ptr, arg0);
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* 원문과 다른 모양으로 다시 쓴 표.
|
|
200
|
+
* @param {number} arg0
|
|
201
|
+
*/
|
|
202
|
+
set rewrittenTable(arg0) {
|
|
203
|
+
wasm.__wbg_set_repairs_rewrittenTable(this.__wbg_ptr, arg0);
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* 벗긴 원문 HTML(태그·주석·줄바꿈으로 바꾼 `<br>`).
|
|
207
|
+
* @param {number} arg0
|
|
208
|
+
*/
|
|
209
|
+
set strippedHtml(arg0) {
|
|
210
|
+
wasm.__wbg_set_repairs_strippedHtml(this.__wbg_ptr, arg0);
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* 마커 대신 태그로 낸 강조(GitHub 의 `<strong>`).
|
|
214
|
+
* @param {number} arg0
|
|
215
|
+
*/
|
|
216
|
+
set tagEmphasis(arg0) {
|
|
217
|
+
wasm.__wbg_set_repairs_tagEmphasis(this.__wbg_ptr, arg0);
|
|
218
|
+
}
|
|
129
219
|
}
|
|
130
220
|
if (Symbol.dispose) Repairs.prototype[Symbol.dispose] = Repairs.prototype.free;
|
|
131
221
|
|
|
@@ -382,37 +472,37 @@ export function __wbg___wbindgen_string_get_92ab86bb19cbc12f(arg0, arg1) {
|
|
|
382
472
|
export function __wbg___wbindgen_throw_5d9e815e6fdf150f(arg0, arg1) {
|
|
383
473
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
384
474
|
}
|
|
385
|
-
export function
|
|
475
|
+
export function __wbg_from_6a18a824ab73bfc5(arg0, arg1) {
|
|
386
476
|
const ret = getObject(arg1).from;
|
|
387
477
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
388
478
|
var len1 = WASM_VECTOR_LEN;
|
|
389
479
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
390
480
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
391
481
|
}
|
|
392
|
-
export function
|
|
482
|
+
export function __wbg_html_a628fe022a5daeaf(arg0) {
|
|
393
483
|
const ret = getObject(arg0).html;
|
|
394
484
|
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
395
485
|
}
|
|
396
|
-
export function
|
|
486
|
+
export function __wbg_images_ff5cc833afad2dcf(arg0, arg1) {
|
|
397
487
|
const ret = getObject(arg1).images;
|
|
398
488
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
399
489
|
var len1 = WASM_VECTOR_LEN;
|
|
400
490
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
401
491
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
402
492
|
}
|
|
403
|
-
export function
|
|
493
|
+
export function __wbg_limit_cce570f9381001ea(arg0, arg1) {
|
|
404
494
|
const ret = getObject(arg1).limit;
|
|
405
495
|
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
406
496
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
407
497
|
}
|
|
408
|
-
export function
|
|
498
|
+
export function __wbg_lineBreaks_aa928a165d0a7659(arg0, arg1) {
|
|
409
499
|
const ret = getObject(arg1).lineBreaks;
|
|
410
500
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
411
501
|
var len1 = WASM_VECTOR_LEN;
|
|
412
502
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
413
503
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
414
504
|
}
|
|
415
|
-
export function
|
|
505
|
+
export function __wbg_schemes_429ccca2fff29ed9(arg0, arg1) {
|
|
416
506
|
const ret = getObject(arg1).schemes;
|
|
417
507
|
var ptr1 = isLikeNone(ret) ? 0 : passArrayJsValueToWasm0(ret, wasm.__wbindgen_export);
|
|
418
508
|
var len1 = WASM_VECTOR_LEN;
|
package/bundler/mdwire_bg.wasm
CHANGED
|
Binary file
|
|
@@ -3,14 +3,26 @@
|
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const __wbg_get_repairs_closedEmphasis: (a: number) => number;
|
|
5
5
|
export const __wbg_get_repairs_closedFence: (a: number) => number;
|
|
6
|
+
export const __wbg_get_repairs_convertedMarker: (a: number) => number;
|
|
6
7
|
export const __wbg_get_repairs_droppedMarker: (a: number) => number;
|
|
8
|
+
export const __wbg_get_repairs_escapedChar: (a: number) => number;
|
|
7
9
|
export const __wbg_get_repairs_revertedCodeSpan: (a: number) => number;
|
|
10
|
+
export const __wbg_get_repairs_rewrittenBullet: (a: number) => number;
|
|
11
|
+
export const __wbg_get_repairs_rewrittenTable: (a: number) => number;
|
|
12
|
+
export const __wbg_get_repairs_strippedHtml: (a: number) => number;
|
|
13
|
+
export const __wbg_get_repairs_tagEmphasis: (a: number) => number;
|
|
8
14
|
export const __wbg_rendered_free: (a: number, b: number) => void;
|
|
9
15
|
export const __wbg_repairs_free: (a: number, b: number) => void;
|
|
10
16
|
export const __wbg_set_repairs_closedEmphasis: (a: number, b: number) => void;
|
|
11
17
|
export const __wbg_set_repairs_closedFence: (a: number, b: number) => void;
|
|
18
|
+
export const __wbg_set_repairs_convertedMarker: (a: number, b: number) => void;
|
|
12
19
|
export const __wbg_set_repairs_droppedMarker: (a: number, b: number) => void;
|
|
20
|
+
export const __wbg_set_repairs_escapedChar: (a: number, b: number) => void;
|
|
13
21
|
export const __wbg_set_repairs_revertedCodeSpan: (a: number, b: number) => void;
|
|
22
|
+
export const __wbg_set_repairs_rewrittenBullet: (a: number, b: number) => void;
|
|
23
|
+
export const __wbg_set_repairs_rewrittenTable: (a: number, b: number) => void;
|
|
24
|
+
export const __wbg_set_repairs_strippedHtml: (a: number, b: number) => void;
|
|
25
|
+
export const __wbg_set_repairs_tagEmphasis: (a: number, b: number) => void;
|
|
14
26
|
export const __wbg_streamer_free: (a: number, b: number) => void;
|
|
15
27
|
export const limit: (a: number, b: number, c: number) => void;
|
|
16
28
|
export const render: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
package/js/events.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
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
|
-
| "sub" | "sup" | "b" | "i" | "u" | "s" | "strike" | "span" | "small" | "mark" | "kbd" | "img";
|
|
5
|
+
| "sub" | "sup" | "b" | "i" | "u" | "s" | "strike" | "span" | "small" | "mark" | "kbd" | "ins" | "img";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* 이벤트 하나. 속성은 코어가 내는 것만 담긴다 —
|
package/js/events.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
const TAGS = new Set([
|
|
9
9
|
"p", "h1", "h2", "h3", "h4", "h5", "h6", "ul", "ol", "li", "blockquote", "pre", "code",
|
|
10
10
|
"strong", "em", "del", "a", "table", "thead", "tbody", "tr", "th", "td", "hr", "br",
|
|
11
|
-
"sub", "sup", "b", "i", "u", "s", "strike", "span", "small", "mark", "kbd", "img",
|
|
11
|
+
"sub", "sup", "b", "i", "u", "s", "strike", "span", "small", "mark", "kbd", "ins", "img",
|
|
12
12
|
]);
|
|
13
13
|
const VOID = new Set(["br", "hr", "img"]);
|
|
14
14
|
/** 태그마다 읽는 속성. 코어가 내는 것만 — 나머지는 버린다. */
|
package/node/mdwire.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export class Rendered {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
|
-
* 정규화가 고친 것의 개수.
|
|
41
|
+
* 정규화가 고친 것과 채널에 맞춰 바꾼 것의 개수.
|
|
42
42
|
*/
|
|
43
43
|
export class Repairs {
|
|
44
44
|
private constructor();
|
|
@@ -52,14 +52,38 @@ export class Repairs {
|
|
|
52
52
|
* 문서 끝까지 안 닫혀서 닫아 준 코드펜스.
|
|
53
53
|
*/
|
|
54
54
|
closedFence: number;
|
|
55
|
+
/**
|
|
56
|
+
* 다른 표기로 바꿔 쓴 강조 마커와 `<url|텍스트>` 링크.
|
|
57
|
+
*/
|
|
58
|
+
convertedMarker: number;
|
|
55
59
|
/**
|
|
56
60
|
* 짝 잃은 채 버린 `**`.
|
|
57
61
|
*/
|
|
58
62
|
droppedMarker: number;
|
|
63
|
+
/**
|
|
64
|
+
* 채널이 구문으로 읽을 글자를 탈출한 수(GitHub 의 `\~`·`\<`·`\*`).
|
|
65
|
+
*/
|
|
66
|
+
escapedChar: number;
|
|
59
67
|
/**
|
|
60
68
|
* 짝이 없어 글자로 되돌린 백틱 런.
|
|
61
69
|
*/
|
|
62
70
|
revertedCodeSpan: number;
|
|
71
|
+
/**
|
|
72
|
+
* 다른 기호로 바꿔 쓴 목록 불릿.
|
|
73
|
+
*/
|
|
74
|
+
rewrittenBullet: number;
|
|
75
|
+
/**
|
|
76
|
+
* 원문과 다른 모양으로 다시 쓴 표.
|
|
77
|
+
*/
|
|
78
|
+
rewrittenTable: number;
|
|
79
|
+
/**
|
|
80
|
+
* 벗긴 원문 HTML(태그·주석·줄바꿈으로 바꾼 `<br>`).
|
|
81
|
+
*/
|
|
82
|
+
strippedHtml: number;
|
|
83
|
+
/**
|
|
84
|
+
* 마커 대신 태그로 낸 강조(GitHub 의 `<strong>`).
|
|
85
|
+
*/
|
|
86
|
+
tagEmphasis: number;
|
|
63
87
|
}
|
|
64
88
|
|
|
65
89
|
/**
|
package/node/mdwire.js
CHANGED
|
@@ -50,7 +50,7 @@ if (Symbol.dispose) Rendered.prototype[Symbol.dispose] = Rendered.prototype.free
|
|
|
50
50
|
exports.Rendered = Rendered;
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
|
-
* 정규화가 고친 것의 개수.
|
|
53
|
+
* 정규화가 고친 것과 채널에 맞춰 바꾼 것의 개수.
|
|
54
54
|
*/
|
|
55
55
|
class Repairs {
|
|
56
56
|
static __wrap(ptr) {
|
|
@@ -85,6 +85,14 @@ class Repairs {
|
|
|
85
85
|
const ret = wasm.__wbg_get_repairs_closedFence(this.__wbg_ptr);
|
|
86
86
|
return ret >>> 0;
|
|
87
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* 다른 표기로 바꿔 쓴 강조 마커와 `<url|텍스트>` 링크.
|
|
90
|
+
* @returns {number}
|
|
91
|
+
*/
|
|
92
|
+
get convertedMarker() {
|
|
93
|
+
const ret = wasm.__wbg_get_repairs_convertedMarker(this.__wbg_ptr);
|
|
94
|
+
return ret >>> 0;
|
|
95
|
+
}
|
|
88
96
|
/**
|
|
89
97
|
* 짝 잃은 채 버린 `**`.
|
|
90
98
|
* @returns {number}
|
|
@@ -93,6 +101,14 @@ class Repairs {
|
|
|
93
101
|
const ret = wasm.__wbg_get_repairs_droppedMarker(this.__wbg_ptr);
|
|
94
102
|
return ret >>> 0;
|
|
95
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* 채널이 구문으로 읽을 글자를 탈출한 수(GitHub 의 `\~`·`\<`·`\*`).
|
|
106
|
+
* @returns {number}
|
|
107
|
+
*/
|
|
108
|
+
get escapedChar() {
|
|
109
|
+
const ret = wasm.__wbg_get_repairs_escapedChar(this.__wbg_ptr);
|
|
110
|
+
return ret >>> 0;
|
|
111
|
+
}
|
|
96
112
|
/**
|
|
97
113
|
* 짝이 없어 글자로 되돌린 백틱 런.
|
|
98
114
|
* @returns {number}
|
|
@@ -101,6 +117,38 @@ class Repairs {
|
|
|
101
117
|
const ret = wasm.__wbg_get_repairs_revertedCodeSpan(this.__wbg_ptr);
|
|
102
118
|
return ret >>> 0;
|
|
103
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* 다른 기호로 바꿔 쓴 목록 불릿.
|
|
122
|
+
* @returns {number}
|
|
123
|
+
*/
|
|
124
|
+
get rewrittenBullet() {
|
|
125
|
+
const ret = wasm.__wbg_get_repairs_rewrittenBullet(this.__wbg_ptr);
|
|
126
|
+
return ret >>> 0;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* 원문과 다른 모양으로 다시 쓴 표.
|
|
130
|
+
* @returns {number}
|
|
131
|
+
*/
|
|
132
|
+
get rewrittenTable() {
|
|
133
|
+
const ret = wasm.__wbg_get_repairs_rewrittenTable(this.__wbg_ptr);
|
|
134
|
+
return ret >>> 0;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* 벗긴 원문 HTML(태그·주석·줄바꿈으로 바꾼 `<br>`).
|
|
138
|
+
* @returns {number}
|
|
139
|
+
*/
|
|
140
|
+
get strippedHtml() {
|
|
141
|
+
const ret = wasm.__wbg_get_repairs_strippedHtml(this.__wbg_ptr);
|
|
142
|
+
return ret >>> 0;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* 마커 대신 태그로 낸 강조(GitHub 의 `<strong>`).
|
|
146
|
+
* @returns {number}
|
|
147
|
+
*/
|
|
148
|
+
get tagEmphasis() {
|
|
149
|
+
const ret = wasm.__wbg_get_repairs_tagEmphasis(this.__wbg_ptr);
|
|
150
|
+
return ret >>> 0;
|
|
151
|
+
}
|
|
104
152
|
/**
|
|
105
153
|
* 블록이 끝나도록 안 닫혀서 닫아 준 강조.
|
|
106
154
|
* @param {number} arg0
|
|
@@ -115,6 +163,13 @@ class Repairs {
|
|
|
115
163
|
set closedFence(arg0) {
|
|
116
164
|
wasm.__wbg_set_repairs_closedFence(this.__wbg_ptr, arg0);
|
|
117
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* 다른 표기로 바꿔 쓴 강조 마커와 `<url|텍스트>` 링크.
|
|
168
|
+
* @param {number} arg0
|
|
169
|
+
*/
|
|
170
|
+
set convertedMarker(arg0) {
|
|
171
|
+
wasm.__wbg_set_repairs_convertedMarker(this.__wbg_ptr, arg0);
|
|
172
|
+
}
|
|
118
173
|
/**
|
|
119
174
|
* 짝 잃은 채 버린 `**`.
|
|
120
175
|
* @param {number} arg0
|
|
@@ -122,6 +177,13 @@ class Repairs {
|
|
|
122
177
|
set droppedMarker(arg0) {
|
|
123
178
|
wasm.__wbg_set_repairs_droppedMarker(this.__wbg_ptr, arg0);
|
|
124
179
|
}
|
|
180
|
+
/**
|
|
181
|
+
* 채널이 구문으로 읽을 글자를 탈출한 수(GitHub 의 `\~`·`\<`·`\*`).
|
|
182
|
+
* @param {number} arg0
|
|
183
|
+
*/
|
|
184
|
+
set escapedChar(arg0) {
|
|
185
|
+
wasm.__wbg_set_repairs_escapedChar(this.__wbg_ptr, arg0);
|
|
186
|
+
}
|
|
125
187
|
/**
|
|
126
188
|
* 짝이 없어 글자로 되돌린 백틱 런.
|
|
127
189
|
* @param {number} arg0
|
|
@@ -129,6 +191,34 @@ class Repairs {
|
|
|
129
191
|
set revertedCodeSpan(arg0) {
|
|
130
192
|
wasm.__wbg_set_repairs_revertedCodeSpan(this.__wbg_ptr, arg0);
|
|
131
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* 다른 기호로 바꿔 쓴 목록 불릿.
|
|
196
|
+
* @param {number} arg0
|
|
197
|
+
*/
|
|
198
|
+
set rewrittenBullet(arg0) {
|
|
199
|
+
wasm.__wbg_set_repairs_rewrittenBullet(this.__wbg_ptr, arg0);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* 원문과 다른 모양으로 다시 쓴 표.
|
|
203
|
+
* @param {number} arg0
|
|
204
|
+
*/
|
|
205
|
+
set rewrittenTable(arg0) {
|
|
206
|
+
wasm.__wbg_set_repairs_rewrittenTable(this.__wbg_ptr, arg0);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* 벗긴 원문 HTML(태그·주석·줄바꿈으로 바꾼 `<br>`).
|
|
210
|
+
* @param {number} arg0
|
|
211
|
+
*/
|
|
212
|
+
set strippedHtml(arg0) {
|
|
213
|
+
wasm.__wbg_set_repairs_strippedHtml(this.__wbg_ptr, arg0);
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* 마커 대신 태그로 낸 강조(GitHub 의 `<strong>`).
|
|
217
|
+
* @param {number} arg0
|
|
218
|
+
*/
|
|
219
|
+
set tagEmphasis(arg0) {
|
|
220
|
+
wasm.__wbg_set_repairs_tagEmphasis(this.__wbg_ptr, arg0);
|
|
221
|
+
}
|
|
132
222
|
}
|
|
133
223
|
if (Symbol.dispose) Repairs.prototype[Symbol.dispose] = Repairs.prototype.free;
|
|
134
224
|
exports.Repairs = Repairs;
|
|
@@ -393,37 +483,37 @@ function __wbg_get_imports() {
|
|
|
393
483
|
__wbg___wbindgen_throw_5d9e815e6fdf150f: function(arg0, arg1) {
|
|
394
484
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
395
485
|
},
|
|
396
|
-
|
|
486
|
+
__wbg_from_6a18a824ab73bfc5: function(arg0, arg1) {
|
|
397
487
|
const ret = getObject(arg1).from;
|
|
398
488
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
399
489
|
var len1 = WASM_VECTOR_LEN;
|
|
400
490
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
401
491
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
402
492
|
},
|
|
403
|
-
|
|
493
|
+
__wbg_html_a628fe022a5daeaf: function(arg0) {
|
|
404
494
|
const ret = getObject(arg0).html;
|
|
405
495
|
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
406
496
|
},
|
|
407
|
-
|
|
497
|
+
__wbg_images_ff5cc833afad2dcf: function(arg0, arg1) {
|
|
408
498
|
const ret = getObject(arg1).images;
|
|
409
499
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
410
500
|
var len1 = WASM_VECTOR_LEN;
|
|
411
501
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
412
502
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
413
503
|
},
|
|
414
|
-
|
|
504
|
+
__wbg_limit_cce570f9381001ea: function(arg0, arg1) {
|
|
415
505
|
const ret = getObject(arg1).limit;
|
|
416
506
|
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
417
507
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
418
508
|
},
|
|
419
|
-
|
|
509
|
+
__wbg_lineBreaks_aa928a165d0a7659: function(arg0, arg1) {
|
|
420
510
|
const ret = getObject(arg1).lineBreaks;
|
|
421
511
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
422
512
|
var len1 = WASM_VECTOR_LEN;
|
|
423
513
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
424
514
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
425
515
|
},
|
|
426
|
-
|
|
516
|
+
__wbg_schemes_429ccca2fff29ed9: function(arg0, arg1) {
|
|
427
517
|
const ret = getObject(arg1).schemes;
|
|
428
518
|
var ptr1 = isLikeNone(ret) ? 0 : passArrayJsValueToWasm0(ret, wasm.__wbindgen_export);
|
|
429
519
|
var len1 = WASM_VECTOR_LEN;
|
package/node/mdwire_bg.wasm
CHANGED
|
Binary file
|
package/node/mdwire_bg.wasm.d.ts
CHANGED
|
@@ -3,14 +3,26 @@
|
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const __wbg_get_repairs_closedEmphasis: (a: number) => number;
|
|
5
5
|
export const __wbg_get_repairs_closedFence: (a: number) => number;
|
|
6
|
+
export const __wbg_get_repairs_convertedMarker: (a: number) => number;
|
|
6
7
|
export const __wbg_get_repairs_droppedMarker: (a: number) => number;
|
|
8
|
+
export const __wbg_get_repairs_escapedChar: (a: number) => number;
|
|
7
9
|
export const __wbg_get_repairs_revertedCodeSpan: (a: number) => number;
|
|
10
|
+
export const __wbg_get_repairs_rewrittenBullet: (a: number) => number;
|
|
11
|
+
export const __wbg_get_repairs_rewrittenTable: (a: number) => number;
|
|
12
|
+
export const __wbg_get_repairs_strippedHtml: (a: number) => number;
|
|
13
|
+
export const __wbg_get_repairs_tagEmphasis: (a: number) => number;
|
|
8
14
|
export const __wbg_rendered_free: (a: number, b: number) => void;
|
|
9
15
|
export const __wbg_repairs_free: (a: number, b: number) => void;
|
|
10
16
|
export const __wbg_set_repairs_closedEmphasis: (a: number, b: number) => void;
|
|
11
17
|
export const __wbg_set_repairs_closedFence: (a: number, b: number) => void;
|
|
18
|
+
export const __wbg_set_repairs_convertedMarker: (a: number, b: number) => void;
|
|
12
19
|
export const __wbg_set_repairs_droppedMarker: (a: number, b: number) => void;
|
|
20
|
+
export const __wbg_set_repairs_escapedChar: (a: number, b: number) => void;
|
|
13
21
|
export const __wbg_set_repairs_revertedCodeSpan: (a: number, b: number) => void;
|
|
22
|
+
export const __wbg_set_repairs_rewrittenBullet: (a: number, b: number) => void;
|
|
23
|
+
export const __wbg_set_repairs_rewrittenTable: (a: number, b: number) => void;
|
|
24
|
+
export const __wbg_set_repairs_strippedHtml: (a: number, b: number) => void;
|
|
25
|
+
export const __wbg_set_repairs_tagEmphasis: (a: number, b: number) => void;
|
|
14
26
|
export const __wbg_streamer_free: (a: number, b: number) => void;
|
|
15
27
|
export const limit: (a: number, b: number, c: number) => void;
|
|
16
28
|
export const render: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@minjun0219/mdwire",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "Streaming Markdown renderer for chat channels and the browser. Telegram HTML, Slack markdown_text, GitHub, HTML, React.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": { "type": "git", "url": "https://github.com/minjun0219/mdwire" },
|
|
7
|
-
"homepage": "https://
|
|
7
|
+
"homepage": "https://mdwire.minjun.dev",
|
|
8
8
|
"keywords": ["markdown", "telegram", "slack", "github", "react", "streaming", "llm", "wasm"],
|
|
9
9
|
"type": "module",
|
|
10
10
|
"main": "./node/mdwire.js",
|