seemore 1.8.1 → 1.8.3
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 +24 -2
- package/package.json +1 -1
- package/src/app/mdx/Pdf.tsx +20 -5
- package/src/app/styles/globals.css +49 -2
package/README.md
CHANGED
|
@@ -60,7 +60,9 @@ And whichever preview is open, the page is also an editor: **double-click any pa
|
|
|
60
60
|
|
|
61
61
|
## Who is seemore for?
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
<p align="center">
|
|
64
|
+
<video src="https://github.com/user-attachments/assets/8142fcb4-2a1f-4e48-82b5-059a28fc0cf2" width="640" controls muted></video>
|
|
65
|
+
</p>
|
|
64
66
|
|
|
65
67
|
Typical use cases include:
|
|
66
68
|
|
|
@@ -113,7 +115,7 @@ export default {
|
|
|
113
115
|
Install **seemore** from the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=arifszn.seemore-vscode) or [Open VSX](https://open-vsx.org/extension/arifszn/seemore-vscode) to get the same rendered site as a panel beside your editor — no terminal, no `npx`, no browser tab to manage. The extension bundles the CLI, so nothing is downloaded or put on your PATH. Open VSX also covers VS Code-compatible editors — Cursor, Antigravity, and others.
|
|
114
116
|
|
|
115
117
|
<p align="center">
|
|
116
|
-
<img src="https://raw.githubusercontent.com/arifszn/seemore/main/packages/site/assets/vscode-extension.png" alt="VS Code with
|
|
118
|
+
<img src="https://raw.githubusercontent.com/arifszn/seemore/main/packages/site/assets/vscode-extension.png" alt="VS Code with features.md open in the editor and the seemore panel beside it, rendering the same page with a paragraph's Markdown source open in the inline editor" width="640"/>
|
|
117
119
|
</p>
|
|
118
120
|
|
|
119
121
|
1. Open any Markdown file.
|
|
@@ -245,6 +247,26 @@ Supports `.md` and `.mdx` both.
|
|
|
245
247
|
- Sibling images inlined as hashed assets with click-to-zoom, sibling PDFs open in the browser's own viewer
|
|
246
248
|
- Frontmatter keys are validated
|
|
247
249
|
|
|
250
|
+
### PDF viewer
|
|
251
|
+
|
|
252
|
+
Reference a PDF with image syntax and it opens inline in the browser's own viewer, with a download link underneath — a sibling file or a remote URL both work:
|
|
253
|
+
|
|
254
|
+
```md
|
|
255
|
+

|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
<p align="center">
|
|
259
|
+
<img src="https://raw.githubusercontent.com/arifszn/seemore/main/packages/site/assets/pdf-viewer.png" alt="A sample PDF rendered inline on the page in the browser's native PDF viewer, with a Download sample document link underneath" width="640"/>
|
|
260
|
+
</p>
|
|
261
|
+
|
|
262
|
+
### Diagrams
|
|
263
|
+
|
|
264
|
+
A ` ```mermaid ` or ` ```d2 ` code fence renders live in the browser, no build step or external service:
|
|
265
|
+
|
|
266
|
+
<p align="center">
|
|
267
|
+
<img src="https://raw.githubusercontent.com/arifszn/seemore/main/packages/site/assets/diagrams.png" alt="A mermaid flowchart reading Markdown, seemore, Static site rendered live on the Diagrams page, with a D2 diagram of the same chain below it" width="640"/>
|
|
268
|
+
</p>
|
|
269
|
+
|
|
248
270
|
### Code blocks
|
|
249
271
|
|
|
250
272
|
Code is syntax-highlighted automatically — nothing to configure. Add a filename or line numbers by putting them after the language on the fence line:
|
package/package.json
CHANGED
package/src/app/mdx/Pdf.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { useEffect, useState, type ComponentProps } from 'react';
|
|
2
|
+
import { FileText } from 'lucide-react';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Sibling PDFs render in the browser's own viewer.
|
|
@@ -9,14 +10,28 @@ import type { ComponentProps } from 'react';
|
|
|
9
10
|
* on a `<span>` gets the same layout with none of that.
|
|
10
11
|
*
|
|
11
12
|
* `pdfjs-dist` is roughly a megabyte, which is a poor trade for a docs site. The accepted
|
|
12
|
-
* cost is that
|
|
13
|
+
* cost is that some environments degrade `<embed>` to a blank box, since they don't support
|
|
14
|
+
* inline PDF plugins — most mobile browsers, but also Electron-based webviews (VS Code's
|
|
15
|
+
* preview included), which don't ship Chrome's PDF viewer extension despite reporting a
|
|
16
|
+
* fine pointer. The CSS `(pointer: coarse)` fallback in globals.css only catches the first
|
|
17
|
+
* group, so `navigator.pdfViewerEnabled` — Chromium/Firefox's direct feature check — is used
|
|
18
|
+
* to catch the second by toggling the same fallback via a class instead of a media query.
|
|
13
19
|
*/
|
|
14
20
|
export function Pdf({ src, title, ...props }: ComponentProps<'embed'> & { src: string }) {
|
|
21
|
+
const [unsupported, setUnsupported] = useState(false);
|
|
22
|
+
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if ('pdfViewerEnabled' in navigator && !navigator.pdfViewerEnabled) {
|
|
25
|
+
setUnsupported(true);
|
|
26
|
+
}
|
|
27
|
+
}, []);
|
|
28
|
+
|
|
15
29
|
return (
|
|
16
|
-
<span className=
|
|
30
|
+
<span className={unsupported ? 'seemore-pdf seemore-pdf-unsupported' : 'seemore-pdf'}>
|
|
17
31
|
<embed src={src} type="application/pdf" title={title} {...props} />
|
|
18
|
-
<a href={src} download>
|
|
19
|
-
|
|
32
|
+
<a className="seemore-pdf-fallback" href={src} download>
|
|
33
|
+
<FileText className="seemore-pdf-fallback-icon" aria-hidden="true" />
|
|
34
|
+
<span className="seemore-pdf-fallback-title">Download {title ?? 'PDF'}</span>
|
|
20
35
|
</a>
|
|
21
36
|
</span>
|
|
22
37
|
);
|
|
@@ -425,8 +425,47 @@
|
|
|
425
425
|
@apply block h-[70vh] w-full rounded-lg border border-fd-border;
|
|
426
426
|
}
|
|
427
427
|
|
|
428
|
-
.seemore-pdf
|
|
429
|
-
@apply mt-2
|
|
428
|
+
.seemore-pdf-fallback {
|
|
429
|
+
@apply mt-2 flex items-center gap-2 text-sm text-fd-muted-foreground no-underline transition-colors hover:text-fd-foreground;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
.seemore-pdf-fallback-icon {
|
|
433
|
+
@apply size-4 shrink-0;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
.seemore-pdf-fallback-title {
|
|
437
|
+
@apply font-medium text-fd-foreground;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/* Most touch browsers can't render `<embed type="application/pdf">` at all, so the box
|
|
441
|
+
above sits blank. Hide it there and promote the download link into the primary UI.
|
|
442
|
+
`.seemore-pdf-unsupported` is the same fallback, applied via JS (see Pdf.tsx) for
|
|
443
|
+
environments — Electron webviews included — that fail the same way despite a fine
|
|
444
|
+
pointer, so both selectors share these rules. */
|
|
445
|
+
@media (pointer: coarse) {
|
|
446
|
+
.seemore-pdf embed {
|
|
447
|
+
@apply hidden;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
.seemore-pdf-fallback {
|
|
451
|
+
@apply mt-0 flex-col items-start gap-1 rounded-lg border border-fd-border bg-fd-card px-4 py-4 hover:border-fd-primary/60;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
.seemore-pdf-fallback-icon {
|
|
455
|
+
@apply size-6;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
.seemore-pdf-unsupported embed {
|
|
460
|
+
@apply hidden;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
.seemore-pdf-unsupported .seemore-pdf-fallback {
|
|
464
|
+
@apply mt-0 flex-col items-start gap-1 rounded-lg border border-fd-border bg-fd-card px-4 py-4 hover:border-fd-primary/60;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
.seemore-pdf-unsupported .seemore-pdf-fallback-icon {
|
|
468
|
+
@apply size-6;
|
|
430
469
|
}
|
|
431
470
|
}
|
|
432
471
|
|
|
@@ -441,5 +480,13 @@
|
|
|
441
480
|
}
|
|
442
481
|
}
|
|
443
482
|
|
|
483
|
+
/* Unlayered, deliberately, for the same reason as the dialog fix above: fumadocs underlines
|
|
484
|
+
in-content links from its utilities layer, which beats `@layer components` regardless of
|
|
485
|
+
specificity. The PDF fallback reads as a button, not prose — it keeps its icon and title
|
|
486
|
+
flush, with no underline. */
|
|
487
|
+
.seemore-pdf-fallback {
|
|
488
|
+
text-decoration-line: none;
|
|
489
|
+
}
|
|
490
|
+
|
|
444
491
|
/* seemore:user-css — the stylesheet named by `css` in seemore.config.ts is inlined here, at
|
|
445
492
|
the very end, so that it wins against everything above it. */
|