seemore 1.1.3 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -22
- package/dist/cli/index.js +9 -4
- package/dist/cli/index.js.map +1 -1
- package/package.json +1 -1
- package/src/app/entry.prerender.tsx +72 -4
- package/src/app/layout/DocsLayout.tsx +33 -6
- package/src/app/lib/pages.ts +78 -8
- package/src/app/router.tsx +41 -2
- package/src/shared/types.ts +2 -0
package/README.md
CHANGED
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
<a href="https://marketplace.visualstudio.com/items?itemName=arifszn.seemore-vscode">
|
|
12
12
|
<img src="https://img.shields.io/badge/VS_Code-Marketplace-007ACC?logo=visualstudiocode&logoColor=white"/>
|
|
13
13
|
</a>
|
|
14
|
+
<a href="https://open-vsx.org/extension/arifszn/seemore-vscode">
|
|
15
|
+
<img src="https://img.shields.io/badge/Open_VSX-Registry-C160EF?logo=eclipseide&logoColor=white"/>
|
|
16
|
+
</a>
|
|
14
17
|
<a href="https://github.com/arifszn/seemore/actions/workflows/ci.yml">
|
|
15
18
|
<img src="https://github.com/arifszn/seemore/actions/workflows/ci.yml/badge.svg"/>
|
|
16
19
|
</a>
|
|
@@ -48,7 +51,7 @@ seemore points at that folder and renders it as a proper site instead, without y
|
|
|
48
51
|
Three ways to use it:
|
|
49
52
|
|
|
50
53
|
- **[In your browser](#view-in-your-browser)**: `npx seemore` serves the folder you're standing in and updates live as you edit.
|
|
51
|
-
- **[In
|
|
54
|
+
- **[In your code editor](#view-in-your-code-editor)**: an extension puts the same site in a panel next to the file you're editing — VS Code and VS Code-compatible editors like Cursor and Antigravity.
|
|
52
55
|
- **[As a static site](#publish-it-to-the-web)**: `npx seemore build` exports plain HTML you can host anywhere, so it doubles as a docs framework, not just a preview tool.
|
|
53
56
|
|
|
54
57
|
<p align="center">
|
|
@@ -65,9 +68,9 @@ Open a terminal in your folder of Markdown files, run `npx seemore`, and open th
|
|
|
65
68
|
|
|
66
69
|
With no folder given, seemore serves the folder you're standing in. Point it at a subfolder with `npx seemore docs` if that's where your files live.
|
|
67
70
|
|
|
68
|
-
## View in
|
|
71
|
+
## View in your code editor
|
|
69
72
|
|
|
70
|
-
Install
|
|
73
|
+
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. Open VSX also covers VS Code-compatible editors — Cursor, Antigravity, and others.
|
|
71
74
|
|
|
72
75
|
1. Open any Markdown file.
|
|
73
76
|
2. Click the seemore icon in the editor's title bar, or right-click a folder in the explorer and choose **Open Folder in seemore**.
|
|
@@ -93,28 +96,19 @@ Install [seemore for VS Code](https://marketplace.visualstudio.com/items?itemNam
|
|
|
93
96
|
npx seemore build # static export to dist/ for any host
|
|
94
97
|
```
|
|
95
98
|
|
|
96
|
-
The result is a `dist/` folder of plain web files: drop it on [Netlify](https://netlify.com), [Surge](https://surge.sh), [Cloudflare Pages](https://pages.cloudflare.com) or [GitHub Pages](https://pages.github.com), or hand it to any web host.
|
|
97
|
-
|
|
98
|
-
| File | Read by |
|
|
99
|
-
| --- | --- |
|
|
100
|
-
| `404.html` | GitHub Pages, Netlify, Cloudflare Pages, Vercel, S3 |
|
|
101
|
-
| `_redirects` | Netlify, Cloudflare Pages |
|
|
102
|
-
| `200.html` | Surge |
|
|
103
|
-
| `.nojekyll` | GitHub Pages, so Jekyll doesn't drop every path starting with `_` |
|
|
104
|
-
|
|
105
|
-
None of these are required for a host that isn't listed above. If your host serves a folder of files, it serves a seemore build.
|
|
99
|
+
The result is a `dist/` folder of plain web files: drop it on [Netlify](https://netlify.com), [Surge](https://surge.sh), [Cloudflare Pages](https://pages.cloudflare.com) or [GitHub Pages](https://pages.github.com), or hand it to any web host.
|
|
106
100
|
|
|
107
|
-
**GitHub Pages
|
|
101
|
+
**On GitHub Pages:** project sites live under `username.github.io/my-repo/`, not the root, so set `base` once:
|
|
108
102
|
|
|
109
103
|
```ts
|
|
110
104
|
export default defineConfig({ base: '/my-repo/' });
|
|
111
105
|
```
|
|
112
106
|
|
|
113
|
-
or
|
|
107
|
+
(or `--base /my-repo/` on the CLI). Building under GitHub Actions without it set prints the exact line to add.
|
|
114
108
|
|
|
115
109
|
## Configuration
|
|
116
110
|
|
|
117
|
-
Optional. A folder with no config file builds correctly in the browser, in
|
|
111
|
+
Optional. A folder with no config file builds correctly in the browser, in your code editor, and when built for publishing. If you want to adjust things, create `seemore.config.ts` next to your content:
|
|
118
112
|
|
|
119
113
|
```ts
|
|
120
114
|
// seemore.config.ts
|
|
@@ -166,7 +160,19 @@ Twelve built-in colour presets: `neutral` (default), `black`, `catppuccin`, `dus
|
|
|
166
160
|
|
|
167
161
|
### Features
|
|
168
162
|
|
|
169
|
-
A flat list of switches for readers who want fine control.
|
|
163
|
+
A flat list of switches for readers who want fine control, set as an array on the `features` key in `seemore.config.ts`. To turn on something that's off by default, add its flag name. To turn off something that's on by default, add its flag name prefixed with `!`.
|
|
164
|
+
|
|
165
|
+
```ts
|
|
166
|
+
// seemore.config.ts
|
|
167
|
+
export default defineConfig({
|
|
168
|
+
features: [
|
|
169
|
+
'navigation.path', // off by default → this turns it on
|
|
170
|
+
'!navigation.instant.prefetch', // on by default → this turns it off
|
|
171
|
+
],
|
|
172
|
+
});
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Flags you don't mention are left at their default, so you only ever list the ones you're changing.
|
|
170
176
|
|
|
171
177
|
| Flag | Default | Effect |
|
|
172
178
|
| --- | --- | --- |
|
|
@@ -181,6 +187,7 @@ A flat list of switches for readers who want fine control. Prefix one with `!` t
|
|
|
181
187
|
| `toc.integrate` | off | Merge the table of contents into the sidebar |
|
|
182
188
|
| `content.code.copy` | on | Copy button on code blocks |
|
|
183
189
|
| `content.action.edit` | on with `editLink` | Edit-this-page link |
|
|
190
|
+
| `content.image.zoom` | on | Click-to-zoom on content images |
|
|
184
191
|
| `search.suggest` | on | Inline query completion |
|
|
185
192
|
| `search.highlight` | on | Highlight the query on the page you land on |
|
|
186
193
|
| `social.cards` | off | Per-page OG images (needs `takumi-js`) |
|
|
@@ -189,7 +196,7 @@ Combinations that can't work together raise a config error naming both flags and
|
|
|
189
196
|
|
|
190
197
|
## Content
|
|
191
198
|
|
|
192
|
-
`.md` and `.mdx`
|
|
199
|
+
Supports `.md` and `.mdx` both.
|
|
193
200
|
|
|
194
201
|
- GitHub Flavoured Markdown, admonitions (note / tip / warning boxes), step-by-step lists, and colour-highlighted code blocks
|
|
195
202
|
- `[[wikilinks]]`, including `[[Page|label]]` and `[[Page#Heading]]`, the easiest way for you or your AI to link pages without relative paths to get right
|
|
@@ -198,6 +205,35 @@ Combinations that can't work together raise a config error naming both flags and
|
|
|
198
205
|
- Sibling images inlined as hashed assets, sibling PDFs open in the browser's own viewer
|
|
199
206
|
- Frontmatter (the `key: value` block at the top of a file) is validated, with errors that name the file and the field
|
|
200
207
|
|
|
208
|
+
### Code blocks
|
|
209
|
+
|
|
210
|
+
Fences are highlighted at build time by [Shiki](https://shiki.style), in the theme's own colours.
|
|
211
|
+
|
|
212
|
+
Settings go on the fence line, after the language — ` ```ts title="server.ts" lineNumbers `:
|
|
213
|
+
|
|
214
|
+
| On the fence | Effect |
|
|
215
|
+
| --- | --- |
|
|
216
|
+
| `title="server.ts"` | Filename bar above the block |
|
|
217
|
+
| `lineNumbers` | Numbers down the side; `lineNumbers=5` starts the count at 5 |
|
|
218
|
+
| `noCopy` | No copy button on this one block |
|
|
219
|
+
|
|
220
|
+
Comments mark individual lines and never reach the page:
|
|
221
|
+
|
|
222
|
+
| In the code | Effect |
|
|
223
|
+
| --- | --- |
|
|
224
|
+
| `// [!code highlight]` | Marks the line |
|
|
225
|
+
| `// [!code ++]`, `// [!code --]` | Diff lines: green with a `+`, red with a `-` |
|
|
226
|
+
| `// [!code focus]` | Blurs every other line until the pointer is over the block |
|
|
227
|
+
| `// [!code word:needle]` | Marks that word everywhere it appears in the block |
|
|
228
|
+
|
|
229
|
+
The marker follows the language's own comment syntax, so `# [!code highlight]` in Python and `<!-- [!code highlight] -->` in HTML.
|
|
230
|
+
|
|
231
|
+
### Components
|
|
232
|
+
|
|
233
|
+
An `.mdx` file can use `<Callout>`, `<Card>`, `<Cards>`, `<CodeBlockTabs>`, `<Mermaid>`, `<D2>` and `<Pdf>` without importing anything. The set is deliberately small: Markdown has no imports, so every component is one seemore ships to every site whether it is used or not, and these are the ones that pair with something Markdown already expresses. Anything else — fumadocs' `<Tabs>`, `<Accordions>`, `<Files>` among them — fails the build, naming the file and the component. In a plain `.md` file a tag is not JSX at all: it is dropped and its text kept, so components need the `.mdx` extension. The [Content page](https://arifszn.github.io/seemore/content) has the details.
|
|
234
|
+
|
|
235
|
+
Numbered headings — `## 1. Install it`, `## 2. Point it at a folder` — become a numbered sequence.
|
|
236
|
+
|
|
201
237
|
### Page addresses
|
|
202
238
|
|
|
203
239
|
| File | Address |
|
|
@@ -214,9 +250,23 @@ Both `/guide` and `/guide/` work on every host.
|
|
|
214
250
|
|
|
215
251
|
Pages are ordered by:
|
|
216
252
|
|
|
217
|
-
1. `meta.json` in the directory
|
|
218
|
-
|
|
219
|
-
|
|
253
|
+
1. `meta.json` in the directory — an explicit list, with `...` standing in for anything you didn't name:
|
|
254
|
+
|
|
255
|
+
```json
|
|
256
|
+
// guide/meta.json
|
|
257
|
+
{ "pages": ["getting-started", "installation", "..."] }
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
2. Frontmatter `order` — lower numbers first:
|
|
261
|
+
|
|
262
|
+
```md
|
|
263
|
+
---
|
|
264
|
+
title: Getting Started
|
|
265
|
+
order: 1
|
|
266
|
+
---
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
3. Alphabetical by title, for anything left unordered by the two above
|
|
220
270
|
|
|
221
271
|
## CLI reference
|
|
222
272
|
|
|
@@ -238,7 +288,7 @@ Options
|
|
|
238
288
|
|
|
239
289
|
## Under the hood
|
|
240
290
|
|
|
241
|
-
[fumadocs](https://fumadocs.vercel.app) provides the interface presets, with [Shiki](https://shiki.style), [Mermaid](https://mermaid.js.org), [D2](https://d2lang.com), [Vite](https://vite.dev) and [React Router](https://reactrouter.com) underneath. The
|
|
291
|
+
[fumadocs](https://fumadocs.vercel.app) provides the interface presets, with [Shiki](https://shiki.style), [Mermaid](https://mermaid.js.org), [D2](https://d2lang.com), [Vite](https://vite.dev) and [React Router](https://reactrouter.com) underneath. The code editor extension runs the same CLI as a child process it manages. Bug reports and pull requests are welcome at [github.com/arifszn/seemore](https://github.com/arifszn/seemore).
|
|
242
292
|
|
|
243
293
|
## Licence
|
|
244
294
|
|
package/dist/cli/index.js
CHANGED
|
@@ -20,7 +20,7 @@ __export(paths_exports, {
|
|
|
20
20
|
resolveContentRoot: () => resolveContentRoot
|
|
21
21
|
});
|
|
22
22
|
import { existsSync as existsSync2, readFileSync as readFileSync2, realpathSync } from "fs";
|
|
23
|
-
import { createHash } from "crypto";
|
|
23
|
+
import { createHash as createHash2 } from "crypto";
|
|
24
24
|
import { tmpdir } from "os";
|
|
25
25
|
import { dirname as dirname3, join as join2, resolve as resolve3 } from "path";
|
|
26
26
|
import { fileURLToPath } from "url";
|
|
@@ -51,7 +51,7 @@ function packageDirOf(name, fromFile) {
|
|
|
51
51
|
throw new Error(`seemore: could not locate the "${name}" package directory.`);
|
|
52
52
|
}
|
|
53
53
|
function cacheDir(contentRoot) {
|
|
54
|
-
const key =
|
|
54
|
+
const key = createHash2("sha256").update(resolve3(contentRoot)).digest("hex").slice(0, 12);
|
|
55
55
|
return join2(tmpdir(), "seemore", key);
|
|
56
56
|
}
|
|
57
57
|
function resolveContentRoot(cwd, explicit) {
|
|
@@ -515,6 +515,7 @@ import { dynamicLoader } from "fumadocs-core/source";
|
|
|
515
515
|
|
|
516
516
|
// src/node/content/scan.ts
|
|
517
517
|
import { readFileSync } from "fs";
|
|
518
|
+
import { createHash } from "crypto";
|
|
518
519
|
import { basename, dirname as dirname2, join, resolve as resolve2 } from "path";
|
|
519
520
|
import { globSync } from "tinyglobby";
|
|
520
521
|
import { z as z4 } from "zod";
|
|
@@ -596,14 +597,17 @@ function scan(options) {
|
|
|
596
597
|
for (const route of routes) {
|
|
597
598
|
const absPath = join(contentRoot, route.file);
|
|
598
599
|
let data;
|
|
600
|
+
let version;
|
|
599
601
|
try {
|
|
600
|
-
|
|
602
|
+
const text = readFileSync(absPath, "utf8");
|
|
603
|
+
data = parseFrontmatter(text, route.file).data;
|
|
604
|
+
version = createHash("sha256").update(text).digest("hex").slice(0, 12);
|
|
601
605
|
} catch (error) {
|
|
602
606
|
errors.push(error instanceof Error ? error.message : String(error));
|
|
603
607
|
continue;
|
|
604
608
|
}
|
|
605
609
|
if (data.draft === true && options.includeDrafts !== true) continue;
|
|
606
|
-
pages.push({ ...route, absPath, data: { ...data, title: titleFor(route, data, options.siteTitle) } });
|
|
610
|
+
pages.push({ ...route, absPath, version, data: { ...data, title: titleFor(route, data, options.siteTitle) } });
|
|
607
611
|
}
|
|
608
612
|
const files = pages.map((page) => ({
|
|
609
613
|
type: "page",
|
|
@@ -1207,6 +1211,7 @@ function renderRoutesValue(ctx) {
|
|
|
1207
1211
|
` url: ${json(page.url)},`,
|
|
1208
1212
|
` file: ${json(page.file)},`,
|
|
1209
1213
|
` absPath: ${json(page.absPath)},`,
|
|
1214
|
+
` version: ${json(page.version)},`,
|
|
1210
1215
|
` title: ${json(page.data.title)},`,
|
|
1211
1216
|
` description: ${json(page.data.description ?? null)},`,
|
|
1212
1217
|
` load: () => import(${json(specifier)}),`,
|