@umami/shiso 1.2.0 → 1.3.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/dist/chunks/App.js +1 -1
- package/package.json +1 -1
- package/src/components/DocContent.tsx +1 -1
- package/src/styles/global.css +25 -4
- package/vite.config.ts +71 -0
package/dist/chunks/App.js
CHANGED
|
@@ -26709,7 +26709,7 @@ function DocContent({ page, doc, site }) {
|
|
|
26709
26709
|
className: "text-sm text-muted-foreground",
|
|
26710
26710
|
children: site.labels.relatedTopics
|
|
26711
26711
|
}), /* @__PURE__ */ jsx("ul", {
|
|
26712
|
-
className: "mt-3 flex flex-col gap-2",
|
|
26712
|
+
className: "mt-3 flex flex-col gap-2 text-sm",
|
|
26713
26713
|
children: related.map(({ href, title, external }) => /* @__PURE__ */ jsxs("li", {
|
|
26714
26714
|
className: "flex items-center gap-2",
|
|
26715
26715
|
children: [/* @__PURE__ */ jsx(FileText, {
|
package/package.json
CHANGED
|
@@ -109,7 +109,7 @@ export function DocContent({ page, doc, site }: DocContentProps) {
|
|
|
109
109
|
{related.length > 0 && (
|
|
110
110
|
<nav className="mt-8" aria-label={site.labels.relatedTopics}>
|
|
111
111
|
<div className="text-sm text-muted-foreground">{site.labels.relatedTopics}</div>
|
|
112
|
-
<ul className="mt-3 flex flex-col gap-2">
|
|
112
|
+
<ul className="mt-3 flex flex-col gap-2 text-sm">
|
|
113
113
|
{related.map(({ href, title, external }) => (
|
|
114
114
|
<li key={href} className="flex items-center gap-2">
|
|
115
115
|
<FileText size={14} className="shrink-0 text-muted-foreground" />
|
package/src/styles/global.css
CHANGED
|
@@ -146,25 +146,46 @@
|
|
|
146
146
|
font-size: 0.875rem;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
+
/* Styled to match the PropertiesTable component: rounded outer border,
|
|
150
|
+
horizontal row separators only, and no header fill. */
|
|
149
151
|
.docs-markdown table {
|
|
150
152
|
width: 100%;
|
|
151
|
-
border-collapse: collapse;
|
|
152
153
|
margin: 1rem 0;
|
|
153
154
|
font-size: 0.875rem;
|
|
155
|
+
border-collapse: separate;
|
|
156
|
+
border-spacing: 0;
|
|
157
|
+
border: 1px solid var(--border);
|
|
158
|
+
border-radius: var(--radius-lg);
|
|
154
159
|
}
|
|
155
160
|
|
|
156
161
|
.docs-markdown th,
|
|
157
162
|
.docs-markdown td {
|
|
158
|
-
border:
|
|
159
|
-
|
|
163
|
+
border: none;
|
|
164
|
+
border-bottom: 1px solid var(--border);
|
|
165
|
+
padding: 0.6rem 0.75rem;
|
|
160
166
|
text-align: left;
|
|
167
|
+
vertical-align: top;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.docs-markdown th:first-child,
|
|
171
|
+
.docs-markdown td:first-child {
|
|
172
|
+
padding-left: 1.5rem;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.docs-markdown th:last-child,
|
|
176
|
+
.docs-markdown td:last-child {
|
|
177
|
+
padding-right: 1.5rem;
|
|
161
178
|
}
|
|
162
179
|
|
|
163
180
|
.docs-markdown th {
|
|
164
|
-
background:
|
|
181
|
+
background: transparent;
|
|
165
182
|
font-weight: 600;
|
|
166
183
|
}
|
|
167
184
|
|
|
185
|
+
.docs-markdown tbody tr:last-child td {
|
|
186
|
+
border-bottom: none;
|
|
187
|
+
}
|
|
188
|
+
|
|
168
189
|
.docs-markdown table code:not(pre code) {
|
|
169
190
|
font-size: 0.75rem;
|
|
170
191
|
}
|
package/vite.config.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
1
2
|
import path from 'node:path';
|
|
2
3
|
import { fileURLToPath } from 'node:url';
|
|
3
4
|
import tailwindcss from '@tailwindcss/vite';
|
|
@@ -281,6 +282,75 @@ function shisoHtml(getDocsConfig: () => DocsConfig): Plugin {
|
|
|
281
282
|
};
|
|
282
283
|
}
|
|
283
284
|
|
|
285
|
+
/**
|
|
286
|
+
* Serves the raw markdown source for `<route>.md` URLs during development,
|
|
287
|
+
* mirroring the `.md` copies the prerenderer publishes next to every page in
|
|
288
|
+
* production builds. The contextual menu's copy/view options and AI links
|
|
289
|
+
* depend on these URLs.
|
|
290
|
+
*/
|
|
291
|
+
function shisoMarkdownDev(getDocsConfig: () => DocsConfig, root: string): Plugin {
|
|
292
|
+
return {
|
|
293
|
+
name: 'shiso-markdown-dev',
|
|
294
|
+
apply: 'serve',
|
|
295
|
+
configureServer(server) {
|
|
296
|
+
server.middlewares.use(async (req, res, next) => {
|
|
297
|
+
const url = (req.url || '').split('?')[0];
|
|
298
|
+
|
|
299
|
+
if ((req.method !== 'GET' && req.method !== 'HEAD') || !url.endsWith('.md')) {
|
|
300
|
+
return next();
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
const shiso =
|
|
304
|
+
(getDocsConfig() as { $shiso?: { docsPrefix?: string; contentDir?: string } }).$shiso ||
|
|
305
|
+
{};
|
|
306
|
+
const contentDir = (shiso.contentDir ?? 'content/docs').replace(/^\/+|\/+$/g, '');
|
|
307
|
+
const prefixValue = (shiso.docsPrefix ?? '/docs').trim().replace(/\/+$/, '');
|
|
308
|
+
const docsPrefix =
|
|
309
|
+
!prefixValue || prefixValue === '/'
|
|
310
|
+
? ''
|
|
311
|
+
: prefixValue.startsWith('/')
|
|
312
|
+
? prefixValue
|
|
313
|
+
: `/${prefixValue}`;
|
|
314
|
+
|
|
315
|
+
let route = decodeURIComponent(url).slice(0, -'.md'.length);
|
|
316
|
+
const base = server.config.base.replace(/\/+$/, '');
|
|
317
|
+
|
|
318
|
+
if (base && route.startsWith(base)) {
|
|
319
|
+
route = route.slice(base.length);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
if (docsPrefix && route.startsWith(docsPrefix)) {
|
|
323
|
+
route = route.slice(docsPrefix.length);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
const slug = route.replace(/^\/+/, '') || 'index';
|
|
327
|
+
const contentRoot = path.resolve(root, contentDir);
|
|
328
|
+
const candidates = [`${slug}.mdx`, `${slug}.md`, `${slug}/index.mdx`, `${slug}/index.md`];
|
|
329
|
+
|
|
330
|
+
for (const candidate of candidates) {
|
|
331
|
+
const filePath = path.resolve(contentRoot, candidate);
|
|
332
|
+
|
|
333
|
+
// Never read outside the content directory.
|
|
334
|
+
if (!filePath.startsWith(contentRoot + path.sep)) {
|
|
335
|
+
break;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
try {
|
|
339
|
+
const source = await readFile(filePath, 'utf8');
|
|
340
|
+
res.setHeader('Content-Type', 'text/markdown; charset=utf-8');
|
|
341
|
+
res.end(source);
|
|
342
|
+
return;
|
|
343
|
+
} catch {
|
|
344
|
+
// Try the next candidate.
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
next();
|
|
349
|
+
});
|
|
350
|
+
},
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
|
|
284
354
|
const MDX_REACT_ENTRY = fileURLToPath(import.meta.resolve('@mdx-js/react'));
|
|
285
355
|
const LUCIDE_REACT_ENTRY = path.join(
|
|
286
356
|
path.dirname(fileURLToPath(import.meta.resolve('lucide-react/package.json'))),
|
|
@@ -319,6 +389,7 @@ export default defineConfig(async () => {
|
|
|
319
389
|
path.join(generatedRoot, 'search-index.generated.ts'),
|
|
320
390
|
),
|
|
321
391
|
shisoHtml(getDocsConfig),
|
|
392
|
+
shisoMarkdownDev(getDocsConfig, projectRoot),
|
|
322
393
|
shisoMdx(),
|
|
323
394
|
react({ include: /\.(mdx|md|tsx|ts|jsx|js)$/ }),
|
|
324
395
|
],
|