@minjun0219/mdwire 0.1.8 → 0.1.10
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 +52 -37
- package/bundler/mdwire.d.ts +26 -4
- package/bundler/mdwire_bg.js +96 -13
- 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 +2 -2
- package/js/react.d.ts +1 -4
- package/js/react.js +11 -7
- package/node/mdwire.d.ts +26 -4
- package/node/mdwire.js +96 -13
- 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
|
-
Agents emit Markdown. Chat channels don't
|
|
8
|
+
Agents emit Markdown. Chat channels don't take it as is — 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.10.** 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
|
|
|
@@ -21,13 +22,16 @@ deliberately deferred. `SPEC.md` and `DESIGN.md` are written in Korean.
|
|
|
21
22
|
LLM markdown → normalize → render for channel → split safely → send
|
|
22
23
|
```
|
|
23
24
|
|
|
24
|
-
1. **Normalize.** Agent
|
|
25
|
-
|
|
25
|
+
1. **Normalize.** Agent-written Markdown may not render correctly through a standard
|
|
26
|
+
Markdown converter. Typical cases: unpaired `**`, emphasis that spans a line break in wrapped
|
|
27
|
+
prose, unclosed code fences. Repair before rendering.
|
|
26
28
|
2. **Render.** Emit the syntax the channel actually accepts. Telegram HTML allows nine
|
|
27
29
|
tags; Slack `markdown_text` takes standard Markdown directly. GitHub takes it too, but
|
|
28
30
|
reads a lone `~` as strikethrough and `<T>` as an HTML tag — so a `~` or `<` meant as a
|
|
29
|
-
character goes out escaped (`\~`, `\<`), and emphasis GFM would not close
|
|
30
|
-
followed directly by a Korean particle
|
|
31
|
+
character goes out escaped (`\~`, `\<`), and emphasis that GFM would not close (`**(a)**`
|
|
32
|
+
followed directly by a Korean particle) goes out as `<strong>`. Notion renders that bold as is
|
|
33
|
+
but shows inline HTML as text, so `notion-markdown` strips the tags and escapes a literal `*`
|
|
34
|
+
or `\` instead. For the browser, `html` renders
|
|
31
35
|
blocks as tags too and is safe to set as `innerHTML`: text is escaped, inline tags from the
|
|
32
36
|
source keep no attributes, and only `http(s)`/`mailto` links become `<a>` — line breaks,
|
|
33
37
|
images and allowed schemes are options. While streaming,
|
|
@@ -35,11 +39,11 @@ LLM markdown → normalize → render for channel → split safely → s
|
|
|
35
39
|
3. **Split.** Respect the channel's limit — and never cut through markup. This also
|
|
36
40
|
covers streaming: a chunk boundary must not land inside `**bold**`.
|
|
37
41
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
The pipeline has one option. **Repair report:** how many times the normalizer stepped
|
|
43
|
+
in — unclosed emphasis, unclosed fence, unpaired backticks, dropped markers — and what it
|
|
44
|
+
rewrote for the channel — escaped characters, tags for emphasis, stripped HTML, bullets,
|
|
45
|
+
tables, converted markers — so you can log how often the model breaks its own formatting
|
|
46
|
+
and see what a channel changes before you adopt it.
|
|
43
47
|
|
|
44
48
|
## Use it
|
|
45
49
|
|
|
@@ -48,9 +52,9 @@ cat agent-output.md | mdwire --channel telegram-html # parts separated
|
|
|
48
52
|
cat agent-output.md | mdwire --channel slack-markdown --stream # emit as it arrives
|
|
49
53
|
cat agent-output.md | mdwire --channel plain --limit 4096 # plain fallback into Telegram
|
|
50
54
|
|
|
51
|
-
#
|
|
52
|
-
#
|
|
53
|
-
cat agent-output.md | mdwire --channel slack-markdown --
|
|
55
|
+
# --report prints what the normalizer fixed and rewrote (unclosed emphasis, escaped `~`,
|
|
56
|
+
# stripped tags, …) to stderr as one JSON line.
|
|
57
|
+
cat agent-output.md | mdwire --channel slack-markdown --report
|
|
54
58
|
```
|
|
55
59
|
|
|
56
60
|
```rust
|
|
@@ -65,7 +69,7 @@ s.finish_into(&mut out); // flush, closing anything left open
|
|
|
65
69
|
import { render, renderWithReport, Streamer } from "@minjun0219/mdwire"; // npm — bundlers, Node, Bun
|
|
66
70
|
|
|
67
71
|
const parts = render(markdown, "telegram-html");
|
|
68
|
-
const { repairs } = renderWithReport(markdown, "slack-markdown"
|
|
72
|
+
const { repairs } = renderWithReport(markdown, "slack-markdown");
|
|
69
73
|
|
|
70
74
|
// A channel that rewrites the whole message (Telegram edit): send acc plus the preview —
|
|
71
75
|
// what is still held (open bold, table rows, a code span) drawn as if the input ended here.
|
|
@@ -111,26 +115,35 @@ mdwire in front of Streamdown, and mdwire side by side. Measured numbers are in
|
|
|
111
115
|
and `finish` only appends the tail. So the pieces concatenated equal a one-shot `render`,
|
|
112
116
|
whatever the chunk size (unless the document is long enough to be split into parts).
|
|
113
117
|
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
|
-
|
|
118
|
+
every file one character and 64 characters at a time and reports any divergence. See
|
|
119
|
+
`SPEC.md` §8.2.
|
|
116
120
|
|
|
117
121
|
The streamer holds back only what it must: a prefix it cannot classify yet, a marker run
|
|
118
|
-
at the end of a chunk, and the inside of an emphasis that has not closed.
|
|
122
|
+
at the end of a chunk, and the inside of an emphasis that has not closed. A whole paragraph is
|
|
119
123
|
never held — a renderer that waits for a newline is not streaming.
|
|
120
124
|
|
|
121
125
|
## Why another one
|
|
122
126
|
|
|
123
|
-
|
|
127
|
+
We found three gaps in existing tools:
|
|
124
128
|
|
|
125
|
-
- **
|
|
129
|
+
- **Emphasis spanning lines is common.** In a sample of 60 agent-generated documents,
|
|
126
130
|
44 contained emphasis spanning a line break. A regex-based converter mispaired those
|
|
127
131
|
into *inverted* emphasis ranges — and the channel returned HTTP 200, so nothing caught it.
|
|
128
|
-
- **
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
-
|
|
133
|
-
|
|
132
|
+
- **Common Korean notation collides with Markdown.**
|
|
133
|
+
- In `**설정(config)**을` or `**52%**다`, the bold ends in a symbol and a particle follows right
|
|
134
|
+
after. Under CommonMark's rules the bold does not close and the `**` shows as text. GitHub and
|
|
135
|
+
browser renderers follow those rules.
|
|
136
|
+
- In `약 ~40km, 5~6월`, tildes mark an approximation and a range. With two of them in one
|
|
137
|
+
paragraph, GitHub (GFM), which reads a single `~` as strikethrough, pairs them and strikes
|
|
138
|
+
everything in between (`40km, 5`).
|
|
139
|
+
|
|
140
|
+
The two converters we compared disagree on Korean-adjacent emphasis (one pads it with U+200B, the
|
|
141
|
+
other leaves it alone), and neither checked the channel. mdwire measured each channel: on GitHub it writes just that
|
|
142
|
+
bold as `<strong>` and escapes a literal `~` as `\~`.
|
|
143
|
+
- **Chat-channel converters ignore streaming.** Some browser renderers, like Streamdown, patch
|
|
144
|
+
unclosed syntax while tokens stream in. The Telegram and Slack converters we looked at all
|
|
145
|
+
take the whole document and convert it in one pass. When tokens arrive incrementally,
|
|
146
|
+
markup splits across chunk boundaries.
|
|
134
147
|
|
|
135
148
|
## Design
|
|
136
149
|
|
|
@@ -158,14 +171,16 @@ Every release also carries its own artifacts, if you would rather not go through
|
|
|
158
171
|
|
|
159
172
|
```sh
|
|
160
173
|
# npm package (works under a bundler and in plain Node)
|
|
161
|
-
npm install https://github.com/minjun0219/mdwire/releases/download/v0.1.
|
|
174
|
+
npm install https://github.com/minjun0219/mdwire/releases/download/v0.1.10/mdwire-0.1.10.tgz
|
|
162
175
|
|
|
163
|
-
# CLI binary —
|
|
164
|
-
curl -L https://github.com/minjun0219/mdwire/releases/download/v0.1.
|
|
165
|
-
curl -L https://github.com/minjun0219/mdwire/releases/download/v0.1.
|
|
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
|
|
166
181
|
```
|
|
167
182
|
|
|
168
|
-
The release notes list a SHA-256 for every artifact —
|
|
183
|
+
The release notes list a SHA-256 for every artifact — verify the download against it when installing by URL.
|
|
169
184
|
|
|
170
185
|
Or from source: `cargo install --path crates/mdwire-cli`.
|
|
171
186
|
|
|
@@ -183,7 +198,7 @@ s := mdwire.NewStreamer(mdwire.SlackMarkdown)
|
|
|
183
198
|
s.PushTo(chunk, &out) // no allocation per chunk
|
|
184
199
|
s.FinishTo(&out)
|
|
185
200
|
|
|
186
|
-
out := mdwire.RenderWith(input, mdwire.SlackMarkdown, mdwire.Options{
|
|
201
|
+
out := mdwire.RenderWith(input, mdwire.SlackMarkdown, mdwire.Options{})
|
|
187
202
|
log.Printf("%+v", out.Repairs)
|
|
188
203
|
```
|
|
189
204
|
|
|
@@ -194,7 +209,7 @@ log.Printf("%+v", out.Repairs)
|
|
|
194
209
|
./scripts/smoke.sh # install it into a scratch project; call it from Node, Bun, and TypeScript
|
|
195
210
|
```
|
|
196
211
|
|
|
197
|
-
The wasm binary is 111 KB
|
|
212
|
+
The wasm binary is 111 KB (release build, after `wasm-opt`). The package carries two builds and
|
|
198
213
|
picks by `exports` condition: `node` gets a CommonJS build that loads the wasm from disk,
|
|
199
214
|
everything else gets the ESM bundler build. The script writes the root `package.json`
|
|
200
215
|
itself: the crate has to stay `mdwire-wasm` because the core's library is already named
|
|
@@ -217,8 +232,8 @@ mdwire-check --scan ./some-directory-of-markdown # invariants only, no expecte
|
|
|
217
232
|
|
|
218
233
|
## Releasing
|
|
219
234
|
|
|
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
|
|
235
|
+
Nobody edits the version by hand. When a merge to `main` changes what ships (the core, CLI,
|
|
236
|
+
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
237
|
the release with its artifacts. See `AGENTS.md`.
|
|
223
238
|
|
|
224
239
|
## License
|
package/bundler/mdwire.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
|
-
/** 변환 옵션. 생략하면
|
|
4
|
+
/** 변환 옵션. 생략하면 채널의 기본값이다. */
|
|
5
5
|
export interface RenderOptions {
|
|
6
|
-
/** 입력 표기. 슬랙 레거시 mrkdwn(`*굵게*` `~취소~`)으로 쓴 에이전트 출력이면 "slack-mrkdwn". */
|
|
7
|
-
from?: "markdown" | "slack-mrkdwn";
|
|
8
6
|
/** 조각 한도(글자 수). 생략하면 채널의 한도다 — plain 을 텔레그램에 보내면 4096. 스트리밍은 나누지 않는다. */
|
|
9
7
|
limit?: number;
|
|
10
8
|
/** 브라우저 채널("html")의 정책. 기본값이 가장 보수적이다. */
|
|
@@ -38,7 +36,7 @@ export class Rendered {
|
|
|
38
36
|
}
|
|
39
37
|
|
|
40
38
|
/**
|
|
41
|
-
* 정규화가 고친 것의 개수.
|
|
39
|
+
* 정규화가 고친 것과 채널에 맞춰 바꾼 것의 개수.
|
|
42
40
|
*/
|
|
43
41
|
export class Repairs {
|
|
44
42
|
private constructor();
|
|
@@ -52,14 +50,38 @@ export class Repairs {
|
|
|
52
50
|
* 문서 끝까지 안 닫혀서 닫아 준 코드펜스.
|
|
53
51
|
*/
|
|
54
52
|
closedFence: number;
|
|
53
|
+
/**
|
|
54
|
+
* 다른 표기로 바꿔 쓴 강조 마커와 `<url|텍스트>` 링크.
|
|
55
|
+
*/
|
|
56
|
+
convertedMarker: number;
|
|
55
57
|
/**
|
|
56
58
|
* 짝 잃은 채 버린 `**`.
|
|
57
59
|
*/
|
|
58
60
|
droppedMarker: number;
|
|
61
|
+
/**
|
|
62
|
+
* 채널이 구문으로 읽을 글자를 이스케이프한 수(GitHub 의 `\~`·`\<`·`\*`).
|
|
63
|
+
*/
|
|
64
|
+
escapedChar: number;
|
|
59
65
|
/**
|
|
60
66
|
* 짝이 없어 글자로 되돌린 백틱 런.
|
|
61
67
|
*/
|
|
62
68
|
revertedCodeSpan: number;
|
|
69
|
+
/**
|
|
70
|
+
* 다른 기호로 바꿔 쓴 목록 불릿.
|
|
71
|
+
*/
|
|
72
|
+
rewrittenBullet: number;
|
|
73
|
+
/**
|
|
74
|
+
* 원문과 다른 모양으로 다시 쓴 표.
|
|
75
|
+
*/
|
|
76
|
+
rewrittenTable: number;
|
|
77
|
+
/**
|
|
78
|
+
* 벗긴 원문 HTML(태그·주석·줄바꿈으로 바꾼 `<br>`).
|
|
79
|
+
*/
|
|
80
|
+
strippedHtml: number;
|
|
81
|
+
/**
|
|
82
|
+
* 채널이 마커로 못 읽는 자리라 다르게 낸 강조(GitHub 의 `<strong>`, 슬랙의 U+2060).
|
|
83
|
+
*/
|
|
84
|
+
tagEmphasis: number;
|
|
63
85
|
}
|
|
64
86
|
|
|
65
87
|
/**
|
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>`, 슬랙의 U+2060).
|
|
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>`, 슬랙의 U+2060).
|
|
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,30 @@ 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
|
|
386
|
-
const ret = getObject(arg1).from;
|
|
387
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
388
|
-
var len1 = WASM_VECTOR_LEN;
|
|
389
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
390
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
391
|
-
}
|
|
392
|
-
export function __wbg_html_90d0c88b318a2996(arg0) {
|
|
475
|
+
export function __wbg_html_0aa47f0cff3bfe93(arg0) {
|
|
393
476
|
const ret = getObject(arg0).html;
|
|
394
477
|
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
395
478
|
}
|
|
396
|
-
export function
|
|
479
|
+
export function __wbg_images_7df1f16cee267678(arg0, arg1) {
|
|
397
480
|
const ret = getObject(arg1).images;
|
|
398
481
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
399
482
|
var len1 = WASM_VECTOR_LEN;
|
|
400
483
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
401
484
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
402
485
|
}
|
|
403
|
-
export function
|
|
486
|
+
export function __wbg_limit_7811a23349eec87f(arg0, arg1) {
|
|
404
487
|
const ret = getObject(arg1).limit;
|
|
405
488
|
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
406
489
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
407
490
|
}
|
|
408
|
-
export function
|
|
491
|
+
export function __wbg_lineBreaks_1d80ff3d107b92c9(arg0, arg1) {
|
|
409
492
|
const ret = getObject(arg1).lineBreaks;
|
|
410
493
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
411
494
|
var len1 = WASM_VECTOR_LEN;
|
|
412
495
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
413
496
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
414
497
|
}
|
|
415
|
-
export function
|
|
498
|
+
export function __wbg_schemes_aa169c7c8566f577(arg0, arg1) {
|
|
416
499
|
const ret = getObject(arg1).schemes;
|
|
417
500
|
var ptr1 = isLikeNone(ret) ? 0 : passArrayJsValueToWasm0(ret, wasm.__wbindgen_export);
|
|
418
501
|
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// mdwire 의 html 채널 출력을 이벤트 열로 푼다.
|
|
2
2
|
//
|
|
3
|
-
// **mdwire 가 낸 HTML 만 읽는다.** 코어가 글자를 전부
|
|
3
|
+
// **mdwire 가 낸 HTML 만 읽는다.** 코어가 글자를 전부 이스케이프하고 태그를 고정된 집합으로만
|
|
4
4
|
// 내므로(SPEC 4절) 여기서 필요한 것은 작은 토크나이저 하나다. 남이 쓴 HTML 을 넣으면 모르는
|
|
5
5
|
// 태그는 글자로 돌려준다 — 이 모듈은 새니타이저가 아니다. 안전 판단은 코어 한 곳에 있다.
|
|
6
6
|
|
|
@@ -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/js/react.d.ts
CHANGED
|
@@ -8,10 +8,8 @@ export type MdComponents = Partial<Record<MdTag, ElementType>>;
|
|
|
8
8
|
export interface MarkdownProps {
|
|
9
9
|
/** 에이전트가 쓴 마크다운(완성된 글). 스트리밍은 `Streamer` + `toElements` 로 — 누적본을 매번 넘기면 처음부터 다시 변환한다. */
|
|
10
10
|
text: string;
|
|
11
|
-
/** 입력 표기. 슬랙 레거시 mrkdwn 이면 "slack-mrkdwn". */
|
|
12
|
-
from?: "markdown" | "slack-mrkdwn";
|
|
13
11
|
components?: MdComponents;
|
|
14
|
-
/** 코어에 넘길 옵션 — `html` 정책(줄바꿈·이미지·스킴)이 여기 든다.
|
|
12
|
+
/** 코어에 넘길 옵션 — `html` 정책(줄바꿈·이미지·스킴)이 여기 든다. */
|
|
15
13
|
options?: RenderOptions;
|
|
16
14
|
}
|
|
17
15
|
|
|
@@ -19,7 +17,6 @@ export interface MarkdownProps {
|
|
|
19
17
|
export function Markdown(props: MarkdownProps): ReactElement;
|
|
20
18
|
|
|
21
19
|
export interface MarkdownStreamOptions {
|
|
22
|
-
from?: "markdown" | "slack-mrkdwn";
|
|
23
20
|
components?: MdComponents;
|
|
24
21
|
options?: RenderOptions;
|
|
25
22
|
/** 붙든 것(열린 강조·표 행·코드 스팬)도 먼저 그린다. 기본 `true`. `false` 면 확정된 것만. */
|
package/js/react.js
CHANGED
|
@@ -89,10 +89,9 @@ export function toElements(html, components = {}, schemes = DEFAULT_SCHEMES) {
|
|
|
89
89
|
* 보였다가 사라진다. 스트리밍은 [`useMarkdownStream`].
|
|
90
90
|
* @param {import("./react.d.ts").MarkdownProps} props
|
|
91
91
|
*/
|
|
92
|
-
export function Markdown({ text,
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
return createElement(Fragment, null, ...toElements(html, components, opts.html?.schemes ?? DEFAULT_SCHEMES));
|
|
92
|
+
export function Markdown({ text, components, options }) {
|
|
93
|
+
const html = render(text, "html", options).join("");
|
|
94
|
+
return createElement(Fragment, null, ...toElements(html, components, options?.html?.schemes ?? DEFAULT_SCHEMES));
|
|
96
95
|
}
|
|
97
96
|
|
|
98
97
|
/**
|
|
@@ -107,13 +106,18 @@ export function Markdown({ text, from, components, options }) {
|
|
|
107
106
|
* 다른가다. 같으면 훅은 다시 그리지 않는다.
|
|
108
107
|
* @param {import("./react.d.ts").MarkdownStreamOptions} [opts]
|
|
109
108
|
*/
|
|
110
|
-
export function useMarkdownStream({
|
|
109
|
+
export function useMarkdownStream({ components, options, eager = true, onSettled } = {}) {
|
|
111
110
|
const ref = useRef(null);
|
|
112
111
|
const init = useRef(null);
|
|
113
112
|
const [, rerender] = useReducer((n) => n + 1, 0);
|
|
114
113
|
if (init.current === null) {
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
init.current = () => ({
|
|
115
|
+
streamer: new Streamer("html", options),
|
|
116
|
+
acc: "",
|
|
117
|
+
done: false,
|
|
118
|
+
eager,
|
|
119
|
+
schemes: options?.html?.schemes ?? DEFAULT_SCHEMES,
|
|
120
|
+
});
|
|
117
121
|
}
|
|
118
122
|
// 해제됐으면 다시 만든다 — StrictMode 개발 모드는 이펙트를 붙였다 떼었다 다시 붙여서, 정리
|
|
119
123
|
// 함수가 스트리머를 먼저 해제한다(토큰이 오기 전이라 잃는 것은 없다).
|
package/node/mdwire.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
|
-
/** 변환 옵션. 생략하면
|
|
4
|
+
/** 변환 옵션. 생략하면 채널의 기본값이다. */
|
|
5
5
|
export interface RenderOptions {
|
|
6
|
-
/** 입력 표기. 슬랙 레거시 mrkdwn(`*굵게*` `~취소~`)으로 쓴 에이전트 출력이면 "slack-mrkdwn". */
|
|
7
|
-
from?: "markdown" | "slack-mrkdwn";
|
|
8
6
|
/** 조각 한도(글자 수). 생략하면 채널의 한도다 — plain 을 텔레그램에 보내면 4096. 스트리밍은 나누지 않는다. */
|
|
9
7
|
limit?: number;
|
|
10
8
|
/** 브라우저 채널("html")의 정책. 기본값이 가장 보수적이다. */
|
|
@@ -38,7 +36,7 @@ export class Rendered {
|
|
|
38
36
|
}
|
|
39
37
|
|
|
40
38
|
/**
|
|
41
|
-
* 정규화가 고친 것의 개수.
|
|
39
|
+
* 정규화가 고친 것과 채널에 맞춰 바꾼 것의 개수.
|
|
42
40
|
*/
|
|
43
41
|
export class Repairs {
|
|
44
42
|
private constructor();
|
|
@@ -52,14 +50,38 @@ export class Repairs {
|
|
|
52
50
|
* 문서 끝까지 안 닫혀서 닫아 준 코드펜스.
|
|
53
51
|
*/
|
|
54
52
|
closedFence: number;
|
|
53
|
+
/**
|
|
54
|
+
* 다른 표기로 바꿔 쓴 강조 마커와 `<url|텍스트>` 링크.
|
|
55
|
+
*/
|
|
56
|
+
convertedMarker: number;
|
|
55
57
|
/**
|
|
56
58
|
* 짝 잃은 채 버린 `**`.
|
|
57
59
|
*/
|
|
58
60
|
droppedMarker: number;
|
|
61
|
+
/**
|
|
62
|
+
* 채널이 구문으로 읽을 글자를 이스케이프한 수(GitHub 의 `\~`·`\<`·`\*`).
|
|
63
|
+
*/
|
|
64
|
+
escapedChar: number;
|
|
59
65
|
/**
|
|
60
66
|
* 짝이 없어 글자로 되돌린 백틱 런.
|
|
61
67
|
*/
|
|
62
68
|
revertedCodeSpan: number;
|
|
69
|
+
/**
|
|
70
|
+
* 다른 기호로 바꿔 쓴 목록 불릿.
|
|
71
|
+
*/
|
|
72
|
+
rewrittenBullet: number;
|
|
73
|
+
/**
|
|
74
|
+
* 원문과 다른 모양으로 다시 쓴 표.
|
|
75
|
+
*/
|
|
76
|
+
rewrittenTable: number;
|
|
77
|
+
/**
|
|
78
|
+
* 벗긴 원문 HTML(태그·주석·줄바꿈으로 바꾼 `<br>`).
|
|
79
|
+
*/
|
|
80
|
+
strippedHtml: number;
|
|
81
|
+
/**
|
|
82
|
+
* 채널이 마커로 못 읽는 자리라 다르게 낸 강조(GitHub 의 `<strong>`, 슬랙의 U+2060).
|
|
83
|
+
*/
|
|
84
|
+
tagEmphasis: number;
|
|
63
85
|
}
|
|
64
86
|
|
|
65
87
|
/**
|
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>`, 슬랙의 U+2060).
|
|
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>`, 슬랙의 U+2060).
|
|
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,30 @@ function __wbg_get_imports() {
|
|
|
393
483
|
__wbg___wbindgen_throw_5d9e815e6fdf150f: function(arg0, arg1) {
|
|
394
484
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
395
485
|
},
|
|
396
|
-
|
|
397
|
-
const ret = getObject(arg1).from;
|
|
398
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
399
|
-
var len1 = WASM_VECTOR_LEN;
|
|
400
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
401
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
402
|
-
},
|
|
403
|
-
__wbg_html_90d0c88b318a2996: function(arg0) {
|
|
486
|
+
__wbg_html_0aa47f0cff3bfe93: function(arg0) {
|
|
404
487
|
const ret = getObject(arg0).html;
|
|
405
488
|
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
406
489
|
},
|
|
407
|
-
|
|
490
|
+
__wbg_images_7df1f16cee267678: function(arg0, arg1) {
|
|
408
491
|
const ret = getObject(arg1).images;
|
|
409
492
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
410
493
|
var len1 = WASM_VECTOR_LEN;
|
|
411
494
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
412
495
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
413
496
|
},
|
|
414
|
-
|
|
497
|
+
__wbg_limit_7811a23349eec87f: function(arg0, arg1) {
|
|
415
498
|
const ret = getObject(arg1).limit;
|
|
416
499
|
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
417
500
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
418
501
|
},
|
|
419
|
-
|
|
502
|
+
__wbg_lineBreaks_1d80ff3d107b92c9: function(arg0, arg1) {
|
|
420
503
|
const ret = getObject(arg1).lineBreaks;
|
|
421
504
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
422
505
|
var len1 = WASM_VECTOR_LEN;
|
|
423
506
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
424
507
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
425
508
|
},
|
|
426
|
-
|
|
509
|
+
__wbg_schemes_aa169c7c8566f577: function(arg0, arg1) {
|
|
427
510
|
const ret = getObject(arg1).schemes;
|
|
428
511
|
var ptr1 = isLikeNone(ret) ? 0 : passArrayJsValueToWasm0(ret, wasm.__wbindgen_export);
|
|
429
512
|
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.10",
|
|
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",
|