@docubook/mdx 1.1.0 → 1.2.0
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 +0 -95
- package/dist/adapters/next/index.cjs +6 -8
- package/dist/adapters/next/index.js +6 -8
- package/dist/adapters/react-router/index.cjs +6 -8
- package/dist/adapters/react-router/index.js +6 -8
- package/dist/core/index.cjs +101 -209
- package/dist/core/index.js +111 -219
- package/dist/core/server.cjs +35 -65
- package/dist/core/server.js +35 -65
- package/dist/index.cjs +35 -65
- package/dist/index.js +35 -65
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -132,101 +132,6 @@ Use this as practical guidance for helper imports:
|
|
|
132
132
|
| NextImageMdx | Adapter (Next.js) | `@docubook/mdx/next` | For `img` mapping in Next App Router. |
|
|
133
133
|
| NextLinkMdx | Adapter (Next.js) | `@docubook/mdx/next` | For `a` mapping in Next App Router. |
|
|
134
134
|
|
|
135
|
-
## Styling Override (Backward Compatible)
|
|
136
|
-
|
|
137
|
-
Default styling in `core` follows the same base look as the `nextjs-vercel` markdown components for backward compatibility.
|
|
138
|
-
|
|
139
|
-
Best practice: override styles globally using the built-in semantic hooks (`data-docubook` and `dbk-*` classes) in your app stylesheet, so you do not need to add `className` in MDX content.
|
|
140
|
-
|
|
141
|
-
### Global Override Example (recommended)
|
|
142
|
-
|
|
143
|
-
Use in `styles/globals.css` or `styles/override.css`:
|
|
144
|
-
|
|
145
|
-
```css
|
|
146
|
-
/* Accordion */
|
|
147
|
-
[data-docubook="accordion-button"] {
|
|
148
|
-
@apply bg-blue-50 hover:bg-blue-100;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
[data-docubook="accordion-title"] {
|
|
152
|
-
@apply text-blue-900 font-semibold;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/* Note */
|
|
156
|
-
[data-docubook="note"][data-variant="warning"] {
|
|
157
|
-
@apply border-amber-400/50 bg-amber-50 text-amber-900;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/* Tooltip */
|
|
161
|
-
[data-docubook="tooltip-content"] {
|
|
162
|
-
@apply w-80 text-xs;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/* File tree */
|
|
166
|
-
[data-docubook="file-tree"] {
|
|
167
|
-
@apply border-blue-200;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
[data-docubook="file-tree-folder-button"] {
|
|
171
|
-
@apply py-2;
|
|
172
|
-
}
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
### Selector Table For Override
|
|
176
|
-
|
|
177
|
-
Use `data-docubook` selectors as the primary (stable) target, and use `dbk-*` classes as a fallback when needed.
|
|
178
|
-
|
|
179
|
-
| Component | Target Element | Stable Selector (`data-docubook`) | Class Hook (`dbk-*`) |
|
|
180
|
-
| --- | --- | --- | --- |
|
|
181
|
-
| Accordion | Root | `[data-docubook="accordion"]` | `.dbk-accordion` |
|
|
182
|
-
| Accordion | Trigger Button | `[data-docubook="accordion-button"]` | `.dbk-accordion__button` |
|
|
183
|
-
| Accordion | Chevron | `[data-docubook="accordion-chevron"]` | `.dbk-accordion__chevron` |
|
|
184
|
-
| Accordion | Title | `[data-docubook="accordion-title"]` | `.dbk-accordion__title` |
|
|
185
|
-
| Accordion | Content Body | `[data-docubook="accordion-content-body"]` | `.dbk-accordion__content-body` |
|
|
186
|
-
| AccordionGroup | Root | `[data-docubook="accordion-group"]` | `.dbk-accordion-group` |
|
|
187
|
-
| Note | Root | `[data-docubook="note"]` | `.dbk-note` |
|
|
188
|
-
| Note | Variant Warning | `[data-docubook="note"][data-variant="warning"]` | `.dbk-note[data-variant="warning"]` |
|
|
189
|
-
| Note | Title | `[data-docubook="note-title"]` | `.dbk-note__title` |
|
|
190
|
-
| Stepper | Root | `[data-docubook="stepper"]` | `.dbk-stepper` |
|
|
191
|
-
| Stepper | Item | `[data-docubook="stepper-item"]` | `.dbk-stepper__item` |
|
|
192
|
-
| Stepper | Number | `[data-docubook="stepper-number"]` | `.dbk-stepper__number` |
|
|
193
|
-
| StepperItem | Title | `[data-docubook="stepper-item-title"]` | `.dbk-stepper-item__title` |
|
|
194
|
-
| Tooltip | Root | `[data-docubook="tooltip"]` | `.dbk-tooltip` |
|
|
195
|
-
| Tooltip | Trigger | `[data-docubook="tooltip-trigger"]` | `.dbk-tooltip__trigger` |
|
|
196
|
-
| Tooltip | Content | `[data-docubook="tooltip-content"]` | `.dbk-tooltip__content` |
|
|
197
|
-
| FileTree | Root | `[data-docubook="file-tree"]` | `.dbk-file-tree` |
|
|
198
|
-
| FileTree | Folder Button | `[data-docubook="file-tree-folder-button"]` | `.dbk-file-tree__folder-button` |
|
|
199
|
-
| FileTree | Folder Children | `[data-docubook="file-tree-folder-children"]` | `.dbk-file-tree__folder-children` |
|
|
200
|
-
| FileTree | File Row | `[data-docubook="file-tree-file"]` | `.dbk-file-tree__file` |
|
|
201
|
-
| Card | Root | `[data-docubook="card"]` | `.dbk-card` |
|
|
202
|
-
| Card | Link Wrapper | `[data-docubook="card-link"]` | `.dbk-card__link` |
|
|
203
|
-
| Card | Title | `[data-docubook="card-title"]` | `.dbk-card__title` |
|
|
204
|
-
| Copy | Button | `[data-docubook="copy-button"]` | `.dbk-copy` |
|
|
205
|
-
| Copy | Icon | `[data-docubook="copy-icon"]` | `.dbk-copy__icon` |
|
|
206
|
-
| Keyboard (Kbd) | Root | `[data-docubook="kbd"]` | `.dbk-kbd` |
|
|
207
|
-
| Release | Root | `[data-docubook="release"]` | `.dbk-release` |
|
|
208
|
-
| Release | Version Badge | `[data-docubook="release-version"]` | `.dbk-release__version` |
|
|
209
|
-
| Release | Title | `[data-docubook="release-title"]` | `.dbk-release__title` |
|
|
210
|
-
| Changes | Root | `[data-docubook="release-changes"]` | `.dbk-release-changes` |
|
|
211
|
-
| Changes | Badge | `[data-docubook="release-changes-badge"]` | `.dbk-release-changes__badge` |
|
|
212
|
-
| Changes | Item | `[data-docubook="release-changes-item"]` | `.dbk-release-changes__item` |
|
|
213
|
-
|
|
214
|
-
Quick example:
|
|
215
|
-
|
|
216
|
-
```css
|
|
217
|
-
[data-docubook="card-title"] {
|
|
218
|
-
@apply text-blue-700;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
[data-docubook="copy-button"] {
|
|
222
|
-
@apply rounded-lg border-blue-300;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
[data-docubook="release-changes"][data-type="improved"] [data-docubook="release-changes-badge"] {
|
|
226
|
-
@apply bg-sky-100 text-sky-700;
|
|
227
|
-
}
|
|
228
|
-
```
|
|
229
|
-
|
|
230
135
|
## Loading Strategy (Helper)
|
|
231
136
|
|
|
232
137
|
- Prefer static import for high-frequency primitives: `a`, `img`, `pre`.
|
|
@@ -110,7 +110,6 @@ function Card({
|
|
|
110
110
|
"div",
|
|
111
111
|
{
|
|
112
112
|
className: (0, import_clsx.default)(
|
|
113
|
-
"dbk-card",
|
|
114
113
|
"border rounded-lg shadow-sm p-4 transition-all duration-200",
|
|
115
114
|
"bg-card text-card-foreground border-border",
|
|
116
115
|
"hover:bg-accent/5 hover:border-accent/30",
|
|
@@ -118,21 +117,20 @@ function Card({
|
|
|
118
117
|
horizontal ? "flex-row items-start gap-1" : "flex-col space-y-1",
|
|
119
118
|
className
|
|
120
119
|
),
|
|
121
|
-
"data-docubook": "card",
|
|
122
120
|
children: [
|
|
123
|
-
Icon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { className: (0, import_clsx.default)("
|
|
124
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "
|
|
125
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "
|
|
126
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "
|
|
121
|
+
Icon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { className: (0, import_clsx.default)("w-5 h-5 text-primary shrink-0", horizontal && "mt-0.5") }),
|
|
122
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
123
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "text-base font-semibold text-foreground leading-6", children: title }),
|
|
124
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "text-sm text-muted-foreground -mt-3", children })
|
|
127
125
|
] })
|
|
128
126
|
]
|
|
129
127
|
}
|
|
130
128
|
);
|
|
131
129
|
if (!href) return content;
|
|
132
130
|
if (LinkComponent) {
|
|
133
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LinkComponent, { href, className: "
|
|
131
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LinkComponent, { href, className: "no-underline block", children: content });
|
|
134
132
|
}
|
|
135
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("a", { className: "
|
|
133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("a", { className: "no-underline block", href, children: content });
|
|
136
134
|
}
|
|
137
135
|
|
|
138
136
|
// src/adapters/next/index.tsx
|
|
@@ -73,7 +73,6 @@ function Card({
|
|
|
73
73
|
"div",
|
|
74
74
|
{
|
|
75
75
|
className: clsx(
|
|
76
|
-
"dbk-card",
|
|
77
76
|
"border rounded-lg shadow-sm p-4 transition-all duration-200",
|
|
78
77
|
"bg-card text-card-foreground border-border",
|
|
79
78
|
"hover:bg-accent/5 hover:border-accent/30",
|
|
@@ -81,21 +80,20 @@ function Card({
|
|
|
81
80
|
horizontal ? "flex-row items-start gap-1" : "flex-col space-y-1",
|
|
82
81
|
className
|
|
83
82
|
),
|
|
84
|
-
"data-docubook": "card",
|
|
85
83
|
children: [
|
|
86
|
-
Icon && /* @__PURE__ */ jsx2(Icon, { className: clsx("
|
|
87
|
-
/* @__PURE__ */ jsxs2("div", { className: "
|
|
88
|
-
/* @__PURE__ */ jsx2("div", { className: "
|
|
89
|
-
/* @__PURE__ */ jsx2("div", { className: "
|
|
84
|
+
Icon && /* @__PURE__ */ jsx2(Icon, { className: clsx("w-5 h-5 text-primary shrink-0", horizontal && "mt-0.5") }),
|
|
85
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex-1 min-w-0", children: [
|
|
86
|
+
/* @__PURE__ */ jsx2("div", { className: "text-base font-semibold text-foreground leading-6", children: title }),
|
|
87
|
+
/* @__PURE__ */ jsx2("div", { className: "text-sm text-muted-foreground -mt-3", children })
|
|
90
88
|
] })
|
|
91
89
|
]
|
|
92
90
|
}
|
|
93
91
|
);
|
|
94
92
|
if (!href) return content;
|
|
95
93
|
if (LinkComponent) {
|
|
96
|
-
return /* @__PURE__ */ jsx2(LinkComponent, { href, className: "
|
|
94
|
+
return /* @__PURE__ */ jsx2(LinkComponent, { href, className: "no-underline block", children: content });
|
|
97
95
|
}
|
|
98
|
-
return /* @__PURE__ */ jsx2("a", { className: "
|
|
96
|
+
return /* @__PURE__ */ jsx2("a", { className: "no-underline block", href, children: content });
|
|
99
97
|
}
|
|
100
98
|
|
|
101
99
|
// src/adapters/next/index.tsx
|
|
@@ -109,7 +109,6 @@ function Card({
|
|
|
109
109
|
"div",
|
|
110
110
|
{
|
|
111
111
|
className: (0, import_clsx.default)(
|
|
112
|
-
"dbk-card",
|
|
113
112
|
"border rounded-lg shadow-sm p-4 transition-all duration-200",
|
|
114
113
|
"bg-card text-card-foreground border-border",
|
|
115
114
|
"hover:bg-accent/5 hover:border-accent/30",
|
|
@@ -117,21 +116,20 @@ function Card({
|
|
|
117
116
|
horizontal ? "flex-row items-start gap-1" : "flex-col space-y-1",
|
|
118
117
|
className
|
|
119
118
|
),
|
|
120
|
-
"data-docubook": "card",
|
|
121
119
|
children: [
|
|
122
|
-
Icon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { className: (0, import_clsx.default)("
|
|
123
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "
|
|
124
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "
|
|
125
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "
|
|
120
|
+
Icon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { className: (0, import_clsx.default)("w-5 h-5 text-primary shrink-0", horizontal && "mt-0.5") }),
|
|
121
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
122
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "text-base font-semibold text-foreground leading-6", children: title }),
|
|
123
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "text-sm text-muted-foreground -mt-3", children })
|
|
126
124
|
] })
|
|
127
125
|
]
|
|
128
126
|
}
|
|
129
127
|
);
|
|
130
128
|
if (!href) return content;
|
|
131
129
|
if (LinkComponent) {
|
|
132
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LinkComponent, { href, className: "
|
|
130
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LinkComponent, { href, className: "no-underline block", children: content });
|
|
133
131
|
}
|
|
134
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("a", { className: "
|
|
132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("a", { className: "no-underline block", href, children: content });
|
|
135
133
|
}
|
|
136
134
|
|
|
137
135
|
// src/core/components/Image.tsx
|
|
@@ -72,7 +72,6 @@ function Card({
|
|
|
72
72
|
"div",
|
|
73
73
|
{
|
|
74
74
|
className: clsx(
|
|
75
|
-
"dbk-card",
|
|
76
75
|
"border rounded-lg shadow-sm p-4 transition-all duration-200",
|
|
77
76
|
"bg-card text-card-foreground border-border",
|
|
78
77
|
"hover:bg-accent/5 hover:border-accent/30",
|
|
@@ -80,21 +79,20 @@ function Card({
|
|
|
80
79
|
horizontal ? "flex-row items-start gap-1" : "flex-col space-y-1",
|
|
81
80
|
className
|
|
82
81
|
),
|
|
83
|
-
"data-docubook": "card",
|
|
84
82
|
children: [
|
|
85
|
-
Icon && /* @__PURE__ */ jsx2(Icon, { className: clsx("
|
|
86
|
-
/* @__PURE__ */ jsxs2("div", { className: "
|
|
87
|
-
/* @__PURE__ */ jsx2("div", { className: "
|
|
88
|
-
/* @__PURE__ */ jsx2("div", { className: "
|
|
83
|
+
Icon && /* @__PURE__ */ jsx2(Icon, { className: clsx("w-5 h-5 text-primary shrink-0", horizontal && "mt-0.5") }),
|
|
84
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex-1 min-w-0", children: [
|
|
85
|
+
/* @__PURE__ */ jsx2("div", { className: "text-base font-semibold text-foreground leading-6", children: title }),
|
|
86
|
+
/* @__PURE__ */ jsx2("div", { className: "text-sm text-muted-foreground -mt-3", children })
|
|
89
87
|
] })
|
|
90
88
|
]
|
|
91
89
|
}
|
|
92
90
|
);
|
|
93
91
|
if (!href) return content;
|
|
94
92
|
if (LinkComponent) {
|
|
95
|
-
return /* @__PURE__ */ jsx2(LinkComponent, { href, className: "
|
|
93
|
+
return /* @__PURE__ */ jsx2(LinkComponent, { href, className: "no-underline block", children: content });
|
|
96
94
|
}
|
|
97
|
-
return /* @__PURE__ */ jsx2("a", { className: "
|
|
95
|
+
return /* @__PURE__ */ jsx2("a", { className: "no-underline block", href, children: content });
|
|
98
96
|
}
|
|
99
97
|
|
|
100
98
|
// src/core/components/Image.tsx
|