@docubook/core 2.0.0-beta.3 → 2.0.0-beta.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/LICENSE-MPL-2.0 +375 -0
- package/README.md +3 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +99 -97
- package/dist/index.js.map +1 -1
- package/dist/plugins/rehypeCollectTocs.d.ts +4 -0
- package/dist/plugins/remarkDirectiveToMdx.d.ts +2 -1
- package/package.json +1 -1
package/LICENSE-MPL-2.0
ADDED
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
Copyright IBM Corp. 2020, 2024
|
|
2
|
+
|
|
3
|
+
Mozilla Public License Version 2.0
|
|
4
|
+
==================================
|
|
5
|
+
|
|
6
|
+
1. Definitions
|
|
7
|
+
--------------
|
|
8
|
+
|
|
9
|
+
1.1. "Contributor"
|
|
10
|
+
means each individual or legal entity that creates, contributes to
|
|
11
|
+
the creation of, or owns Covered Software.
|
|
12
|
+
|
|
13
|
+
1.2. "Contributor Version"
|
|
14
|
+
means the combination of the Contributions of others (if any) used
|
|
15
|
+
by a Contributor and that particular Contributor's Contribution.
|
|
16
|
+
|
|
17
|
+
1.3. "Contribution"
|
|
18
|
+
means Covered Software of a particular Contributor.
|
|
19
|
+
|
|
20
|
+
1.4. "Covered Software"
|
|
21
|
+
means Source Code Form to which the initial Contributor has attached
|
|
22
|
+
the notice in Exhibit A, the Executable Form of such Source Code
|
|
23
|
+
Form, and Modifications of such Source Code Form, in each case
|
|
24
|
+
including portions thereof.
|
|
25
|
+
|
|
26
|
+
1.5. "Incompatible With Secondary Licenses"
|
|
27
|
+
means
|
|
28
|
+
|
|
29
|
+
(a) that the initial Contributor has attached the notice described
|
|
30
|
+
in Exhibit B to the Covered Software; or
|
|
31
|
+
|
|
32
|
+
(b) that the Covered Software was made available under the terms of
|
|
33
|
+
version 1.1 or earlier of the License, but not also under the
|
|
34
|
+
terms of a Secondary License.
|
|
35
|
+
|
|
36
|
+
1.6. "Executable Form"
|
|
37
|
+
means any form of the work other than Source Code Form.
|
|
38
|
+
|
|
39
|
+
1.7. "Larger Work"
|
|
40
|
+
means a work that combines Covered Software with other material, in
|
|
41
|
+
a separate file or files, that is not Covered Software.
|
|
42
|
+
|
|
43
|
+
1.8. "License"
|
|
44
|
+
means this document.
|
|
45
|
+
|
|
46
|
+
1.9. "Licensable"
|
|
47
|
+
means having the right to grant, to the maximum extent possible,
|
|
48
|
+
whether at the time of the initial grant or subsequently, any and
|
|
49
|
+
all of the rights conveyed by this License.
|
|
50
|
+
|
|
51
|
+
1.10. "Modifications"
|
|
52
|
+
means any of the following:
|
|
53
|
+
|
|
54
|
+
(a) any file in Source Code Form that results from an addition to,
|
|
55
|
+
deletion from, or modification of the contents of Covered
|
|
56
|
+
Software; or
|
|
57
|
+
|
|
58
|
+
(b) any new file in Source Code Form that contains any Covered
|
|
59
|
+
Software.
|
|
60
|
+
|
|
61
|
+
1.11. "Patent Claims" of a Contributor
|
|
62
|
+
means any patent claim(s), including without limitation, method,
|
|
63
|
+
process, and apparatus claims, in any patent Licensable by such
|
|
64
|
+
Contributor that would be infringed, but for the grant of the
|
|
65
|
+
License, by the making, using, selling, offering for sale, having
|
|
66
|
+
made, import, or transfer of either its Contributions or its
|
|
67
|
+
Contributor Version.
|
|
68
|
+
|
|
69
|
+
1.12. "Secondary License"
|
|
70
|
+
means either the GNU General Public License, Version 2.0, the GNU
|
|
71
|
+
Lesser General Public License, Version 2.1, the GNU Affero General
|
|
72
|
+
Public License, Version 3.0, or any later versions of those
|
|
73
|
+
licenses.
|
|
74
|
+
|
|
75
|
+
1.13. "Source Code Form"
|
|
76
|
+
means the form of the work preferred for making modifications.
|
|
77
|
+
|
|
78
|
+
1.14. "You" (or "Your")
|
|
79
|
+
means an individual or a legal entity exercising rights under this
|
|
80
|
+
License. For legal entities, "You" includes any entity that
|
|
81
|
+
controls, is controlled by, or is under common control with You. For
|
|
82
|
+
purposes of this definition, "control" means (a) the power, direct
|
|
83
|
+
or indirect, to cause the direction or management of such entity,
|
|
84
|
+
whether by contract or otherwise, or (b) ownership of more than
|
|
85
|
+
fifty percent (50%) of the outstanding shares or beneficial
|
|
86
|
+
ownership of such entity.
|
|
87
|
+
|
|
88
|
+
2. License Grants and Conditions
|
|
89
|
+
--------------------------------
|
|
90
|
+
|
|
91
|
+
2.1. Grants
|
|
92
|
+
|
|
93
|
+
Each Contributor hereby grants You a world-wide, royalty-free,
|
|
94
|
+
non-exclusive license:
|
|
95
|
+
|
|
96
|
+
(a) under intellectual property rights (other than patent or trademark)
|
|
97
|
+
Licensable by such Contributor to use, reproduce, make available,
|
|
98
|
+
modify, display, perform, distribute, and otherwise exploit its
|
|
99
|
+
Contributions, either on an unmodified basis, with Modifications, or
|
|
100
|
+
as part of a Larger Work; and
|
|
101
|
+
|
|
102
|
+
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
|
103
|
+
for sale, have made, import, and otherwise transfer either its
|
|
104
|
+
Contributions or its Contributor Version.
|
|
105
|
+
|
|
106
|
+
2.2. Effective Date
|
|
107
|
+
|
|
108
|
+
The licenses granted in Section 2.1 with respect to any Contribution
|
|
109
|
+
become effective for each Contribution on the date the Contributor first
|
|
110
|
+
distributes such Contribution.
|
|
111
|
+
|
|
112
|
+
2.3. Limitations on Grant Scope
|
|
113
|
+
|
|
114
|
+
The licenses granted in this Section 2 are the only rights granted under
|
|
115
|
+
this License. No additional rights or licenses will be implied from the
|
|
116
|
+
distribution or licensing of Covered Software under this License.
|
|
117
|
+
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
|
118
|
+
Contributor:
|
|
119
|
+
|
|
120
|
+
(a) for any code that a Contributor has removed from Covered Software;
|
|
121
|
+
or
|
|
122
|
+
|
|
123
|
+
(b) for infringements caused by: (i) Your and any other third party's
|
|
124
|
+
modifications of Covered Software, or (ii) the combination of its
|
|
125
|
+
Contributions with other software (except as part of its Contributor
|
|
126
|
+
Version); or
|
|
127
|
+
|
|
128
|
+
(c) under Patent Claims infringed by Covered Software in the absence of
|
|
129
|
+
its Contributions.
|
|
130
|
+
|
|
131
|
+
This License does not grant any rights in the trademarks, service marks,
|
|
132
|
+
or logos of any Contributor (except as may be necessary to comply with
|
|
133
|
+
the notice requirements in Section 3.4).
|
|
134
|
+
|
|
135
|
+
2.4. Subsequent Licenses
|
|
136
|
+
|
|
137
|
+
No Contributor makes additional grants as a result of Your choice to
|
|
138
|
+
distribute the Covered Software under a subsequent version of this
|
|
139
|
+
License (see Section 10.2) or under the terms of a Secondary License (if
|
|
140
|
+
permitted under the terms of Section 3.3).
|
|
141
|
+
|
|
142
|
+
2.5. Representation
|
|
143
|
+
|
|
144
|
+
Each Contributor represents that the Contributor believes its
|
|
145
|
+
Contributions are its original creation(s) or it has sufficient rights
|
|
146
|
+
to grant the rights to its Contributions conveyed by this License.
|
|
147
|
+
|
|
148
|
+
2.6. Fair Use
|
|
149
|
+
|
|
150
|
+
This License is not intended to limit any rights You have under
|
|
151
|
+
applicable copyright doctrines of fair use, fair dealing, or other
|
|
152
|
+
equivalents.
|
|
153
|
+
|
|
154
|
+
2.7. Conditions
|
|
155
|
+
|
|
156
|
+
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
|
157
|
+
in Section 2.1.
|
|
158
|
+
|
|
159
|
+
3. Responsibilities
|
|
160
|
+
-------------------
|
|
161
|
+
|
|
162
|
+
3.1. Distribution of Source Form
|
|
163
|
+
|
|
164
|
+
All distribution of Covered Software in Source Code Form, including any
|
|
165
|
+
Modifications that You create or to which You contribute, must be under
|
|
166
|
+
the terms of this License. You must inform recipients that the Source
|
|
167
|
+
Code Form of the Covered Software is governed by the terms of this
|
|
168
|
+
License, and how they can obtain a copy of this License. You may not
|
|
169
|
+
attempt to alter or restrict the recipients' rights in the Source Code
|
|
170
|
+
Form.
|
|
171
|
+
|
|
172
|
+
3.2. Distribution of Executable Form
|
|
173
|
+
|
|
174
|
+
If You distribute Covered Software in Executable Form then:
|
|
175
|
+
|
|
176
|
+
(a) such Covered Software must also be made available in Source Code
|
|
177
|
+
Form, as described in Section 3.1, and You must inform recipients of
|
|
178
|
+
the Executable Form how they can obtain a copy of such Source Code
|
|
179
|
+
Form by reasonable means in a timely manner, at a charge no more
|
|
180
|
+
than the cost of distribution to the recipient; and
|
|
181
|
+
|
|
182
|
+
(b) You may distribute such Executable Form under the terms of this
|
|
183
|
+
License, or sublicense it under different terms, provided that the
|
|
184
|
+
license for the Executable Form does not attempt to limit or alter
|
|
185
|
+
the recipients' rights in the Source Code Form under this License.
|
|
186
|
+
|
|
187
|
+
3.3. Distribution of a Larger Work
|
|
188
|
+
|
|
189
|
+
You may create and distribute a Larger Work under terms of Your choice,
|
|
190
|
+
provided that You also comply with the requirements of this License for
|
|
191
|
+
the Covered Software. If the Larger Work is a combination of Covered
|
|
192
|
+
Software with a work governed by one or more Secondary Licenses, and the
|
|
193
|
+
Covered Software is not Incompatible With Secondary Licenses, this
|
|
194
|
+
License permits You to additionally distribute such Covered Software
|
|
195
|
+
under the terms of such Secondary License(s), so that the recipient of
|
|
196
|
+
the Larger Work may, at their option, further distribute the Covered
|
|
197
|
+
Software under the terms of either this License or such Secondary
|
|
198
|
+
License(s).
|
|
199
|
+
|
|
200
|
+
3.4. Notices
|
|
201
|
+
|
|
202
|
+
You may not remove or alter the substance of any license notices
|
|
203
|
+
(including copyright notices, patent notices, disclaimers of warranty,
|
|
204
|
+
or limitations of liability) contained within the Source Code Form of
|
|
205
|
+
the Covered Software, except that You may alter any license notices to
|
|
206
|
+
the extent required to remedy known factual inaccuracies.
|
|
207
|
+
|
|
208
|
+
3.5. Application of Additional Terms
|
|
209
|
+
|
|
210
|
+
You may choose to offer, and to charge a fee for, warranty, support,
|
|
211
|
+
indemnity or liability obligations to one or more recipients of Covered
|
|
212
|
+
Software. However, You may do so only on Your own behalf, and not on
|
|
213
|
+
behalf of any Contributor. You must make it absolutely clear that any
|
|
214
|
+
such warranty, support, indemnity, or liability obligation is offered by
|
|
215
|
+
You alone, and You hereby agree to indemnify every Contributor for any
|
|
216
|
+
liability incurred by such Contributor as a result of warranty, support,
|
|
217
|
+
indemnity or liability terms You offer. You may include additional
|
|
218
|
+
disclaimers of warranty and limitations of liability specific to any
|
|
219
|
+
jurisdiction.
|
|
220
|
+
|
|
221
|
+
4. Inability to Comply Due to Statute or Regulation
|
|
222
|
+
---------------------------------------------------
|
|
223
|
+
|
|
224
|
+
If it is impossible for You to comply with any of the terms of this
|
|
225
|
+
License with respect to some or all of the Covered Software due to
|
|
226
|
+
statute, judicial order, or regulation then You must: (a) comply with
|
|
227
|
+
the terms of this License to the maximum extent possible; and (b)
|
|
228
|
+
describe the limitations and the code they affect. Such description must
|
|
229
|
+
be placed in a text file included with all distributions of the Covered
|
|
230
|
+
Software under this License. Except to the extent prohibited by statute
|
|
231
|
+
or regulation, such description must be sufficiently detailed for a
|
|
232
|
+
recipient of ordinary skill to be able to understand it.
|
|
233
|
+
|
|
234
|
+
5. Termination
|
|
235
|
+
--------------
|
|
236
|
+
|
|
237
|
+
5.1. The rights granted under this License will terminate automatically
|
|
238
|
+
if You fail to comply with any of its terms. However, if You become
|
|
239
|
+
compliant, then the rights granted under this License from a particular
|
|
240
|
+
Contributor are reinstated (a) provisionally, unless and until such
|
|
241
|
+
Contributor explicitly and finally terminates Your grants, and (b) on an
|
|
242
|
+
ongoing basis, if such Contributor fails to notify You of the
|
|
243
|
+
non-compliance by some reasonable means prior to 60 days after You have
|
|
244
|
+
come back into compliance. Moreover, Your grants from a particular
|
|
245
|
+
Contributor are reinstated on an ongoing basis if such Contributor
|
|
246
|
+
notifies You of the non-compliance by some reasonable means, this is the
|
|
247
|
+
first time You have received notice of non-compliance with this License
|
|
248
|
+
from such Contributor, and You become compliant prior to 30 days after
|
|
249
|
+
Your receipt of the notice.
|
|
250
|
+
|
|
251
|
+
5.2. If You initiate litigation against any entity by asserting a patent
|
|
252
|
+
infringement claim (excluding declaratory judgment actions,
|
|
253
|
+
counter-claims, and cross-claims) alleging that a Contributor Version
|
|
254
|
+
directly or indirectly infringes any patent, then the rights granted to
|
|
255
|
+
You by any and all Contributors for the Covered Software under Section
|
|
256
|
+
2.1 of this License shall terminate.
|
|
257
|
+
|
|
258
|
+
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
|
259
|
+
end user license agreements (excluding distributors and resellers) which
|
|
260
|
+
have been validly granted by You or Your distributors under this License
|
|
261
|
+
prior to termination shall survive termination.
|
|
262
|
+
|
|
263
|
+
************************************************************************
|
|
264
|
+
* *
|
|
265
|
+
* 6. Disclaimer of Warranty *
|
|
266
|
+
* ------------------------- *
|
|
267
|
+
* *
|
|
268
|
+
* Covered Software is provided under this License on an "as is" *
|
|
269
|
+
* basis, without warranty of any kind, either expressed, implied, or *
|
|
270
|
+
* statutory, including, without limitation, warranties that the *
|
|
271
|
+
* Covered Software is free of defects, merchantable, fit for a *
|
|
272
|
+
* particular purpose or non-infringing. The entire risk as to the *
|
|
273
|
+
* quality and performance of the Covered Software is with You. *
|
|
274
|
+
* Should any Covered Software prove defective in any respect, You *
|
|
275
|
+
* (not any Contributor) assume the cost of any necessary servicing, *
|
|
276
|
+
* repair, or correction. This disclaimer of warranty constitutes an *
|
|
277
|
+
* essential part of this License. No use of any Covered Software is *
|
|
278
|
+
* authorized under this License except under this disclaimer. *
|
|
279
|
+
* *
|
|
280
|
+
************************************************************************
|
|
281
|
+
|
|
282
|
+
************************************************************************
|
|
283
|
+
* *
|
|
284
|
+
* 7. Limitation of Liability *
|
|
285
|
+
* -------------------------- *
|
|
286
|
+
* *
|
|
287
|
+
* Under no circumstances and under no legal theory, whether tort *
|
|
288
|
+
* (including negligence), contract, or otherwise, shall any *
|
|
289
|
+
* Contributor, or anyone who distributes Covered Software as *
|
|
290
|
+
* permitted above, be liable to You for any direct, indirect, *
|
|
291
|
+
* special, incidental, or consequential damages of any character *
|
|
292
|
+
* including, without limitation, damages for lost profits, loss of *
|
|
293
|
+
* goodwill, work stoppage, computer failure or malfunction, or any *
|
|
294
|
+
* and all other commercial damages or losses, even if such party *
|
|
295
|
+
* shall have been informed of the possibility of such damages. This *
|
|
296
|
+
* limitation of liability shall not apply to liability for death or *
|
|
297
|
+
* personal injury resulting from such party's negligence to the *
|
|
298
|
+
* extent applicable law prohibits such limitation. Some *
|
|
299
|
+
* jurisdictions do not allow the exclusion or limitation of *
|
|
300
|
+
* incidental or consequential damages, so this exclusion and *
|
|
301
|
+
* limitation may not apply to You. *
|
|
302
|
+
* *
|
|
303
|
+
************************************************************************
|
|
304
|
+
|
|
305
|
+
8. Litigation
|
|
306
|
+
-------------
|
|
307
|
+
|
|
308
|
+
Any litigation relating to this License may be brought only in the
|
|
309
|
+
courts of a jurisdiction where the defendant maintains its principal
|
|
310
|
+
place of business and such litigation shall be governed by laws of that
|
|
311
|
+
jurisdiction, without reference to its conflict-of-law provisions.
|
|
312
|
+
Nothing in this Section shall prevent a party's ability to bring
|
|
313
|
+
cross-claims or counter-claims.
|
|
314
|
+
|
|
315
|
+
9. Miscellaneous
|
|
316
|
+
----------------
|
|
317
|
+
|
|
318
|
+
This License represents the complete agreement concerning the subject
|
|
319
|
+
matter hereof. If any provision of this License is held to be
|
|
320
|
+
unenforceable, such provision shall be reformed only to the extent
|
|
321
|
+
necessary to make it enforceable. Any law or regulation which provides
|
|
322
|
+
that the language of a contract shall be construed against the drafter
|
|
323
|
+
shall not be used to construe this License against a Contributor.
|
|
324
|
+
|
|
325
|
+
10. Versions of the License
|
|
326
|
+
---------------------------
|
|
327
|
+
|
|
328
|
+
10.1. New Versions
|
|
329
|
+
|
|
330
|
+
Mozilla Foundation is the license steward. Except as provided in Section
|
|
331
|
+
10.3, no one other than the license steward has the right to modify or
|
|
332
|
+
publish new versions of this License. Each version will be given a
|
|
333
|
+
distinguishing version number.
|
|
334
|
+
|
|
335
|
+
10.2. Effect of New Versions
|
|
336
|
+
|
|
337
|
+
You may distribute the Covered Software under the terms of the version
|
|
338
|
+
of the License under which You originally received the Covered Software,
|
|
339
|
+
or under the terms of any subsequent version published by the license
|
|
340
|
+
steward.
|
|
341
|
+
|
|
342
|
+
10.3. Modified Versions
|
|
343
|
+
|
|
344
|
+
If you create software not governed by this License, and you want to
|
|
345
|
+
create a new license for such software, you may create and use a
|
|
346
|
+
modified version of this License if you rename the license and remove
|
|
347
|
+
any references to the name of the license steward (except to note that
|
|
348
|
+
such modified license differs from this License).
|
|
349
|
+
|
|
350
|
+
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
|
351
|
+
Licenses
|
|
352
|
+
|
|
353
|
+
If You choose to distribute Source Code Form that is Incompatible With
|
|
354
|
+
Secondary Licenses under the terms of this version of the License, the
|
|
355
|
+
notice described in Exhibit B of this License must be attached.
|
|
356
|
+
|
|
357
|
+
Exhibit A - Source Code Form License Notice
|
|
358
|
+
-------------------------------------------
|
|
359
|
+
|
|
360
|
+
This Source Code Form is subject to the terms of the Mozilla Public
|
|
361
|
+
License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
362
|
+
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
363
|
+
|
|
364
|
+
If it is not possible or desirable to put the notice in a particular
|
|
365
|
+
file, then You may include the notice in a location (such as a LICENSE
|
|
366
|
+
file in a relevant directory) where a recipient would be likely to look
|
|
367
|
+
for such a notice.
|
|
368
|
+
|
|
369
|
+
You may add additional accurate notices of copyright ownership.
|
|
370
|
+
|
|
371
|
+
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
|
372
|
+
---------------------------------------------------------
|
|
373
|
+
|
|
374
|
+
This Source Code Form is "Incompatible With Secondary Licenses", as
|
|
375
|
+
defined by the Mozilla Public License, v. 2.0.
|
package/README.md
CHANGED
|
@@ -68,8 +68,9 @@ boolean props. Nested containers need a longer outer fence (`::::`).
|
|
|
68
68
|
| `MDXRemote` | Client-side renderer for pre-compiled `serialize()` output | React component |
|
|
69
69
|
| `extractFrontmatter` | Parse frontmatter only | `Frontmatter` |
|
|
70
70
|
| `extractFrontmatterWithContent` | Extract frontmatter and stripped content in one pass (avoids double parsing) | `{ frontmatter, strippedContent }` |
|
|
71
|
-
| `extractTocsFromRawMdx` |
|
|
72
|
-
| `
|
|
71
|
+
| `extractTocsFromRawMdx` | Synchronously extract h2–h4 from Markdown/directives using default heading IDs; strips frontmatter | `TocItem[]` |
|
|
72
|
+
| `rehypeCollectTocs` | Append `[rehypeCollectTocs, tocs]` after slugging and custom rehype plugins to collect final heading IDs during compilation | transformer |
|
|
73
|
+
| `sluggify` | Legacy ASCII slug helper; not used for compiler heading IDs | `string` |
|
|
73
74
|
| `createDefaultRehypePlugins` | Default rehype plugin stack | `Pluggable[]` |
|
|
74
75
|
| `createDefaultRemarkPlugins` | Default remark stack (GFM, expandable, directives) | `Pluggable[]` |
|
|
75
76
|
| `remarkDirectiveToMdx` | Convert `:::name{attrs}` directives into MDX component elements | transformer |
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { serialize, MDXRemote, preProcess, postProcess, createDefaultRehypePlugi
|
|
|
4
4
|
export { handleCodeTitles } from "./plugins/handleCodeTitles";
|
|
5
5
|
export { handleCodeExpandableRemark, handleCodeExpandable } from "./plugins/handleCodeExpandable";
|
|
6
6
|
export { rehypeMermaid } from "./plugins/rehypeMermaid";
|
|
7
|
+
export { rehypeCollectTocs } from "./plugins/rehypeCollectTocs";
|
|
7
8
|
export { remarkDirectiveToMdx } from "./plugins/remarkDirectiveToMdx";
|
|
8
9
|
export { extractFrontmatter, extractFrontmatterWithContent, extractTocsFromRawMdx, sluggify, } from "./extract";
|
|
9
10
|
export type { MDXRemoteProps } from "./mdx-compiler/index";
|
package/dist/index.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { cn as e, formatDate as t, formatDate2 as n, parseDate as r, stringToDate as i, toIsoDateOnly as a } from "./utils.js";
|
|
2
2
|
import { t as o } from "./serialize-DEuXE4Xm.js";
|
|
3
|
-
import {
|
|
4
|
-
import c from "
|
|
5
|
-
import l from "
|
|
6
|
-
import u from "rehype-
|
|
7
|
-
import d from "rehype-
|
|
8
|
-
import f from "rehype-
|
|
9
|
-
import p from "
|
|
10
|
-
import m
|
|
11
|
-
import
|
|
12
|
-
import * as y from "react/jsx-
|
|
13
|
-
import * as b from "
|
|
14
|
-
import x from "@
|
|
3
|
+
import { compileSync as s } from "@mdx-js/mdx";
|
|
4
|
+
import { visit as c } from "unist-util-visit";
|
|
5
|
+
import l from "remark-gfm";
|
|
6
|
+
import u from "rehype-prism-plus";
|
|
7
|
+
import d from "rehype-autolink-headings";
|
|
8
|
+
import f from "rehype-slug";
|
|
9
|
+
import p from "rehype-code-titles";
|
|
10
|
+
import m from "remark-directive";
|
|
11
|
+
import h, { useEffect as g, useMemo as _, useState as v } from "react";
|
|
12
|
+
import * as y from "react/jsx-runtime";
|
|
13
|
+
import * as b from "react/jsx-dev-runtime";
|
|
14
|
+
import * as x from "@mdx-js/react";
|
|
15
|
+
import S from "@11ty/gray-matter";
|
|
15
16
|
//#region src/plugins/handleCodeTitles.ts
|
|
16
|
-
var
|
|
17
|
+
var C = () => (e) => {
|
|
17
18
|
let t = [];
|
|
18
|
-
|
|
19
|
+
c(e, "element", (e, n, r) => {
|
|
19
20
|
if (!r || n === null || e.tagName !== "div" || !e.properties?.className?.includes("rehype-code-title")) return;
|
|
20
21
|
let i = null;
|
|
21
22
|
for (let e = n + 1; e < r.children.length; e++) {
|
|
@@ -40,7 +41,7 @@ var S = () => (e) => {
|
|
|
40
41
|
};
|
|
41
42
|
//#endregion
|
|
42
43
|
//#region src/plugins/handleCodeExpandable.ts
|
|
43
|
-
function
|
|
44
|
+
function w(e) {
|
|
44
45
|
let t = "";
|
|
45
46
|
for (let n = 0; n < e.length; n++) {
|
|
46
47
|
let r = e[n];
|
|
@@ -56,29 +57,29 @@ function C(e) {
|
|
|
56
57
|
}
|
|
57
58
|
return t;
|
|
58
59
|
}
|
|
59
|
-
function
|
|
60
|
+
function T(e) {
|
|
60
61
|
let t = e.replace(/\r\n/g, "\n");
|
|
61
62
|
return t.startsWith("\n") && (t = t.slice(1)), t.endsWith("\n") && (t = t.slice(0, -1)), t.length === 0 ? 0 : t.split("\n").length;
|
|
62
63
|
}
|
|
63
|
-
var
|
|
64
|
-
|
|
64
|
+
var E = () => (e) => {
|
|
65
|
+
c(e, "code", (e) => {
|
|
65
66
|
if (!e.meta) return;
|
|
66
67
|
let t = e.meta.includes("Expandable"), [n, r] = (e.lang ?? "").split(":"), i = n?.trim(), a = r?.trim();
|
|
67
68
|
if (!t) return;
|
|
68
|
-
let o =
|
|
69
|
+
let o = T(e.value);
|
|
69
70
|
e.data ||= {}, e.data.hProperties || (e.data.hProperties = {}), e.data.hProperties["data-expandable"] = "true", e.data.hProperties["data-expandable-lines"] = o.toString(), i && (e.data.hProperties["data-language"] = i), a && (e.data.hProperties["data-title"] = a);
|
|
70
71
|
let s = e.data.hProperties.className, c = Array.isArray(s) ? s : typeof s == "string" ? s.split(" ").filter(Boolean) : [];
|
|
71
|
-
c.includes("mdx-expandable-meta") || c.push("mdx-expandable-meta"), e.data.hProperties.className = c, i && !e.meta.includes("dbLang(") && (e.meta = `${e.meta} dbLang(${
|
|
72
|
+
c.includes("mdx-expandable-meta") || c.push("mdx-expandable-meta"), e.data.hProperties.className = c, i && !e.meta.includes("dbLang(") && (e.meta = `${e.meta} dbLang(${w(i)})`.trim()), a && !e.meta.includes("dbTitle(") && (e.meta = `${e.meta} dbTitle(${w(a)})`.trim());
|
|
72
73
|
});
|
|
73
|
-
},
|
|
74
|
-
|
|
74
|
+
}, D = () => (e) => {
|
|
75
|
+
c(e, "element", (e) => {
|
|
75
76
|
if (e.tagName !== "pre") return;
|
|
76
77
|
let t = e.children?.find((e) => {
|
|
77
78
|
let t = e;
|
|
78
79
|
return t.type === "element" && t.tagName === "code";
|
|
79
80
|
}), n = t?.properties?.className, r = Array.isArray(n) ? n : typeof n == "string" ? n.split(" ").filter(Boolean) : [], i = t?.data && typeof t.data == "object" && typeof t.data.meta == "string" ? t.data.meta : void 0, a = i?.match(/dbLang\(([^)]+)\)/)?.[1], o = i?.match(/dbTitle\(([^)]+)\)/)?.[1], s = typeof t?.properties?.["data-language"] == "string" ? t.properties["data-language"] : void 0, c = typeof t?.properties?.["data-title"] == "string" ? t.properties["data-title"] : void 0, l = r.find((e) => e.startsWith("language-"))?.replace("language-", ""), u = typeof e.properties?.["data-language"] == "string" ? e.properties["data-language"] : void 0, d = typeof e.properties?.["data-title"] == "string" ? e.properties["data-title"] : void 0, f = t?.properties?.["data-expandable"] === "true" || r.includes("mdx-expandable-meta") || i?.includes("Expandable") === !0, p = t?.properties?.["data-expandable-lines"];
|
|
80
81
|
if (!f) return;
|
|
81
|
-
e.properties ||= {}, e.properties["data-expandable"] = "true", typeof p == "string" || typeof p == "number" ? e.properties["data-expandable-lines"] = p.toString() : e.raw && (e.properties["data-expandable-lines"] =
|
|
82
|
+
e.properties ||= {}, e.properties["data-expandable"] = "true", typeof p == "string" || typeof p == "number" ? e.properties["data-expandable-lines"] = p.toString() : e.raw && (e.properties["data-expandable-lines"] = T(e.raw).toString());
|
|
82
83
|
let m = s || a || l || u || e.language, h = c || o || d || e.codeTitle;
|
|
83
84
|
m && (e.properties["data-language"] = m), h && (e.properties["data-title"] = h);
|
|
84
85
|
let g = e.properties.className;
|
|
@@ -87,8 +88,8 @@ var T = () => (e) => {
|
|
|
87
88
|
t.properties.className = e;
|
|
88
89
|
}
|
|
89
90
|
});
|
|
90
|
-
},
|
|
91
|
-
|
|
91
|
+
}, O = () => (e) => {
|
|
92
|
+
c(e, "element", (e, t, n) => {
|
|
92
93
|
if (!n || t === null || e.tagName !== "pre") return;
|
|
93
94
|
let r = e.children?.find((e) => e.type === "element" && e.tagName === "code");
|
|
94
95
|
if (!r || !(Array.isArray(r.properties?.className) ? r.properties.className : typeof r.properties?.className == "string" ? r.properties.className.split(" ").filter(Boolean) : []).includes("language-mermaid")) return;
|
|
@@ -103,27 +104,27 @@ var T = () => (e) => {
|
|
|
103
104
|
};
|
|
104
105
|
//#endregion
|
|
105
106
|
//#region src/plugins/remarkDirectiveToMdx.ts
|
|
106
|
-
function
|
|
107
|
-
return (e) => {
|
|
108
|
-
let t = e;
|
|
109
|
-
return
|
|
107
|
+
function k() {
|
|
108
|
+
return (e, t) => {
|
|
109
|
+
let n = String(t), r = e;
|
|
110
|
+
return r.children = r.children.map((e) => M(e, n)), e;
|
|
110
111
|
};
|
|
111
112
|
}
|
|
112
|
-
var
|
|
113
|
-
function
|
|
113
|
+
var A = /* @__PURE__ */ new Set(["youtube"]);
|
|
114
|
+
function j(e) {
|
|
114
115
|
return e.type === "containerDirective" || e.type === "leafDirective" || e.type === "textDirective";
|
|
115
116
|
}
|
|
116
|
-
function
|
|
117
|
-
if (!
|
|
118
|
-
let
|
|
119
|
-
return Array.isArray(
|
|
117
|
+
function M(e, t) {
|
|
118
|
+
if (!j(e)) {
|
|
119
|
+
let n = e.children;
|
|
120
|
+
return Array.isArray(n) && (e.children = n.map((e) => M(e, t))), e;
|
|
120
121
|
}
|
|
121
|
-
return e.type === "textDirective" ? e.name === "tooltip" ?
|
|
122
|
+
return e.type === "textDirective" ? e.name === "tooltip" ? F(e) : P(e, t) : e.type === "leafDirective" && e.name === "tooltip" ? P(e, t) : N(e, e.type === "containerDirective" && !A.has(e.name) ? (e.children ?? []).map((e) => M(e, t)) : []);
|
|
122
123
|
}
|
|
123
|
-
function
|
|
124
|
+
function N(e, t) {
|
|
124
125
|
return {
|
|
125
126
|
type: "mdxJsxFlowElement",
|
|
126
|
-
name:
|
|
127
|
+
name: I(e.name),
|
|
127
128
|
attributes: Object.entries(e.attributes ?? {}).map(([e, t]) => ({
|
|
128
129
|
type: "mdxJsxAttribute",
|
|
129
130
|
name: e,
|
|
@@ -132,14 +133,14 @@ function M(e, t) {
|
|
|
132
133
|
children: t
|
|
133
134
|
};
|
|
134
135
|
}
|
|
135
|
-
function
|
|
136
|
-
let
|
|
137
|
-
return {
|
|
136
|
+
function P(e, t) {
|
|
137
|
+
let n = e.position?.start.offset, r = e.position?.end.offset;
|
|
138
|
+
return n === void 0 || r === void 0 ? e : {
|
|
138
139
|
type: "text",
|
|
139
|
-
value: t
|
|
140
|
+
value: t.slice(n, r)
|
|
140
141
|
};
|
|
141
142
|
}
|
|
142
|
-
function
|
|
143
|
+
function F(e) {
|
|
143
144
|
let t = (e.children ?? []).map((e) => e.value ?? "").join(""), n = e.attributes ?? {};
|
|
144
145
|
return {
|
|
145
146
|
type: "mdxJsxTextElement",
|
|
@@ -156,26 +157,26 @@ function P(e) {
|
|
|
156
157
|
children: []
|
|
157
158
|
};
|
|
158
159
|
}
|
|
159
|
-
function
|
|
160
|
+
function I(e) {
|
|
160
161
|
return e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("");
|
|
161
162
|
}
|
|
162
163
|
//#endregion
|
|
163
164
|
//#region src/mdx-compiler/index.ts
|
|
164
|
-
function
|
|
165
|
-
let [a, o] =
|
|
166
|
-
|
|
165
|
+
function L({ compiledSource: e, frontmatter: t, scope: n = {}, components: r = {}, lazy: i }) {
|
|
166
|
+
let [a, o] = v(!i || typeof window > "u");
|
|
167
|
+
g(() => {
|
|
167
168
|
if (!i) return;
|
|
168
169
|
let e = window.requestIdleCallback ? window.requestIdleCallback(() => o(!0), { timeout: 500 }) : setTimeout(() => o(!0), 1);
|
|
169
170
|
return () => {
|
|
170
171
|
window.cancelIdleCallback ? window.cancelIdleCallback(e) : clearTimeout(e);
|
|
171
172
|
};
|
|
172
173
|
}, [i]);
|
|
173
|
-
let s =
|
|
174
|
+
let s = _(() => {
|
|
174
175
|
let r = {
|
|
175
176
|
opts: {
|
|
176
|
-
...
|
|
177
|
-
...
|
|
178
|
-
...
|
|
177
|
+
...x,
|
|
178
|
+
...y,
|
|
179
|
+
...b
|
|
179
180
|
},
|
|
180
181
|
frontmatter: t,
|
|
181
182
|
...n
|
|
@@ -186,16 +187,16 @@ function I({ compiledSource: e, frontmatter: t, scope: n = {}, components: r = {
|
|
|
186
187
|
n,
|
|
187
188
|
t
|
|
188
189
|
]);
|
|
189
|
-
if (!a) return
|
|
190
|
+
if (!a) return h.createElement("div", {
|
|
190
191
|
dangerouslySetInnerHTML: { __html: "" },
|
|
191
192
|
suppressHydrationWarning: !0
|
|
192
193
|
});
|
|
193
|
-
let c =
|
|
194
|
-
return i ?
|
|
194
|
+
let c = h.createElement(x.MDXProvider, { components: r }, h.createElement(s, null));
|
|
195
|
+
return i ? h.createElement("div", null, c) : c;
|
|
195
196
|
}
|
|
196
197
|
//#endregion
|
|
197
198
|
//#region src/compile.ts
|
|
198
|
-
var
|
|
199
|
+
var R = () => (e) => (c(e, (e) => {
|
|
199
200
|
let t = e;
|
|
200
201
|
if (t?.type === "element" && t?.tagName === "pre" && t.children) {
|
|
201
202
|
let [e] = t.children;
|
|
@@ -205,72 +206,73 @@ var L = () => (e) => (s(e, (e) => {
|
|
|
205
206
|
let i = e.children[0];
|
|
206
207
|
i.type === "text" && i.value && (t.raw = i.value);
|
|
207
208
|
}
|
|
208
|
-
}), e),
|
|
209
|
+
}), e), z = () => (e) => (c(e, "element", (e) => {
|
|
209
210
|
let t = e;
|
|
210
211
|
t?.type === "element" && t?.tagName === "pre" && (t.properties && t.raw && (t.properties.raw = t.raw), t.properties && t.language && !t.properties["data-language"] && (t.properties["data-language"] = t.language), t.properties && t.codeTitle && !t.properties["data-title"] && (t.properties["data-title"] = t.codeTitle));
|
|
211
212
|
}), e);
|
|
212
|
-
function
|
|
213
|
+
function B() {
|
|
213
214
|
return [
|
|
214
|
-
|
|
215
|
+
R,
|
|
216
|
+
O,
|
|
217
|
+
p,
|
|
218
|
+
C,
|
|
219
|
+
D,
|
|
220
|
+
u,
|
|
215
221
|
D,
|
|
216
222
|
f,
|
|
217
|
-
S,
|
|
218
|
-
E,
|
|
219
|
-
l,
|
|
220
|
-
E,
|
|
221
223
|
d,
|
|
222
|
-
|
|
223
|
-
R
|
|
224
|
+
z
|
|
224
225
|
];
|
|
225
226
|
}
|
|
226
|
-
function
|
|
227
|
+
function V() {
|
|
227
228
|
return [
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
229
|
+
l,
|
|
230
|
+
E,
|
|
231
|
+
m,
|
|
232
|
+
k
|
|
232
233
|
];
|
|
233
234
|
}
|
|
234
235
|
//#endregion
|
|
235
|
-
//#region src/
|
|
236
|
-
|
|
236
|
+
//#region src/plugins/rehypeCollectTocs.ts
|
|
237
|
+
function H(e) {
|
|
238
|
+
let t = e;
|
|
239
|
+
return t.properties?.ariaHidden === !0 || t.properties?.ariaHidden === "true" ? "" : e.type === "text" ? e.value : t.children?.map(H).join("") ?? "";
|
|
240
|
+
}
|
|
237
241
|
function U(e) {
|
|
238
|
-
return
|
|
242
|
+
return (t) => {
|
|
243
|
+
e.length = 0, c(t, "element", (t) => {
|
|
244
|
+
!/^h[2-4]$/.test(t.tagName ?? "") || typeof t.properties?.id != "string" || e.push({
|
|
245
|
+
level: Number(t.tagName.slice(1)),
|
|
246
|
+
text: H(t),
|
|
247
|
+
href: `#${t.properties.id}`
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
};
|
|
239
251
|
}
|
|
252
|
+
//#endregion
|
|
253
|
+
//#region src/extract.ts
|
|
240
254
|
function W(e) {
|
|
241
|
-
|
|
242
|
-
for (let e of n) {
|
|
243
|
-
let n = e.trimStart(), a = V.exec(n);
|
|
244
|
-
if (a) {
|
|
245
|
-
let e = a[1];
|
|
246
|
-
r ? e.length === i && (r = !1) : (r = !0, i = e.length);
|
|
247
|
-
continue;
|
|
248
|
-
}
|
|
249
|
-
if (r) continue;
|
|
250
|
-
let o = H.exec(n);
|
|
251
|
-
if (o) {
|
|
252
|
-
let e = o[1].length, n = o[2].trim().replace(/\s+#+\s*$/, "");
|
|
253
|
-
t.push({
|
|
254
|
-
level: e,
|
|
255
|
-
text: n,
|
|
256
|
-
href: `#${U(n)}`
|
|
257
|
-
});
|
|
258
|
-
continue;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
return t;
|
|
255
|
+
return e.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "");
|
|
262
256
|
}
|
|
263
257
|
function G(e) {
|
|
258
|
+
let t = [];
|
|
259
|
+
return s(S(e).content, {
|
|
260
|
+
format: "md",
|
|
261
|
+
remarkPlugins: V(),
|
|
262
|
+
rehypePlugins: [f, [U, t]]
|
|
263
|
+
}), t;
|
|
264
|
+
}
|
|
265
|
+
function K(e) {
|
|
264
266
|
try {
|
|
265
|
-
return
|
|
267
|
+
return S(e).data;
|
|
266
268
|
} catch (e) {
|
|
267
269
|
let t = e instanceof Error ? e.message : String(e);
|
|
268
270
|
throw Error(`Failed to extract frontmatter: ${t}`, { cause: e });
|
|
269
271
|
}
|
|
270
272
|
}
|
|
271
|
-
function
|
|
273
|
+
function q(e, t) {
|
|
272
274
|
try {
|
|
273
|
-
let { data: n, content: r } =
|
|
275
|
+
let { data: n, content: r } = S(e);
|
|
274
276
|
return {
|
|
275
277
|
frontmatter: t ? t.parse(n) : n,
|
|
276
278
|
strippedContent: r
|
|
@@ -281,6 +283,6 @@ function K(e, t) {
|
|
|
281
283
|
}
|
|
282
284
|
}
|
|
283
285
|
//#endregion
|
|
284
|
-
export {
|
|
286
|
+
export { L as MDXRemote, e as cn, B as createDefaultRehypePlugins, V as createDefaultRemarkPlugins, K as extractFrontmatter, q as extractFrontmatterWithContent, G as extractTocsFromRawMdx, t as formatDate, n as formatDate2, D as handleCodeExpandable, E as handleCodeExpandableRemark, C as handleCodeTitles, r as parseDate, z as postProcess, R as preProcess, U as rehypeCollectTocs, O as rehypeMermaid, k as remarkDirectiveToMdx, o as serialize, W as sluggify, i as stringToDate, a as toIsoDateOnly };
|
|
285
287
|
|
|
286
288
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/plugins/handleCodeTitles.ts","../src/plugins/handleCodeExpandable.ts","../src/plugins/rehypeMermaid.ts","../src/plugins/remarkDirectiveToMdx.ts","../src/mdx-compiler/index.ts","../src/compile.ts","../src/extract.ts"],"sourcesContent":["import type { Node, Parent } from \"unist\";\nimport { visit } from \"unist-util-visit\";\nimport type { ElementNode } from \"../utils\";\n\ninterface TextNode extends Node {\n type: \"text\";\n value: string;\n}\n\nexport const handleCodeTitles = () => (tree: Node) => {\n const toRemove: { parent: Parent; index: number }[] = [];\n\n visit(tree, \"element\", (node: ElementNode, index: number | null, parent: Parent | null) => {\n if (!parent || index === null || node.tagName !== \"div\") {\n return;\n }\n\n const isTitleDiv = node.properties?.className?.includes(\"rehype-code-title\");\n if (!isTitleDiv) {\n return;\n }\n\n let nextElement: ElementNode | null = null;\n for (let i = index + 1; i < parent.children.length; i++) {\n const sibling = parent.children[i];\n if (sibling.type === \"element\") {\n nextElement = sibling as ElementNode;\n break;\n }\n }\n\n if (nextElement?.tagName === \"pre\") {\n const titleNode = node.children?.[0] as TextNode;\n if (titleNode?.type === \"text\") {\n if (!nextElement.properties) {\n nextElement.properties = {};\n }\n nextElement.properties[\"data-title\"] = titleNode.value;\n nextElement.codeTitle = titleNode.value;\n toRemove.push({ parent, index });\n }\n }\n });\n\n // Remove title divs in reverse order to preserve indices\n for (let i = toRemove.length - 1; i >= 0; i--) {\n const { parent, index } = toRemove[i];\n parent.children.splice(index, 1);\n }\n};\n","import type { Node } from \"unist\";\nimport { visit } from \"unist-util-visit\";\nimport type { ElementNode } from \"../utils\";\n\n/**\n * Escape metadata values that are interpolated into MDX-compiled JavaScript.\n *\n * References:\n * - HTML spec (script data state): escape `</` as `\\u003C/` to prevent premature\n * `</script>` closing when the compiled JS is embedded as JSON in a <script> tag.\n * - Bun.escapeHTML(): escapes `< > \" ' &` for HTML context; for JS/JSON context\n * we use `\\uXXXX` JSON Unicode escapes instead so the value survives round-trip\n * through JSON.parse on the client side.\n * - React: JSX auto-escapes attribute values via `{expression}`, so values set\n * as HAST properties (data-language, data-title) are HTML-safe at render time.\n */\nfunction escapeMeta(s: string): string {\n let out = \"\";\n for (let i = 0; i < s.length; i++) {\n const ch = s[i];\n\n // HTML spec: prevent </script> in script/JSON context\n if (ch === \"<\" && s[i + 1] === \"/\") {\n out += \"\\\\u003C/\";\n i++;\n continue;\n }\n\n // JS string: escape template literal & string special chars\n if (ch === \"`\" || ch === \"$\" || ch === \"{\" || ch === \"}\" || ch === '\"' || ch === \"\\\\\") {\n out += `\\\\${ch}`;\n continue;\n }\n\n out += ch;\n }\n return out;\n}\n\ninterface CodeNode extends Node {\n type: \"code\";\n lang?: string;\n meta?: string;\n value: string;\n data?: {\n meta?: string;\n hProperties?: Record<string, unknown>;\n };\n}\n\nfunction countCodeLines(raw: string): number {\n let normalized = raw.replace(/\\r\\n/g, \"\\n\");\n if (normalized.startsWith(\"\\n\")) normalized = normalized.slice(1);\n if (normalized.endsWith(\"\\n\")) normalized = normalized.slice(0, -1);\n\n if (normalized.length === 0) return 0;\n return normalized.split(\"\\n\").length;\n}\n\nexport const handleCodeExpandableRemark = () => (tree: Node) => {\n visit(tree, \"code\", (node: CodeNode) => {\n if (!node.meta) return;\n\n const isExpandable = node.meta.includes(\"Expandable\");\n const [languagePart, titlePart] = (node.lang ?? \"\").split(\":\");\n const normalizedLanguage = languagePart?.trim();\n const normalizedTitle = titlePart?.trim();\n\n if (!isExpandable) return;\n\n const lineCount = countCodeLines(node.value);\n\n if (!node.data) {\n node.data = {};\n }\n if (!node.data.hProperties) {\n node.data.hProperties = {};\n }\n\n node.data.hProperties[\"data-expandable\"] = \"true\";\n node.data.hProperties[\"data-expandable-lines\"] = lineCount.toString();\n\n if (normalizedLanguage) {\n node.data.hProperties[\"data-language\"] = normalizedLanguage;\n }\n if (normalizedTitle) {\n node.data.hProperties[\"data-title\"] = normalizedTitle;\n }\n\n const currentClassName = node.data.hProperties.className;\n const classList = Array.isArray(currentClassName)\n ? currentClassName\n : typeof currentClassName === \"string\"\n ? currentClassName.split(\" \").filter(Boolean)\n : [];\n\n if (!classList.includes(\"mdx-expandable-meta\")) {\n classList.push(\"mdx-expandable-meta\");\n }\n\n node.data.hProperties.className = classList;\n\n if (normalizedLanguage && !node.meta.includes(\"dbLang(\")) {\n node.meta = `${node.meta} dbLang(${escapeMeta(normalizedLanguage)})`.trim();\n }\n if (normalizedTitle && !node.meta.includes(\"dbTitle(\")) {\n node.meta = `${node.meta} dbTitle(${escapeMeta(normalizedTitle)})`.trim();\n }\n });\n};\n\nexport const handleCodeExpandable = () => (tree: Node) => {\n visit(tree, \"element\", (node: ElementNode) => {\n if (node.tagName !== \"pre\") return;\n\n const codeElement = node.children?.find((child) => {\n const element = child as ElementNode;\n return element.type === \"element\" && element.tagName === \"code\";\n }) as ElementNode | undefined;\n\n const codeClassName = codeElement?.properties?.className;\n const codeClassList = Array.isArray(codeClassName)\n ? codeClassName\n : typeof codeClassName === \"string\"\n ? codeClassName.split(\" \").filter(Boolean)\n : [];\n\n const codeMeta =\n codeElement?.data &&\n typeof codeElement.data === \"object\" &&\n typeof codeElement.data[\"meta\"] === \"string\"\n ? (codeElement.data[\"meta\"] as string)\n : undefined;\n\n const languageFromMeta = codeMeta?.match(/dbLang\\(([^)]+)\\)/)?.[1];\n const titleFromMeta = codeMeta?.match(/dbTitle\\(([^)]+)\\)/)?.[1];\n\n const languageFromProps =\n typeof codeElement?.properties?.[\"data-language\"] === \"string\"\n ? (codeElement.properties[\"data-language\"] as string)\n : undefined;\n const titleFromProps =\n typeof codeElement?.properties?.[\"data-title\"] === \"string\"\n ? (codeElement.properties[\"data-title\"] as string)\n : undefined;\n\n const languageFromCodeClass = codeClassList\n .find((item) => item.startsWith(\"language-\"))\n ?.replace(\"language-\", \"\");\n\n const existingPreLanguage =\n typeof node.properties?.[\"data-language\"] === \"string\"\n ? (node.properties[\"data-language\"] as string)\n : undefined;\n const existingPreTitle =\n typeof node.properties?.[\"data-title\"] === \"string\"\n ? (node.properties[\"data-title\"] as string)\n : undefined;\n\n const isExpandable =\n codeElement?.properties?.[\"data-expandable\"] === \"true\" ||\n codeClassList.includes(\"mdx-expandable-meta\") ||\n codeMeta?.includes(\"Expandable\") === true;\n\n const expandableLines = codeElement?.properties?.[\"data-expandable-lines\"];\n if (!isExpandable) return;\n\n if (!node.properties) {\n node.properties = {};\n }\n\n node.properties[\"data-expandable\"] = \"true\";\n if (typeof expandableLines === \"string\" || typeof expandableLines === \"number\") {\n node.properties[\"data-expandable-lines\"] = expandableLines.toString();\n } else if (node.raw) {\n node.properties[\"data-expandable-lines\"] = countCodeLines(node.raw).toString();\n }\n\n const resolvedLanguage =\n languageFromProps ||\n languageFromMeta ||\n languageFromCodeClass ||\n existingPreLanguage ||\n node.language;\n const resolvedTitle = titleFromProps || titleFromMeta || existingPreTitle || node.codeTitle;\n\n if (resolvedLanguage) {\n node.properties[\"data-language\"] = resolvedLanguage;\n }\n if (resolvedTitle) {\n node.properties[\"data-title\"] = resolvedTitle;\n }\n\n const className = node.properties.className;\n if (!className) {\n node.properties.className = [];\n }\n\n if (Array.isArray(node.properties.className)) {\n if (!node.properties.className.includes(\"mdx-expandable-code\")) {\n node.properties.className.push(\"mdx-expandable-code\");\n }\n } else if (typeof className === \"string\") {\n const hasMarker = className.split(\" \").includes(\"mdx-expandable-code\");\n if (!hasMarker) {\n node.properties.className = `${className} mdx-expandable-code`.trim().split(\" \");\n }\n } else {\n node.properties.className = [\"mdx-expandable-code\"];\n }\n\n if (codeElement?.properties) {\n const cleanedCodeClassList = codeClassList.filter((item) => item !== \"mdx-expandable-meta\");\n codeElement.properties.className = cleanedCodeClassList;\n }\n });\n};\n","import type { Node, Parent } from \"unist\";\nimport { visit } from \"unist-util-visit\";\nimport type { ElementNode } from \"../utils\";\n\ninterface TextNode extends Node {\n type: \"text\";\n value: string;\n}\n\n/**\n * Rehype plugin that transforms `<pre><code class=\"language-mermaid\">` fenced\n * blocks into `<Mermaid chart=\"...\">` elements.\n *\n * This allows Mermaid diagram definitions to be authored via standard fenced\n * code blocks (````mermaid) which avoids JSX parsing collisions with\n * Mermaid's `{...}` (decision nodes) and `[...]` (label nodes) syntax.\n */\nexport const rehypeMermaid = () => (tree: Node) => {\n visit(tree, \"element\", (node: ElementNode, index: number | null, parent: Parent | null) => {\n if (!parent || index === null || node.tagName !== \"pre\") return;\n\n const codeEl = node.children?.find(\n (child) =>\n (child as ElementNode).type === \"element\" && (child as ElementNode).tagName === \"code\"\n ) as ElementNode | undefined;\n\n if (!codeEl) return;\n\n const classList = Array.isArray(codeEl.properties?.className)\n ? (codeEl.properties.className as string[])\n : typeof codeEl.properties?.className === \"string\"\n ? (codeEl.properties.className as string).split(\" \").filter(Boolean)\n : [];\n\n if (!classList.includes(\"language-mermaid\")) return;\n\n const textNode = codeEl.children?.find((child) => (child as TextNode).type === \"text\") as\n TextNode | undefined;\n\n const chart = textNode?.value ?? \"\";\n\n parent.children[index] = {\n type: \"element\",\n tagName: \"Mermaid\",\n properties: { chart },\n children: [],\n } as unknown as ElementNode;\n });\n};\n","import type { Node } from \"unist\";\n\n/**\n * Remark plugin: convert markdown directives into MDX component elements.\n *\n * Contract (docubook):\n * - `:::name{attrs} … :::` — container: EVERY component that holds content\n * (tabs, tab, accordions, accordion, steps, step, cards, card, files,\n * folder, note + variants). Children are the block between the opening\n * `:::` and closing `:::` — bounded by micromark's container grammar, so\n * a component can never trap siblings that follow it.\n * - `::name{attrs}` — self-closing leaf (no children): file, youtube,\n * mermaid.\n * - `:tooltip[label]{tip=\"…\"}` — the ONE inline (single-colon) directive.\n * Every other text directive is rebuilt as literal text\n * (`localhost:3000` stays intact). `::tooltip` (block leaf) is removed\n * in v2 — tooltips are inline only.\n *\n * Names are PascalCased to match the components map (`file-tree` → `FileTree`).\n * Bare attributes (`{horizontal}`) become boolean props (JSX bare attribute).\n * Callout variants (`:::tip`, `:::info`, …) map to their own registry entries\n * (`Tip`/`Info`/…) which wrap the `Callout` component with the type set.\n */\nexport function remarkDirectiveToMdx() {\n return (tree: Node) => {\n const root = tree as unknown as { children: Node[] };\n root.children = root.children.map(transform);\n return tree;\n };\n}\n\n/** Leaves that never hold children (self-closing). */\nconst PURE_LEAVES = new Set([\"youtube\"]);\n\ntype DirectiveNode = Node & {\n type: \"containerDirective\" | \"leafDirective\" | \"textDirective\";\n name: string;\n label?: string;\n attributes?: Record<string, string>;\n children?: Node[];\n};\n\nfunction isDirective(node: Node): node is DirectiveNode {\n return (\n node.type === \"containerDirective\" ||\n node.type === \"leafDirective\" ||\n node.type === \"textDirective\"\n );\n}\n\nfunction transform(node: Node): Node {\n if (!isDirective(node)) {\n const children = (node as unknown as { children?: Node[] }).children;\n if (Array.isArray(children)) {\n (node as unknown as { children: Node[] }).children = children.map(transform);\n }\n return node;\n }\n if (node.type === \"textDirective\") {\n // `:tooltip[label]{tip=\"…\"}` is the one inline component — it stays\n // inside the paragraph. Every other single-colon text directive is\n // rebuilt as literal text (`localhost:3000` stays intact).\n if (node.name === \"tooltip\") {\n return inlineTooltip(node);\n }\n return literalDirective(node);\n }\n // Block-form tooltips are gone in v2 — degrade to literal text so the\n // author sees the directive instead of a broken component.\n if (node.type === \"leafDirective\" && node.name === \"tooltip\") {\n return literalDirective(node);\n }\n // containerDirective → component with children; leafDirective → self-closing.\n const children =\n node.type === \"containerDirective\" && !PURE_LEAVES.has(node.name)\n ? (node.children ?? []).map(transform)\n : [];\n return directiveToElement(node, children);\n}\n\nfunction directiveToElement(directive: DirectiveNode, children: Node[]): Node {\n const name = pascalCase(directive.name);\n const attributes = Object.entries(directive.attributes ?? {}).map(([attrName, value]) => ({\n type: \"mdxJsxAttribute\",\n name: attrName,\n value: value === \"\" ? null : value,\n }));\n return {\n type: \"mdxJsxFlowElement\",\n name,\n attributes,\n children,\n } as Node;\n}\n\n/** Rebuild a text directive as literal text (single-colon is not a contract). */\nfunction literalDirective(directive: DirectiveNode): Node {\n const literal = \":\" + directive.name + (directive.label ? `[${directive.label}]` : \"\");\n const attrStr = Object.entries(directive.attributes ?? {})\n .map(([k, v]) => (v === \"\" ? k : `${k}=\"${v}\"`))\n .join(\" \");\n return { type: \"text\", value: literal + (attrStr ? `{${attrStr}}` : \"\") } as Node;\n}\n\n/**\n * Inline tooltip from a text directive: `:tooltip[label]{tip=\"…\"}`.\n * The label is the visible trigger (dotted underline); `tip` is the hover\n * bubble and defaults to the label, so `:tooltip[text]` alone already shows\n * a bubble. Emits an inline element so it stays inside the paragraph. The\n * bubble auto-positions (no `side` prop).\n */\nfunction inlineTooltip(directive: DirectiveNode): Node {\n const label = (directive.children ?? [])\n .map((child) => (child as { value?: string }).value ?? \"\")\n .join(\"\");\n const attrs = directive.attributes ?? {};\n const attributes = [\n { type: \"mdxJsxAttribute\", name: \"text\", value: attrs.text || label || \"?\" },\n { type: \"mdxJsxAttribute\", name: \"tip\", value: attrs.tip || label || \"\" },\n ];\n return { type: \"mdxJsxTextElement\", name: \"Tooltip\", attributes, children: [] } as Node;\n}\n\nfunction pascalCase(name: string): string {\n return name\n .split(\"-\")\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join(\"\");\n}\n","// MPL-2.0 — derived from next-mdx-remote (IBM). See LICENSE-MPL-2.0.\nimport React, { useEffect, useState, useMemo } from \"react\";\nimport * as jsxRuntime from \"react/jsx-runtime\";\nimport * as jsxDevRuntime from \"react/jsx-dev-runtime\";\nimport * as mdx from \"@mdx-js/react\";\nimport type { MDXRemoteSerializeResult } from \"./types.js\";\n\n/** Props for the client-side `<MDXRemote>` (accepts pre-serialized result). */\nexport type MDXRemoteProps = MDXRemoteSerializeResult & {\n components?: Record<string, React.ComponentType<any>>;\n /** Defer hydration to an idle callback */\n lazy?: boolean;\n};\n\n/**\n * Client-side MDX renderer.\n *\n * Accepts a pre-compiled result from `serialize()` and renders it via\n * `MDXProvider` for custom component injection.\n */\nexport function MDXRemote({\n compiledSource,\n frontmatter,\n scope = {},\n components = {},\n lazy,\n}: MDXRemoteProps): React.ReactElement {\n const [ready, setReady] = useState(!lazy || typeof window === \"undefined\");\n\n useEffect(() => {\n if (!lazy) return;\n const id = window.requestIdleCallback\n ? window.requestIdleCallback(() => setReady(true), { timeout: 500 })\n : setTimeout(() => setReady(true), 1);\n return () => {\n if (window.cancelIdleCallback) window.cancelIdleCallback(id as number);\n else clearTimeout(id as number);\n };\n }, [lazy]);\n\n const Content = useMemo(() => {\n // Non-RSC mode: compiled MDX expects `useMDXComponents` (\n // from @mdx-js/react) AND the JSX runtime.\n // In React 19, jsx/jsxs and jsxDEV live in separate modules,\n // so merge both to handle compiled output from any mode.\n const fullScope = {\n opts: { ...mdx, ...jsxRuntime, ...jsxDevRuntime },\n frontmatter,\n ...scope,\n };\n const keys = Object.keys(fullScope);\n const values = Object.values(fullScope);\n const fn = Reflect.construct(Function, keys.concat(`${compiledSource}`));\n return fn.apply(fn, values).default;\n }, [compiledSource, scope, frontmatter]);\n\n if (!ready) {\n return React.createElement(\"div\", {\n dangerouslySetInnerHTML: { __html: \"\" },\n suppressHydrationWarning: true,\n });\n }\n\n const content = React.createElement(\n mdx.MDXProvider,\n { components },\n React.createElement(Content, null)\n );\n\n return lazy ? React.createElement(\"div\", null, content) : content;\n}\n","import { serialize } from \"./mdx-compiler/serialize.js\";\nimport type { Node } from \"unist\";\nimport { visit } from \"unist-util-visit\";\nimport remarkGfm from \"remark-gfm\";\nimport rehypePrism from \"rehype-prism-plus\";\nimport rehypeAutolinkHeadings from \"rehype-autolink-headings\";\nimport rehypeSlug from \"rehype-slug\";\nimport rehypeCodeTitles from \"rehype-code-titles\";\nimport { handleCodeTitles } from \"./plugins/handleCodeTitles\";\nimport { handleCodeExpandableRemark, handleCodeExpandable } from \"./plugins/handleCodeExpandable\";\nimport { rehypeMermaid } from \"./plugins/rehypeMermaid\";\nimport { remarkDirectiveToMdx } from \"./plugins/remarkDirectiveToMdx\";\nimport remarkDirective from \"remark-directive\";\nimport type { ElementNode } from \"./utils\";\nimport type { Pluggable } from \"unified\";\n\n// Re-export serialize for non-RSC usage\nexport { serialize };\n\n// Re-export MDXRemote for client-side hydration\nexport { MDXRemote } from \"./mdx-compiler/index.js\";\n\ninterface TextNode extends Node {\n type: \"text\";\n value: string;\n}\n\nexport const preProcess = () => (tree: Node) => {\n visit(tree, (node: Node) => {\n const element = node as ElementNode;\n if (element?.type === \"element\" && element?.tagName === \"pre\" && element.children) {\n const [codeEl] = element.children as ElementNode[];\n if (codeEl.tagName !== \"code\" || !codeEl.children?.[0]) return;\n\n const className = codeEl.properties?.className;\n const classList = Array.isArray(className)\n ? className\n : typeof className === \"string\"\n ? className.split(\" \").filter(Boolean)\n : [];\n const languageClass = classList.find((item: string) => item.startsWith(\"language-\"));\n if (languageClass) {\n element.language = languageClass.replace(\"language-\", \"\").split(\":\")[0];\n }\n\n const textNode = codeEl.children[0] as TextNode;\n if (textNode.type === \"text\" && textNode.value) {\n element.raw = textNode.value;\n }\n }\n });\n\n return tree;\n};\n\nexport const postProcess = () => (tree: Node) => {\n visit(tree, \"element\", (node: Node) => {\n const element = node as ElementNode;\n if (element?.type === \"element\" && element?.tagName === \"pre\") {\n if (element.properties && element.raw) {\n element.properties.raw = element.raw;\n }\n if (element.properties && element.language && !element.properties[\"data-language\"]) {\n element.properties[\"data-language\"] = element.language;\n }\n if (element.properties && element.codeTitle && !element.properties[\"data-title\"]) {\n element.properties[\"data-title\"] = element.codeTitle;\n }\n }\n });\n\n return tree;\n};\n\nexport function createDefaultRehypePlugins(): Pluggable[] {\n return [\n preProcess,\n rehypeMermaid, // Transform ```mermaid before code transforms\n rehypeCodeTitles,\n handleCodeTitles,\n handleCodeExpandable, // Copy expandable metadata from <code> to <pre> before prism transforms nodes.\n rehypePrism,\n handleCodeExpandable, // Re-apply expandable attrs after prism tokenization.\n rehypeSlug,\n rehypeAutolinkHeadings,\n postProcess,\n ];\n}\n\nexport function createDefaultRemarkPlugins(): Pluggable[] {\n return [remarkGfm, handleCodeExpandableRemark, remarkDirective, remarkDirectiveToMdx];\n}\n","import matter from \"@11ty/gray-matter\";\nimport type { ZodType } from \"zod\";\nimport type { TocItem } from \"./types\";\n\nconst FENCE_MARKER_REGEX = /^(````|```)(?!`)/;\nconst HEADING_REGEX = /^(#{2,4})\\s+(.+)$/;\n\nexport function sluggify(text: string): string {\n const normalized = text.normalize(\"NFD\").replace(/[\\u0300-\\u036f]/g, \"\"); // Remove accents\n const slug = normalized.toLowerCase().replace(/\\s+/g, \"-\");\n return slug.replace(/[^a-z0-9-]/g, \"\");\n}\n\nexport function extractTocsFromRawMdx(rawMdx: string): TocItem[] {\n const extractedHeadings: TocItem[] = [];\n\n const lines = rawMdx.split(/\\r?\\n/);\n let inFence = false;\n let fenceLength = 0;\n\n for (const line of lines) {\n const trimmed = line.trimStart();\n\n const fenceMatch = FENCE_MARKER_REGEX.exec(trimmed);\n if (fenceMatch) {\n const marker = fenceMatch[1];\n\n if (!inFence) {\n inFence = true;\n fenceLength = marker.length;\n } else if (marker.length === fenceLength) {\n inFence = false;\n }\n\n continue;\n }\n\n if (inFence) {\n continue;\n }\n\n const headingMatch = HEADING_REGEX.exec(trimmed);\n if (headingMatch) {\n const headingLevel = headingMatch[1].length;\n const headingText = headingMatch[2].trim().replace(/\\s+#+\\s*$/, \"\");\n extractedHeadings.push({\n level: headingLevel,\n text: headingText,\n href: `#${sluggify(headingText)}`,\n });\n continue;\n }\n }\n\n return extractedHeadings;\n}\n\nexport function extractFrontmatter<Frontmatter>(content: string): Frontmatter {\n try {\n return matter(content).data as Frontmatter;\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n throw new Error(`Failed to extract frontmatter: ${reason}`, { cause: error });\n }\n}\n\n/**\n * Extract frontmatter and return both the parsed data and the content\n * with the frontmatter block stripped. Avoids a second parse during\n * compilation.\n *\n * Optionally validates the parsed frontmatter with a Zod schema.\n * YAML coerces unquoted values (e.g. `date: 2026-06-10` → Date, `3.5` → number),\n * so use `z.coerce.*` for fields that must remain strings.\n */\nexport function extractFrontmatterWithContent<Frontmatter>(content: string): {\n frontmatter: Frontmatter;\n strippedContent: string;\n};\nexport function extractFrontmatterWithContent<Frontmatter>(\n content: string,\n schema: ZodType<Frontmatter>\n): { frontmatter: Frontmatter; strippedContent: string };\nexport function extractFrontmatterWithContent<Frontmatter>(\n content: string,\n schema?: ZodType<Frontmatter>\n): { frontmatter: Frontmatter; strippedContent: string } {\n try {\n const { data, content: strippedContent } = matter(content);\n return {\n frontmatter: schema ? schema.parse(data) : (data as Frontmatter),\n strippedContent,\n };\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n throw new Error(`Failed to extract frontmatter: ${reason}`, { cause: error });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AASA,IAAa,WAA0B,MAAe;CACpD,IAAM,IAAgD,CAAC;CAEvD,EAAM,GAAM,YAAY,GAAmB,GAAsB,MAA0B;EAMzF,IALI,CAAC,KAAU,MAAU,QAAQ,EAAK,YAAY,SAK9C,CADe,EAAK,YAAY,WAAW,SAAS,mBAAmB,GAEzE;EAGF,IAAI,IAAkC;EACtC,KAAK,IAAI,IAAI,IAAQ,GAAG,IAAI,EAAO,SAAS,QAAQ,KAAK;GACvD,IAAM,IAAU,EAAO,SAAS;GAChC,IAAI,EAAQ,SAAS,WAAW;IAC9B,IAAc;IACd;GACF;EACF;EAEA,IAAI,GAAa,YAAY,OAAO;GAClC,IAAM,IAAY,EAAK,WAAW;GAClC,AAAI,GAAW,SAAS,WACjB,EAAY,eACf,EAAY,aAAa,CAAC,IAE5B,EAAY,WAAW,gBAAgB,EAAU,OACjD,EAAY,YAAY,EAAU,OAClC,EAAS,KAAK;IAAE;IAAQ;GAAM,CAAC;EAEnC;CACF,CAAC;CAGD,KAAK,IAAI,IAAI,EAAS,SAAS,GAAG,KAAK,GAAG,KAAK;EAC7C,IAAM,EAAE,WAAQ,aAAU,EAAS;EACnC,EAAO,SAAS,OAAO,GAAO,CAAC;CACjC;AACF;;;ACjCA,SAAS,EAAW,GAAmB;CACrC,IAAI,IAAM;CACV,KAAK,IAAI,IAAI,GAAG,IAAI,EAAE,QAAQ,KAAK;EACjC,IAAM,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ACV,IAAc,EAAO;GAKvB;EACF;EAEA,IAAI,GACF;EAGF,IAAM,IAAe,EAAc,KAAK,CAAO;EAC/C,IAAI,GAAc;GAChB,IAAM,IAAe,EAAa,EAAE,CAAC,QAC/B,IAAc,EAAa,EAAE,CAAC,KAAK,CAAC,CAAC,QAAQ,aAAa,EAAE;GAClE,EAAkB,KAAK;IACrB,OAAO;IACP,MAAM;IACN,MAAM,IAAI,EAAS,CAAW;GAChC,CAAC;GACD;EACF;CACF;CAEA,OAAO;AACT;AAEA,SAAgB,EAAgC,GAA8B;CAC5E,IAAI;EACF,OAAO,EAAO,CAAO,CAAC,CAAC;CACzB,SAAS,GAAO;EACd,IAAM,IAAS,aAAiB,QAAQ,EAAM,UAAU,OAAO,CAAK;EACpE,MAAU,MAAM,kCAAkC,KAAU,EAAE,OAAO,EAAM,CAAC;CAC9E;AACF;AAmBA,SAAgB,EACd,GACA,GACuD;CACvD,IAAI;EACF,IAAM,EAAE,SAAM,SAAS,MAAoB,EAAO,CAAO;EACzD,OAAO;GACL,aAAa,IAAS,EAAO,MAAM,CAAI,IAAK;GAC5C;EACF;CACF,SAAS,GAAO;EACd,IAAM,IAAS,aAAiB,QAAQ,EAAM,UAAU,OAAO,CAAK;EACpE,MAAU,MAAM,kCAAkC,KAAU,EAAE,OAAO,EAAM,CAAC;CAC9E;AACF"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/plugins/handleCodeTitles.ts","../src/plugins/handleCodeExpandable.ts","../src/plugins/rehypeMermaid.ts","../src/plugins/remarkDirectiveToMdx.ts","../src/mdx-compiler/index.ts","../src/compile.ts","../src/plugins/rehypeCollectTocs.ts","../src/extract.ts"],"sourcesContent":["import type { Node, Parent } from \"unist\";\nimport { visit } from \"unist-util-visit\";\nimport type { ElementNode } from \"../utils\";\n\ninterface TextNode extends Node {\n type: \"text\";\n value: string;\n}\n\nexport const handleCodeTitles = () => (tree: Node) => {\n const toRemove: { parent: Parent; index: number }[] = [];\n\n visit(tree, \"element\", (node: ElementNode, index: number | null, parent: Parent | null) => {\n if (!parent || index === null || node.tagName !== \"div\") {\n return;\n }\n\n const isTitleDiv = node.properties?.className?.includes(\"rehype-code-title\");\n if (!isTitleDiv) {\n return;\n }\n\n let nextElement: ElementNode | null = null;\n for (let i = index + 1; i < parent.children.length; i++) {\n const sibling = parent.children[i];\n if (sibling.type === \"element\") {\n nextElement = sibling as ElementNode;\n break;\n }\n }\n\n if (nextElement?.tagName === \"pre\") {\n const titleNode = node.children?.[0] as TextNode;\n if (titleNode?.type === \"text\") {\n if (!nextElement.properties) {\n nextElement.properties = {};\n }\n nextElement.properties[\"data-title\"] = titleNode.value;\n nextElement.codeTitle = titleNode.value;\n toRemove.push({ parent, index });\n }\n }\n });\n\n // Remove title divs in reverse order to preserve indices\n for (let i = toRemove.length - 1; i >= 0; i--) {\n const { parent, index } = toRemove[i];\n parent.children.splice(index, 1);\n }\n};\n","import type { Node } from \"unist\";\nimport { visit } from \"unist-util-visit\";\nimport type { ElementNode } from \"../utils\";\n\n/**\n * Escape metadata values that are interpolated into MDX-compiled JavaScript.\n *\n * References:\n * - HTML spec (script data state): escape `</` as `\\u003C/` to prevent premature\n * `</script>` closing when the compiled JS is embedded as JSON in a <script> tag.\n * - Bun.escapeHTML(): escapes `< > \" ' &` for HTML context; for JS/JSON context\n * we use `\\uXXXX` JSON Unicode escapes instead so the value survives round-trip\n * through JSON.parse on the client side.\n * - React: JSX auto-escapes attribute values via `{expression}`, so values set\n * as HAST properties (data-language, data-title) are HTML-safe at render time.\n */\nfunction escapeMeta(s: string): string {\n let out = \"\";\n for (let i = 0; i < s.length; i++) {\n const ch = s[i];\n\n // HTML spec: prevent </script> in script/JSON context\n if (ch === \"<\" && s[i + 1] === \"/\") {\n out += \"\\\\u003C/\";\n i++;\n continue;\n }\n\n // JS string: escape template literal & string special chars\n if (ch === \"`\" || ch === \"$\" || ch === \"{\" || ch === \"}\" || ch === '\"' || ch === \"\\\\\") {\n out += `\\\\${ch}`;\n continue;\n }\n\n out += ch;\n }\n return out;\n}\n\ninterface CodeNode extends Node {\n type: \"code\";\n lang?: string;\n meta?: string;\n value: string;\n data?: {\n meta?: string;\n hProperties?: Record<string, unknown>;\n };\n}\n\nfunction countCodeLines(raw: string): number {\n let normalized = raw.replace(/\\r\\n/g, \"\\n\");\n if (normalized.startsWith(\"\\n\")) normalized = normalized.slice(1);\n if (normalized.endsWith(\"\\n\")) normalized = normalized.slice(0, -1);\n\n if (normalized.length === 0) return 0;\n return normalized.split(\"\\n\").length;\n}\n\nexport const handleCodeExpandableRemark = () => (tree: Node) => {\n visit(tree, \"code\", (node: CodeNode) => {\n if (!node.meta) return;\n\n const isExpandable = node.meta.includes(\"Expandable\");\n const [languagePart, titlePart] = (node.lang ?? \"\").split(\":\");\n const normalizedLanguage = languagePart?.trim();\n const normalizedTitle = titlePart?.trim();\n\n if (!isExpandable) return;\n\n const lineCount = countCodeLines(node.value);\n\n if (!node.data) {\n node.data = {};\n }\n if (!node.data.hProperties) {\n node.data.hProperties = {};\n }\n\n node.data.hProperties[\"data-expandable\"] = \"true\";\n node.data.hProperties[\"data-expandable-lines\"] = lineCount.toString();\n\n if (normalizedLanguage) {\n node.data.hProperties[\"data-language\"] = normalizedLanguage;\n }\n if (normalizedTitle) {\n node.data.hProperties[\"data-title\"] = normalizedTitle;\n }\n\n const currentClassName = node.data.hProperties.className;\n const classList = Array.isArray(currentClassName)\n ? currentClassName\n : typeof currentClassName === \"string\"\n ? currentClassName.split(\" \").filter(Boolean)\n : [];\n\n if (!classList.includes(\"mdx-expandable-meta\")) {\n classList.push(\"mdx-expandable-meta\");\n }\n\n node.data.hProperties.className = classList;\n\n if (normalizedLanguage && !node.meta.includes(\"dbLang(\")) {\n node.meta = `${node.meta} dbLang(${escapeMeta(normalizedLanguage)})`.trim();\n }\n if (normalizedTitle && !node.meta.includes(\"dbTitle(\")) {\n node.meta = `${node.meta} dbTitle(${escapeMeta(normalizedTitle)})`.trim();\n }\n });\n};\n\nexport const handleCodeExpandable = () => (tree: Node) => {\n visit(tree, \"element\", (node: ElementNode) => {\n if (node.tagName !== \"pre\") return;\n\n const codeElement = node.children?.find((child) => {\n const element = child as ElementNode;\n return element.type === \"element\" && element.tagName === \"code\";\n }) as ElementNode | undefined;\n\n const codeClassName = codeElement?.properties?.className;\n const codeClassList = Array.isArray(codeClassName)\n ? codeClassName\n : typeof codeClassName === \"string\"\n ? codeClassName.split(\" \").filter(Boolean)\n : [];\n\n const codeMeta =\n codeElement?.data &&\n typeof codeElement.data === \"object\" &&\n typeof codeElement.data[\"meta\"] === \"string\"\n ? (codeElement.data[\"meta\"] as string)\n : undefined;\n\n const languageFromMeta = codeMeta?.match(/dbLang\\(([^)]+)\\)/)?.[1];\n const titleFromMeta = codeMeta?.match(/dbTitle\\(([^)]+)\\)/)?.[1];\n\n const languageFromProps =\n typeof codeElement?.properties?.[\"data-language\"] === \"string\"\n ? (codeElement.properties[\"data-language\"] as string)\n : undefined;\n const titleFromProps =\n typeof codeElement?.properties?.[\"data-title\"] === \"string\"\n ? (codeElement.properties[\"data-title\"] as string)\n : undefined;\n\n const languageFromCodeClass = codeClassList\n .find((item) => item.startsWith(\"language-\"))\n ?.replace(\"language-\", \"\");\n\n const existingPreLanguage =\n typeof node.properties?.[\"data-language\"] === \"string\"\n ? (node.properties[\"data-language\"] as string)\n : undefined;\n const existingPreTitle =\n typeof node.properties?.[\"data-title\"] === \"string\"\n ? (node.properties[\"data-title\"] as string)\n : undefined;\n\n const isExpandable =\n codeElement?.properties?.[\"data-expandable\"] === \"true\" ||\n codeClassList.includes(\"mdx-expandable-meta\") ||\n codeMeta?.includes(\"Expandable\") === true;\n\n const expandableLines = codeElement?.properties?.[\"data-expandable-lines\"];\n if (!isExpandable) return;\n\n if (!node.properties) {\n node.properties = {};\n }\n\n node.properties[\"data-expandable\"] = \"true\";\n if (typeof expandableLines === \"string\" || typeof expandableLines === \"number\") {\n node.properties[\"data-expandable-lines\"] = expandableLines.toString();\n } else if (node.raw) {\n node.properties[\"data-expandable-lines\"] = countCodeLines(node.raw).toString();\n }\n\n const resolvedLanguage =\n languageFromProps ||\n languageFromMeta ||\n languageFromCodeClass ||\n existingPreLanguage ||\n node.language;\n const resolvedTitle = titleFromProps || titleFromMeta || existingPreTitle || node.codeTitle;\n\n if (resolvedLanguage) {\n node.properties[\"data-language\"] = resolvedLanguage;\n }\n if (resolvedTitle) {\n node.properties[\"data-title\"] = resolvedTitle;\n }\n\n const className = node.properties.className;\n if (!className) {\n node.properties.className = [];\n }\n\n if (Array.isArray(node.properties.className)) {\n if (!node.properties.className.includes(\"mdx-expandable-code\")) {\n node.properties.className.push(\"mdx-expandable-code\");\n }\n } else if (typeof className === \"string\") {\n const hasMarker = className.split(\" \").includes(\"mdx-expandable-code\");\n if (!hasMarker) {\n node.properties.className = `${className} mdx-expandable-code`.trim().split(\" \");\n }\n } else {\n node.properties.className = [\"mdx-expandable-code\"];\n }\n\n if (codeElement?.properties) {\n const cleanedCodeClassList = codeClassList.filter((item) => item !== \"mdx-expandable-meta\");\n codeElement.properties.className = cleanedCodeClassList;\n }\n });\n};\n","import type { Node, Parent } from \"unist\";\nimport { visit } from \"unist-util-visit\";\nimport type { ElementNode } from \"../utils\";\n\ninterface TextNode extends Node {\n type: \"text\";\n value: string;\n}\n\n/**\n * Rehype plugin that transforms `<pre><code class=\"language-mermaid\">` fenced\n * blocks into `<Mermaid chart=\"...\">` elements.\n *\n * This allows Mermaid diagram definitions to be authored via standard fenced\n * code blocks (````mermaid) which avoids JSX parsing collisions with\n * Mermaid's `{...}` (decision nodes) and `[...]` (label nodes) syntax.\n */\nexport const rehypeMermaid = () => (tree: Node) => {\n visit(tree, \"element\", (node: ElementNode, index: number | null, parent: Parent | null) => {\n if (!parent || index === null || node.tagName !== \"pre\") return;\n\n const codeEl = node.children?.find(\n (child) =>\n (child as ElementNode).type === \"element\" && (child as ElementNode).tagName === \"code\"\n ) as ElementNode | undefined;\n\n if (!codeEl) return;\n\n const classList = Array.isArray(codeEl.properties?.className)\n ? (codeEl.properties.className as string[])\n : typeof codeEl.properties?.className === \"string\"\n ? (codeEl.properties.className as string).split(\" \").filter(Boolean)\n : [];\n\n if (!classList.includes(\"language-mermaid\")) return;\n\n const textNode = codeEl.children?.find((child) => (child as TextNode).type === \"text\") as\n TextNode | undefined;\n\n const chart = textNode?.value ?? \"\";\n\n parent.children[index] = {\n type: \"element\",\n tagName: \"Mermaid\",\n properties: { chart },\n children: [],\n } as unknown as ElementNode;\n });\n};\n","import type { Node } from \"unist\";\nimport type { VFile } from \"vfile\";\n\n/**\n * Remark plugin: convert markdown directives into MDX component elements.\n *\n * Contract (docubook):\n * - `:::name{attrs} … :::` — container: EVERY component that holds content\n * (tabs, tab, accordions, accordion, steps, step, cards, card, files,\n * folder, note + variants). Children are the block between the opening\n * `:::` and closing `:::` — bounded by micromark's container grammar, so\n * a component can never trap siblings that follow it.\n * - `::name{attrs}` — self-closing leaf (no children): file, youtube,\n * mermaid.\n * - `:tooltip[label]{tip=\"…\"}` — the ONE inline (single-colon) directive.\n * Every other text directive is rebuilt as literal text\n * (`localhost:3000` stays intact). `::tooltip` (block leaf) is removed\n * in v2 — tooltips are inline only.\n *\n * Names are PascalCased to match the components map (`file-tree` → `FileTree`).\n * Bare attributes (`{horizontal}`) become boolean props (JSX bare attribute).\n * Callout variants (`:::tip`, `:::info`, …) map to their own registry entries\n * (`Tip`/`Info`/…) which wrap the `Callout` component with the type set.\n */\nexport function remarkDirectiveToMdx() {\n return (tree: Node, file: VFile) => {\n const source = String(file);\n const root = tree as unknown as { children: Node[] };\n root.children = root.children.map((node) => transform(node, source));\n return tree;\n };\n}\n\n/** Leaves that never hold children (self-closing). */\nconst PURE_LEAVES = new Set([\"youtube\"]);\n\ntype DirectiveNode = Node & {\n type: \"containerDirective\" | \"leafDirective\" | \"textDirective\";\n name: string;\n attributes?: Record<string, string>;\n children?: Node[];\n};\n\nfunction isDirective(node: Node): node is DirectiveNode {\n return (\n node.type === \"containerDirective\" ||\n node.type === \"leafDirective\" ||\n node.type === \"textDirective\"\n );\n}\n\nfunction transform(node: Node, source: string): Node {\n if (!isDirective(node)) {\n const children = (node as unknown as { children?: Node[] }).children;\n if (Array.isArray(children)) {\n (node as unknown as { children: Node[] }).children = children.map((child) =>\n transform(child, source)\n );\n }\n return node;\n }\n if (node.type === \"textDirective\") {\n // `:tooltip[label]{tip=\"…\"}` is the one inline component — it stays\n // inside the paragraph. Every other single-colon text directive is\n // rebuilt as literal text (`localhost:3000` stays intact).\n if (node.name === \"tooltip\") {\n return inlineTooltip(node);\n }\n return literalDirective(node, source);\n }\n // Block-form tooltips are gone in v2 — degrade to literal text so the\n // author sees the directive instead of a broken component.\n if (node.type === \"leafDirective\" && node.name === \"tooltip\") {\n return literalDirective(node, source);\n }\n // containerDirective → component with children; leafDirective → self-closing.\n const children =\n node.type === \"containerDirective\" && !PURE_LEAVES.has(node.name)\n ? (node.children ?? []).map((child) => transform(child, source))\n : [];\n return directiveToElement(node, children);\n}\n\nfunction directiveToElement(directive: DirectiveNode, children: Node[]): Node {\n const name = pascalCase(directive.name);\n const attributes = Object.entries(directive.attributes ?? {}).map(([attrName, value]) => ({\n type: \"mdxJsxAttribute\",\n name: attrName,\n value: value === \"\" ? null : value,\n }));\n return {\n type: \"mdxJsxFlowElement\",\n name,\n attributes,\n children,\n } as Node;\n}\n\n/** Preserve authored syntax: parsed children and attributes lose formatting. */\nfunction literalDirective(directive: DirectiveNode, source: string): Node {\n const start = directive.position?.start.offset;\n const end = directive.position?.end.offset;\n // Synthetic nodes without source offsets cannot be restored losslessly.\n if (start === undefined || end === undefined) return directive;\n return { type: \"text\", value: source.slice(start, end) } as Node;\n}\n\n/**\n * Inline tooltip from a text directive: `:tooltip[label]{tip=\"…\"}`.\n * The label is the visible trigger (dotted underline); `tip` is the hover\n * bubble and defaults to the label, so `:tooltip[text]` alone already shows\n * a bubble. Emits an inline element so it stays inside the paragraph. The\n * bubble auto-positions (no `side` prop).\n */\nfunction inlineTooltip(directive: DirectiveNode): Node {\n const label = (directive.children ?? [])\n .map((child) => (child as { value?: string }).value ?? \"\")\n .join(\"\");\n const attrs = directive.attributes ?? {};\n const attributes = [\n { type: \"mdxJsxAttribute\", name: \"text\", value: attrs.text || label || \"?\" },\n { type: \"mdxJsxAttribute\", name: \"tip\", value: attrs.tip || label || \"\" },\n ];\n return { type: \"mdxJsxTextElement\", name: \"Tooltip\", attributes, children: [] } as Node;\n}\n\nfunction pascalCase(name: string): string {\n return name\n .split(\"-\")\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join(\"\");\n}\n","// MPL-2.0 — derived from next-mdx-remote (IBM). See LICENSE-MPL-2.0.\nimport React, { useEffect, useState, useMemo } from \"react\";\nimport * as jsxRuntime from \"react/jsx-runtime\";\nimport * as jsxDevRuntime from \"react/jsx-dev-runtime\";\nimport * as mdx from \"@mdx-js/react\";\nimport type { MDXRemoteSerializeResult } from \"./types.js\";\n\n/** Props for the client-side `<MDXRemote>` (accepts pre-serialized result). */\nexport type MDXRemoteProps = MDXRemoteSerializeResult & {\n components?: Record<string, React.ComponentType<any>>;\n /** Defer hydration to an idle callback */\n lazy?: boolean;\n};\n\n/**\n * Client-side MDX renderer.\n *\n * Accepts a pre-compiled result from `serialize()` and renders it via\n * `MDXProvider` for custom component injection.\n */\nexport function MDXRemote({\n compiledSource,\n frontmatter,\n scope = {},\n components = {},\n lazy,\n}: MDXRemoteProps): React.ReactElement {\n const [ready, setReady] = useState(!lazy || typeof window === \"undefined\");\n\n useEffect(() => {\n if (!lazy) return;\n const id = window.requestIdleCallback\n ? window.requestIdleCallback(() => setReady(true), { timeout: 500 })\n : setTimeout(() => setReady(true), 1);\n return () => {\n if (window.cancelIdleCallback) window.cancelIdleCallback(id as number);\n else clearTimeout(id as number);\n };\n }, [lazy]);\n\n const Content = useMemo(() => {\n // Non-RSC mode: compiled MDX expects `useMDXComponents` (\n // from @mdx-js/react) AND the JSX runtime.\n // In React 19, jsx/jsxs and jsxDEV live in separate modules,\n // so merge both to handle compiled output from any mode.\n const fullScope = {\n opts: { ...mdx, ...jsxRuntime, ...jsxDevRuntime },\n frontmatter,\n ...scope,\n };\n const keys = Object.keys(fullScope);\n const values = Object.values(fullScope);\n const fn = Reflect.construct(Function, keys.concat(`${compiledSource}`));\n return fn.apply(fn, values).default;\n }, [compiledSource, scope, frontmatter]);\n\n if (!ready) {\n return React.createElement(\"div\", {\n dangerouslySetInnerHTML: { __html: \"\" },\n suppressHydrationWarning: true,\n });\n }\n\n const content = React.createElement(\n mdx.MDXProvider,\n { components },\n React.createElement(Content, null)\n );\n\n return lazy ? React.createElement(\"div\", null, content) : content;\n}\n","import { serialize } from \"./mdx-compiler/serialize.js\";\nimport type { Node } from \"unist\";\nimport { visit } from \"unist-util-visit\";\nimport remarkGfm from \"remark-gfm\";\nimport rehypePrism from \"rehype-prism-plus\";\nimport rehypeAutolinkHeadings from \"rehype-autolink-headings\";\nimport rehypeSlug from \"rehype-slug\";\nimport rehypeCodeTitles from \"rehype-code-titles\";\nimport { handleCodeTitles } from \"./plugins/handleCodeTitles\";\nimport { handleCodeExpandableRemark, handleCodeExpandable } from \"./plugins/handleCodeExpandable\";\nimport { rehypeMermaid } from \"./plugins/rehypeMermaid\";\nimport { remarkDirectiveToMdx } from \"./plugins/remarkDirectiveToMdx\";\nimport remarkDirective from \"remark-directive\";\nimport type { ElementNode } from \"./utils\";\nimport type { Pluggable } from \"unified\";\n\n// Re-export serialize for non-RSC usage\nexport { serialize };\n\n// Re-export MDXRemote for client-side hydration\nexport { MDXRemote } from \"./mdx-compiler/index.js\";\n\ninterface TextNode extends Node {\n type: \"text\";\n value: string;\n}\n\nexport const preProcess = () => (tree: Node) => {\n visit(tree, (node: Node) => {\n const element = node as ElementNode;\n if (element?.type === \"element\" && element?.tagName === \"pre\" && element.children) {\n const [codeEl] = element.children as ElementNode[];\n if (codeEl.tagName !== \"code\" || !codeEl.children?.[0]) return;\n\n const className = codeEl.properties?.className;\n const classList = Array.isArray(className)\n ? className\n : typeof className === \"string\"\n ? className.split(\" \").filter(Boolean)\n : [];\n const languageClass = classList.find((item: string) => item.startsWith(\"language-\"));\n if (languageClass) {\n element.language = languageClass.replace(\"language-\", \"\").split(\":\")[0];\n }\n\n const textNode = codeEl.children[0] as TextNode;\n if (textNode.type === \"text\" && textNode.value) {\n element.raw = textNode.value;\n }\n }\n });\n\n return tree;\n};\n\nexport const postProcess = () => (tree: Node) => {\n visit(tree, \"element\", (node: Node) => {\n const element = node as ElementNode;\n if (element?.type === \"element\" && element?.tagName === \"pre\") {\n if (element.properties && element.raw) {\n element.properties.raw = element.raw;\n }\n if (element.properties && element.language && !element.properties[\"data-language\"]) {\n element.properties[\"data-language\"] = element.language;\n }\n if (element.properties && element.codeTitle && !element.properties[\"data-title\"]) {\n element.properties[\"data-title\"] = element.codeTitle;\n }\n }\n });\n\n return tree;\n};\n\nexport function createDefaultRehypePlugins(): Pluggable[] {\n return [\n preProcess,\n rehypeMermaid, // Transform ```mermaid before code transforms\n rehypeCodeTitles,\n handleCodeTitles,\n handleCodeExpandable, // Copy expandable metadata from <code> to <pre> before prism transforms nodes.\n rehypePrism,\n handleCodeExpandable, // Re-apply expandable attrs after prism tokenization.\n rehypeSlug,\n rehypeAutolinkHeadings,\n postProcess,\n ];\n}\n\nexport function createDefaultRemarkPlugins(): Pluggable[] {\n return [remarkGfm, handleCodeExpandableRemark, remarkDirective, remarkDirectiveToMdx];\n}\n","import type { Node } from \"unist\";\nimport { visit } from \"unist-util-visit\";\nimport type { TocItem } from \"../types\";\nimport type { ElementNode } from \"../utils\";\n\nfunction headingText(node: Node): string {\n const element = node as ElementNode;\n if (element.properties?.ariaHidden === true || element.properties?.ariaHidden === \"true\") {\n return \"\";\n }\n if (node.type === \"text\") return (node as Node & { value: string }).value;\n return element.children?.map(headingText).join(\"\") ?? \"\";\n}\n\n/** Collect final heading IDs, after slugging and user rehype transforms. */\nexport function rehypeCollectTocs(tocs: TocItem[]) {\n return (tree: Node) => {\n tocs.length = 0;\n visit(tree, \"element\", (node: ElementNode) => {\n if (!/^h[2-4]$/.test(node.tagName ?? \"\") || typeof node.properties?.id !== \"string\") return;\n tocs.push({\n level: Number(node.tagName!.slice(1)),\n text: headingText(node),\n href: `#${node.properties.id}`,\n });\n });\n };\n}\n","import matter from \"@11ty/gray-matter\";\nimport type { ZodType } from \"zod\";\nimport type { TocItem } from \"./types\";\nimport { compileSync } from \"@mdx-js/mdx\";\nimport { createDefaultRemarkPlugins } from \"./compile\";\nimport rehypeSlug from \"rehype-slug\";\nimport { rehypeCollectTocs } from \"./plugins/rehypeCollectTocs\";\n\nexport function sluggify(text: string): string {\n const normalized = text.normalize(\"NFD\").replace(/[\\u0300-\\u036f]/g, \"\"); // Remove accents\n const slug = normalized.toLowerCase().replace(/\\s+/g, \"-\");\n return slug.replace(/[^a-z0-9-]/g, \"\");\n}\n\nexport function extractTocsFromRawMdx(rawMdx: string): TocItem[] {\n const tocs: TocItem[] = [];\n compileSync(matter(rawMdx).content, {\n format: \"md\",\n remarkPlugins: createDefaultRemarkPlugins(),\n rehypePlugins: [rehypeSlug, [rehypeCollectTocs, tocs]],\n });\n return tocs;\n}\n\nexport function extractFrontmatter<Frontmatter>(content: string): Frontmatter {\n try {\n return matter(content).data as Frontmatter;\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n throw new Error(`Failed to extract frontmatter: ${reason}`, { cause: error });\n }\n}\n\n/**\n * Extract frontmatter and return both the parsed data and the content\n * with the frontmatter block stripped. Avoids a second parse during\n * compilation.\n *\n * Optionally validates the parsed frontmatter with a Zod schema.\n * YAML coerces unquoted values (e.g. `date: 2026-06-10` → Date, `3.5` → number),\n * so use `z.coerce.*` for fields that must remain strings.\n */\nexport function extractFrontmatterWithContent<Frontmatter>(content: string): {\n frontmatter: Frontmatter;\n strippedContent: string;\n};\nexport function extractFrontmatterWithContent<Frontmatter>(\n content: string,\n schema: ZodType<Frontmatter>\n): { frontmatter: Frontmatter; strippedContent: string };\nexport function extractFrontmatterWithContent<Frontmatter>(\n content: string,\n schema?: ZodType<Frontmatter>\n): { frontmatter: Frontmatter; strippedContent: string } {\n try {\n const { data, content: strippedContent } = matter(content);\n return {\n frontmatter: schema ? schema.parse(data) : (data as Frontmatter),\n strippedContent,\n };\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n throw new Error(`Failed to extract frontmatter: ${reason}`, { cause: error });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AASA,IAAa,WAA0B,MAAe;CACpD,IAAM,IAAgD,CAAC;CAEvD,EAAM,GAAM,YAAY,GAAmB,GAAsB,MAA0B;EAMzF,IALI,CAAC,KAAU,MAAU,QAAQ,EAAK,YAAY,SAK9C,CADe,EAAK,YAAY,WAAW,SAAS,mBAAmB,GAEzE;EAGF,IAAI,IAAkC;EACtC,KAAK,IAAI,IAAI,IAAQ,GAAG,IAAI,EAAO,SAAS,QAAQ,KAAK;GACvD,IAAM,IAAU,EAAO,SAAS;GAChC,IAAI,EAAQ,SAAS,WAAW;IAC9B,IAAc;IACd;GACF;EACF;EAEA,IAAI,GAAa,YAAY,OAAO;GAClC,IAAM,IAAY,EAAK,WAAW;GAClC,AAAI,GAAW,SAAS,WACjB,EAAY,eACf,EAAY,aAAa,CAAC,IAE5B,EAAY,WAAW,gBAAgB,EAAU,OACjD,EAAY,YAAY,EAAU,OAClC,EAAS,KAAK;IAAE;IAAQ;GAAM,CAAC;EAEnC;CACF,CAAC;CAGD,KAAK,IAAI,IAAI,EAAS,SAAS,GAAG,KAAK,GAAG,KAAK;EAC7C,IAAM,EAAE,WAAQ,aAAU,EAAS;EACnC,EAAO,SAAS,OAAO,GAAO,CAAC;CACjC;AACF;;;ACjCA,SAAS,EAAW,GAAmB;CACrC,IAAI,IAAM;CACV,KAAK,IAAI,IAAI,GAAG,IAAI,EAAE,QAAQ,KAAK;EACjC,IAAM,IAAK,EAAE;EAGb,IAAI,MAAO,OAAO,EAAE,IAAI,OAAO,KAAK;GAElC,AADA,K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AK,CAAC,CAAC,QAAQ,oBAAoB,EACxD,CAAA,CAAW,YAAY,CAAC,CAAC,QAAQ,QAAQ,GAC/C,CAAA,CAAK,QAAQ,eAAe,EAAE;AACvC;AAEA,SAAgB,EAAsB,GAA2B;CAC/D,IAAM,IAAkB,CAAC;CAMzB,OALA,EAAY,EAAO,CAAM,CAAC,CAAC,SAAS;EAClC,QAAQ;EACR,eAAe,EAA2B;EAC1C,eAAe,CAAC,GAAY,CAAC,GAAmB,CAAI,CAAC;CACvD,CAAC,GACM;AACT;AAEA,SAAgB,EAAgC,GAA8B;CAC5E,IAAI;EACF,OAAO,EAAO,CAAO,CAAC,CAAC;CACzB,SAAS,GAAO;EACd,IAAM,IAAS,aAAiB,QAAQ,EAAM,UAAU,OAAO,CAAK;EACpE,MAAU,MAAM,kCAAkC,KAAU,EAAE,OAAO,EAAM,CAAC;CAC9E;AACF;AAmBA,SAAgB,EACd,GACA,GACuD;CACvD,IAAI;EACF,IAAM,EAAE,SAAM,SAAS,MAAoB,EAAO,CAAO;EACzD,OAAO;GACL,aAAa,IAAS,EAAO,MAAM,CAAI,IAAK;GAC5C;EACF;CACF,SAAS,GAAO;EACd,IAAM,IAAS,aAAiB,QAAQ,EAAM,UAAU,OAAO,CAAK;EACpE,MAAU,MAAM,kCAAkC,KAAU,EAAE,OAAO,EAAM,CAAC;CAC9E;AACF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Node } from "unist";
|
|
2
|
+
import type { VFile } from "vfile";
|
|
2
3
|
/**
|
|
3
4
|
* Remark plugin: convert markdown directives into MDX component elements.
|
|
4
5
|
*
|
|
@@ -20,4 +21,4 @@ import type { Node } from "unist";
|
|
|
20
21
|
* Callout variants (`:::tip`, `:::info`, …) map to their own registry entries
|
|
21
22
|
* (`Tip`/`Info`/…) which wrap the `Callout` component with the type set.
|
|
22
23
|
*/
|
|
23
|
-
export declare function remarkDirectiveToMdx(): (tree: Node) => Node;
|
|
24
|
+
export declare function remarkDirectiveToMdx(): (tree: Node, file: VFile) => Node;
|