@owomark/processor 0.1.5
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 +41 -0
- package/dist/index.d.ts +234 -0
- package/dist/index.js +1693 -0
- package/package.json +74 -0
- package/src/mdx-components/mdx-components.css +336 -0
package/package.json
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@owomark/processor",
|
|
3
|
+
"version": "0.1.5",
|
|
4
|
+
"description": "Node-safe Markdown and MDX processor, plugins, and built-in MDX components for OwoMark.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"keywords": [
|
|
11
|
+
"markdown",
|
|
12
|
+
"mdx",
|
|
13
|
+
"processor",
|
|
14
|
+
"owomark"
|
|
15
|
+
],
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=20"
|
|
18
|
+
},
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"import": "./dist/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./mdx-components.css": "./src/mdx-components/mdx-components.css"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist",
|
|
28
|
+
"src/mdx-components/mdx-components.css"
|
|
29
|
+
],
|
|
30
|
+
"sideEffects": [
|
|
31
|
+
"./src/mdx-components/mdx-components.css"
|
|
32
|
+
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "tsup",
|
|
35
|
+
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
36
|
+
},
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"rehype-katex": "^6.0.3",
|
|
42
|
+
"rehype-pretty-code": "^0.14.1",
|
|
43
|
+
"rehype-slug": "^6.0.0",
|
|
44
|
+
"rehype-stringify": "^10.0.1",
|
|
45
|
+
"remark-directive": "^4.0.0",
|
|
46
|
+
"remark-gfm": "^4.0.1",
|
|
47
|
+
"remark-math": "^6.0.0",
|
|
48
|
+
"remark-mdx": "^3.1.0",
|
|
49
|
+
"remark-parse": "^11.0.0",
|
|
50
|
+
"remark-rehype": "^11.1.2",
|
|
51
|
+
"shiki": "^3.23.0",
|
|
52
|
+
"unified": "^11.0.5"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"@mdx-js/mdx": "^3.0.0",
|
|
56
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
57
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
58
|
+
},
|
|
59
|
+
"peerDependenciesMeta": {
|
|
60
|
+
"@mdx-js/mdx": {
|
|
61
|
+
"optional": true
|
|
62
|
+
},
|
|
63
|
+
"react": {
|
|
64
|
+
"optional": true
|
|
65
|
+
},
|
|
66
|
+
"react-dom": {
|
|
67
|
+
"optional": true
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"devDependencies": {
|
|
71
|
+
"@types/react": "^19.0.0",
|
|
72
|
+
"tsup": "^8.5.1"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
/* @owomark/view built-in MDX component styles.
|
|
2
|
+
* Import this in your app: import '@owomark/processor/mdx-components.css'
|
|
3
|
+
* All classes are prefixed with `mdx-` to avoid collisions.
|
|
4
|
+
* Colors reference --owo-* base tokens with hardcoded fallbacks for zero-config use. */
|
|
5
|
+
|
|
6
|
+
/* --- Callout --- */
|
|
7
|
+
|
|
8
|
+
.mdx-callout {
|
|
9
|
+
display: flex;
|
|
10
|
+
gap: 0.75rem;
|
|
11
|
+
padding: 0.875rem 1rem;
|
|
12
|
+
border-radius: 8px;
|
|
13
|
+
border: 1px solid;
|
|
14
|
+
margin-bottom: 1.25rem;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.mdx-callout-icon {
|
|
18
|
+
flex-shrink: 0;
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
width: 1.5rem;
|
|
23
|
+
height: 1.5rem;
|
|
24
|
+
border-radius: 9999px;
|
|
25
|
+
font-weight: 700;
|
|
26
|
+
font-size: 0.8rem;
|
|
27
|
+
line-height: 1;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.mdx-callout-content > :first-child { margin-top: 0; }
|
|
31
|
+
.mdx-callout-content > :last-child { margin-bottom: 0; }
|
|
32
|
+
|
|
33
|
+
.mdx-callout-info {
|
|
34
|
+
background-color: color-mix(in srgb, var(--owo-brand, #3b82f6) 6%, transparent);
|
|
35
|
+
border-color: color-mix(in srgb, var(--owo-brand, #3b82f6) 24%, transparent);
|
|
36
|
+
}
|
|
37
|
+
.mdx-callout-info .mdx-callout-icon { background-color: var(--owo-brand, #3b82f6); color: white; }
|
|
38
|
+
|
|
39
|
+
.mdx-callout-warn {
|
|
40
|
+
background-color: color-mix(in srgb, var(--owo-warning, #f59e0b) 6%, transparent);
|
|
41
|
+
border-color: color-mix(in srgb, var(--owo-warning, #f59e0b) 24%, transparent);
|
|
42
|
+
}
|
|
43
|
+
.mdx-callout-warn .mdx-callout-icon { background-color: var(--owo-warning, #f59e0b); color: white; }
|
|
44
|
+
|
|
45
|
+
.mdx-callout-error {
|
|
46
|
+
background-color: color-mix(in srgb, var(--owo-error, #ef4444) 6%, transparent);
|
|
47
|
+
border-color: color-mix(in srgb, var(--owo-error, #ef4444) 24%, transparent);
|
|
48
|
+
}
|
|
49
|
+
.mdx-callout-error .mdx-callout-icon { background-color: var(--owo-error, #ef4444); color: white; }
|
|
50
|
+
|
|
51
|
+
.mdx-callout-success {
|
|
52
|
+
background-color: color-mix(in srgb, var(--owo-success, #22c55e) 6%, transparent);
|
|
53
|
+
border-color: color-mix(in srgb, var(--owo-success, #22c55e) 24%, transparent);
|
|
54
|
+
}
|
|
55
|
+
.mdx-callout-success .mdx-callout-icon { background-color: var(--owo-success, #22c55e); color: white; }
|
|
56
|
+
|
|
57
|
+
/* --- CodeDemo --- */
|
|
58
|
+
|
|
59
|
+
.mdx-code-demo { margin-bottom: 1.5rem; }
|
|
60
|
+
.mdx-code-demo figcaption {
|
|
61
|
+
font-size: 0.85rem;
|
|
62
|
+
opacity: 0.7;
|
|
63
|
+
margin-bottom: 0.5rem;
|
|
64
|
+
font-weight: 500;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* --- Steps --- */
|
|
68
|
+
|
|
69
|
+
.mdx-steps { margin-bottom: 1.5rem; }
|
|
70
|
+
|
|
71
|
+
.mdx-steps-item {
|
|
72
|
+
display: flex;
|
|
73
|
+
gap: 1rem;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.mdx-steps-indicator {
|
|
77
|
+
display: flex;
|
|
78
|
+
flex-direction: column;
|
|
79
|
+
align-items: center;
|
|
80
|
+
flex-shrink: 0;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.mdx-steps-number {
|
|
84
|
+
display: flex;
|
|
85
|
+
align-items: center;
|
|
86
|
+
justify-content: center;
|
|
87
|
+
width: 1.75rem;
|
|
88
|
+
height: 1.75rem;
|
|
89
|
+
border-radius: 9999px;
|
|
90
|
+
background-color: var(--owo-brand, #3b82f6);
|
|
91
|
+
color: white;
|
|
92
|
+
font-weight: 700;
|
|
93
|
+
font-size: 0.8rem;
|
|
94
|
+
line-height: 1;
|
|
95
|
+
flex-shrink: 0;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.mdx-steps-line {
|
|
99
|
+
width: 2px;
|
|
100
|
+
flex: 1;
|
|
101
|
+
background-color: var(--owo-border, #e2e8f0);
|
|
102
|
+
min-height: 1rem;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.mdx-steps-content {
|
|
106
|
+
flex: 1;
|
|
107
|
+
padding-bottom: 1.5rem;
|
|
108
|
+
min-width: 0;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.mdx-steps-item:last-child .mdx-steps-content { padding-bottom: 0; }
|
|
112
|
+
|
|
113
|
+
.mdx-step-title {
|
|
114
|
+
font-size: 1rem;
|
|
115
|
+
font-weight: 600;
|
|
116
|
+
margin: 0 0 0.5rem;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.mdx-step-body > :first-child { margin-top: 0; }
|
|
120
|
+
.mdx-step-body > :last-child { margin-bottom: 0; }
|
|
121
|
+
|
|
122
|
+
/* --- Tabs --- */
|
|
123
|
+
|
|
124
|
+
.mdx-tabs {
|
|
125
|
+
margin-bottom: 1.5rem;
|
|
126
|
+
border: 1px solid var(--owo-border, #e2e8f0);
|
|
127
|
+
border-radius: 8px;
|
|
128
|
+
overflow: hidden;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.mdx-tabs-list {
|
|
132
|
+
display: flex;
|
|
133
|
+
border-bottom: 1px solid var(--owo-border, #e2e8f0);
|
|
134
|
+
background-color: var(--owo-surface-raised, #f8fafc);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.mdx-tabs-trigger {
|
|
138
|
+
padding: 0.5rem 1rem;
|
|
139
|
+
font-size: 0.875rem;
|
|
140
|
+
font-weight: 500;
|
|
141
|
+
cursor: pointer;
|
|
142
|
+
color: var(--owo-text-muted, #64748b);
|
|
143
|
+
border-bottom: 2px solid transparent;
|
|
144
|
+
margin-bottom: -1px;
|
|
145
|
+
transition: color 0.15s, border-color 0.15s;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.mdx-tabs-radio { display: none; }
|
|
149
|
+
|
|
150
|
+
.mdx-tabs-trigger:has(.mdx-tabs-radio:checked) {
|
|
151
|
+
border-bottom-color: var(--owo-brand, #3b82f6);
|
|
152
|
+
color: var(--owo-brand, #3b82f6);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.mdx-tabs-panel {
|
|
156
|
+
display: none;
|
|
157
|
+
padding: 1rem;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.mdx-tabs-panel > :first-child { margin-top: 0; }
|
|
161
|
+
.mdx-tabs-panel > :last-child { margin-bottom: 0; }
|
|
162
|
+
|
|
163
|
+
/* CSS-only tab switching via :has() */
|
|
164
|
+
.mdx-tabs-list:has(.mdx-tabs-trigger:nth-child(1) .mdx-tabs-radio:checked) ~ .mdx-tabs-panel:nth-of-type(1),
|
|
165
|
+
.mdx-tabs-list:has(.mdx-tabs-trigger:nth-child(2) .mdx-tabs-radio:checked) ~ .mdx-tabs-panel:nth-of-type(2),
|
|
166
|
+
.mdx-tabs-list:has(.mdx-tabs-trigger:nth-child(3) .mdx-tabs-radio:checked) ~ .mdx-tabs-panel:nth-of-type(3),
|
|
167
|
+
.mdx-tabs-list:has(.mdx-tabs-trigger:nth-child(4) .mdx-tabs-radio:checked) ~ .mdx-tabs-panel:nth-of-type(4),
|
|
168
|
+
.mdx-tabs-list:has(.mdx-tabs-trigger:nth-child(5) .mdx-tabs-radio:checked) ~ .mdx-tabs-panel:nth-of-type(5) {
|
|
169
|
+
display: block;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/* --- FileTree --- */
|
|
173
|
+
|
|
174
|
+
.mdx-file-tree {
|
|
175
|
+
font-family: var(--owo-font-mono, ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace);
|
|
176
|
+
font-size: 0.875rem;
|
|
177
|
+
background-color: var(--owo-surface-raised, #f8fafc);
|
|
178
|
+
border: 1px solid var(--owo-border, #e2e8f0);
|
|
179
|
+
border-radius: 8px;
|
|
180
|
+
padding: 0.75rem 0;
|
|
181
|
+
margin-bottom: 1.5rem;
|
|
182
|
+
overflow-x: auto;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.mdx-file-tree-entry {
|
|
186
|
+
display: flex;
|
|
187
|
+
align-items: center;
|
|
188
|
+
gap: 0.5rem;
|
|
189
|
+
padding: 0.15rem 0.75rem;
|
|
190
|
+
line-height: 1.6;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.mdx-file-tree-icon { flex-shrink: 0; font-size: 0.85em; }
|
|
194
|
+
.mdx-file-tree-dir .mdx-file-tree-name { font-weight: 600; }
|
|
195
|
+
|
|
196
|
+
/* --- Kbd --- */
|
|
197
|
+
|
|
198
|
+
.mdx-kbd {
|
|
199
|
+
display: inline-block;
|
|
200
|
+
padding: 0.1em 0.45em;
|
|
201
|
+
font-family: var(--owo-font-mono, ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace);
|
|
202
|
+
font-size: 0.85em;
|
|
203
|
+
line-height: 1.4;
|
|
204
|
+
color: var(--owo-text, #1e293b);
|
|
205
|
+
background-color: var(--owo-surface-raised, #f1f5f9);
|
|
206
|
+
border: 1px solid var(--owo-border-strong, #cbd5e1);
|
|
207
|
+
border-bottom-width: 2px;
|
|
208
|
+
border-radius: 4px;
|
|
209
|
+
box-shadow: 0 1px 0 var(--owo-border, #e2e8f0);
|
|
210
|
+
vertical-align: baseline;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/* --- Unregistered component fallback --- */
|
|
214
|
+
|
|
215
|
+
[data-mdx-missing] {
|
|
216
|
+
padding: 0.5rem 1rem;
|
|
217
|
+
background-color: color-mix(in srgb, var(--owo-warning, #f59e0b) 8%, transparent);
|
|
218
|
+
border: 1px dashed color-mix(in srgb, var(--owo-warning, #f59e0b) 40%, transparent);
|
|
219
|
+
border-radius: 4px;
|
|
220
|
+
margin-bottom: 1rem;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
[data-mdx-missing]::before {
|
|
224
|
+
content: "Missing component: " attr(data-mdx-missing);
|
|
225
|
+
display: block;
|
|
226
|
+
font-size: 0.75rem;
|
|
227
|
+
color: var(--owo-warning, #f59e0b);
|
|
228
|
+
font-weight: 600;
|
|
229
|
+
margin-bottom: 0.25rem;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/* --- Markdown Sandbox --- */
|
|
233
|
+
|
|
234
|
+
.owo-markdown-sandbox {
|
|
235
|
+
margin: 1.5rem 0;
|
|
236
|
+
border: 1px solid color-mix(in srgb, var(--owo-border, #e2e8f0) 88%, white);
|
|
237
|
+
border-radius: 12px;
|
|
238
|
+
overflow: clip;
|
|
239
|
+
background:
|
|
240
|
+
linear-gradient(180deg, color-mix(in srgb, var(--owo-surface-raised, #f8fafc) 92%, white), #ffffff);
|
|
241
|
+
box-shadow: 0 10px 30px color-mix(in srgb, #0f172a 8%, transparent);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.owo-markdown-sandbox__header {
|
|
245
|
+
display: flex;
|
|
246
|
+
align-items: center;
|
|
247
|
+
justify-content: space-between;
|
|
248
|
+
gap: 0.75rem;
|
|
249
|
+
padding: 0.85rem 1rem;
|
|
250
|
+
border-bottom: 1px solid color-mix(in srgb, var(--owo-border, #e2e8f0) 88%, white);
|
|
251
|
+
background: color-mix(in srgb, var(--owo-surface-raised, #f8fafc) 72%, white);
|
|
252
|
+
list-style: none;
|
|
253
|
+
cursor: default;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.owo-markdown-sandbox__details > .owo-markdown-sandbox__header::-webkit-details-marker {
|
|
257
|
+
display: none;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.owo-markdown-sandbox__title {
|
|
261
|
+
font-size: 0.95rem;
|
|
262
|
+
font-weight: 600;
|
|
263
|
+
color: var(--owo-text, #0f172a);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.owo-markdown-sandbox__status {
|
|
267
|
+
flex-shrink: 0;
|
|
268
|
+
padding: 0.2rem 0.55rem;
|
|
269
|
+
border-radius: 999px;
|
|
270
|
+
font-size: 0.72rem;
|
|
271
|
+
font-weight: 600;
|
|
272
|
+
letter-spacing: 0.04em;
|
|
273
|
+
text-transform: uppercase;
|
|
274
|
+
color: var(--owo-brand, #2563eb);
|
|
275
|
+
background: color-mix(in srgb, var(--owo-brand, #2563eb) 10%, white);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.owo-markdown-sandbox__body {
|
|
279
|
+
isolation: isolate;
|
|
280
|
+
padding: 1.1rem 1.15rem;
|
|
281
|
+
color: var(--owo-text, #0f172a);
|
|
282
|
+
font-family: var(--owo-font-sans, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif);
|
|
283
|
+
line-height: 1.75;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.owo-markdown-sandbox__body :where(h1, h2, h3, h4, h5, h6, p, ul, ol, blockquote, pre, table, figure) {
|
|
287
|
+
margin-block: 0 1rem;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.owo-markdown-sandbox__body :where(h1, h2, h3, h4, h5, h6) {
|
|
291
|
+
color: var(--owo-text, #0f172a);
|
|
292
|
+
line-height: 1.25;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.owo-markdown-sandbox__body :where(pre) {
|
|
296
|
+
overflow-x: auto;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.owo-markdown-sandbox__body :where(code, pre code) {
|
|
300
|
+
font-family: var(--owo-font-mono, ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.owo-markdown-sandbox__source-panel {
|
|
304
|
+
border-top: 1px solid color-mix(in srgb, var(--owo-border, #e2e8f0) 88%, white);
|
|
305
|
+
background: color-mix(in srgb, var(--owo-surface-raised, #f8fafc) 55%, white);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.owo-markdown-sandbox__source-panel > summary {
|
|
309
|
+
cursor: pointer;
|
|
310
|
+
padding: 0.8rem 1rem;
|
|
311
|
+
font-size: 0.82rem;
|
|
312
|
+
font-weight: 600;
|
|
313
|
+
color: var(--owo-text-muted, #475569);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.owo-markdown-sandbox__source {
|
|
317
|
+
margin: 0;
|
|
318
|
+
padding: 0 1rem 1rem;
|
|
319
|
+
overflow-x: auto;
|
|
320
|
+
font-size: 0.88rem;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.owo-markdown-sandbox__source code {
|
|
324
|
+
font-family: var(--owo-font-mono, ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.owo-markdown-sandbox--error .owo-markdown-sandbox__status {
|
|
328
|
+
color: var(--owo-error, #dc2626);
|
|
329
|
+
background: color-mix(in srgb, var(--owo-error, #dc2626) 10%, white);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.owo-markdown-sandbox__error-message {
|
|
333
|
+
margin: 0 0 0.85rem;
|
|
334
|
+
color: var(--owo-error, #b91c1c);
|
|
335
|
+
font-weight: 500;
|
|
336
|
+
}
|