@riebeckite/plugin-local-graph 0.0.12 → 0.0.13
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 +85 -85
- package/README_ja.md +42 -42
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
# @riebeckite/plugin-local-graph
|
|
2
|
-
|
|
3
|
-
Local (nearby notes) graph rendering: a compact radial graph of a note's
|
|
4
|
-
outgoing links and backlinks.
|
|
5
|
-
|
|
6
|
-
[日本語](./README_ja.md)
|
|
7
|
-
|
|
8
|
-
## Overview
|
|
9
|
-
|
|
10
|
-
`localGraph()` provides a `LocalGraph` component that renders the current note
|
|
11
|
-
plus its direct links as an SVG radial graph. `getLocalGraph()` collects the
|
|
12
|
-
note's note-type outgoing links and backlinks from the manifest, keeps only
|
|
13
|
-
published neighbors, and caps each direction at `MAX_NEIGHBORS_PER_DIRECTION`
|
|
14
|
-
(10) notes.
|
|
15
|
-
|
|
16
|
-
Relations are tagged per node:
|
|
17
|
-
|
|
18
|
-
- `current` — the selected note (center)
|
|
19
|
-
- `outgoing` — linked from the current note
|
|
20
|
-
- `backlink` — links to the current note
|
|
21
|
-
- `both` — linked in both directions
|
|
22
|
-
|
|
23
|
-
The component renders nothing when there is no published neighbor.
|
|
24
|
-
|
|
25
|
-
## Usage
|
|
26
|
-
|
|
27
|
-
```ts
|
|
28
|
-
import { defineConfig } from "@riebeckite/core";
|
|
29
|
-
import { localGraphPlugin } from "@riebeckite/plugin-local-graph";
|
|
30
|
-
|
|
31
|
-
export default defineConfig({
|
|
32
|
-
// ...
|
|
33
|
-
plugins: [localGraphPlugin()],
|
|
34
|
-
});
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
`localGraphPlugin()` registers the plugin in the plugin list and bundles
|
|
38
|
-
`style.css` into the app stylesheet.
|
|
39
|
-
|
|
40
|
-
### Render the component
|
|
41
|
-
|
|
42
|
-
```tsx
|
|
43
|
-
import LocalGraph, { getLocalGraph } from "@riebeckite/plugin-local-graph";
|
|
44
|
-
import { config } from "../config";
|
|
45
|
-
import { content } from "../content";
|
|
46
|
-
import { getArticleTitle } from "../lib/article-title";
|
|
47
|
-
|
|
48
|
-
const manifest = await content.getManifest();
|
|
49
|
-
const graph = getLocalGraph({
|
|
50
|
-
manifest,
|
|
51
|
-
config,
|
|
52
|
-
slug,
|
|
53
|
-
resolveTitle: getArticleTitle,
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
// ...in your route
|
|
57
|
-
return (
|
|
58
|
-
<Article
|
|
59
|
-
footerContent={graph && <LocalGraph graph={graph} />}
|
|
60
|
-
/>
|
|
61
|
-
);
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## Graph layout
|
|
65
|
-
|
|
66
|
-
Node positions come from `layoutRadialGraph()`: the center node sits at the
|
|
67
|
-
middle, neighbors are arranged around it by link count; node radius grows with
|
|
68
|
-
the number of links. Edges are computed by `buildGraphEdges()`. Node links use
|
|
69
|
-
each node's resolved `permalink`; the header opens the full explorer through the
|
|
70
|
-
internal selection key `/explore?note=<slug>`.
|
|
71
|
-
|
|
72
|
-
## Exports
|
|
73
|
-
|
|
74
|
-
- `localGraphPlugin()` — plugin factory
|
|
75
|
-
- `LocalGraph` — SVG graph component (default export of `components/local-graph.tsx`)
|
|
76
|
-
- `getLocalGraph({ manifest, config, slug, resolveTitle })` — builds nearby-note
|
|
77
|
-
data for a slug (`null` when the note is absent or unpublished)
|
|
78
|
-
- `buildGraphEdges(nodes, visibleSlugs?)` — pure edge builder
|
|
79
|
-
- `layoutRadialGraph(nodes, options)` — pure radial layout
|
|
80
|
-
- Types: `LocalGraphData`, `LocalGraphNode`
|
|
81
|
-
|
|
82
|
-
## See also
|
|
83
|
-
|
|
84
|
-
- [Plugin guide](../../../docs/en/plugin-
|
|
85
|
-
- [`@riebeckite/plugin-backlinks`](../backlinks/README.md)
|
|
1
|
+
# @riebeckite/plugin-local-graph
|
|
2
|
+
|
|
3
|
+
Local (nearby notes) graph rendering: a compact radial graph of a note's
|
|
4
|
+
outgoing links and backlinks.
|
|
5
|
+
|
|
6
|
+
[日本語](./README_ja.md)
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
`localGraph()` provides a `LocalGraph` component that renders the current note
|
|
11
|
+
plus its direct links as an SVG radial graph. `getLocalGraph()` collects the
|
|
12
|
+
note's note-type outgoing links and backlinks from the manifest, keeps only
|
|
13
|
+
published neighbors, and caps each direction at `MAX_NEIGHBORS_PER_DIRECTION`
|
|
14
|
+
(10) notes.
|
|
15
|
+
|
|
16
|
+
Relations are tagged per node:
|
|
17
|
+
|
|
18
|
+
- `current` — the selected note (center)
|
|
19
|
+
- `outgoing` — linked from the current note
|
|
20
|
+
- `backlink` — links to the current note
|
|
21
|
+
- `both` — linked in both directions
|
|
22
|
+
|
|
23
|
+
The component renders nothing when there is no published neighbor.
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { defineConfig } from "@riebeckite/core";
|
|
29
|
+
import { localGraphPlugin } from "@riebeckite/plugin-local-graph";
|
|
30
|
+
|
|
31
|
+
export default defineConfig({
|
|
32
|
+
// ...
|
|
33
|
+
plugins: [localGraphPlugin()],
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`localGraphPlugin()` registers the plugin in the plugin list and bundles
|
|
38
|
+
`style.css` into the app stylesheet.
|
|
39
|
+
|
|
40
|
+
### Render the component
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
import LocalGraph, { getLocalGraph } from "@riebeckite/plugin-local-graph";
|
|
44
|
+
import { config } from "../config";
|
|
45
|
+
import { content } from "../content";
|
|
46
|
+
import { getArticleTitle } from "../lib/article-title";
|
|
47
|
+
|
|
48
|
+
const manifest = await content.getManifest();
|
|
49
|
+
const graph = getLocalGraph({
|
|
50
|
+
manifest,
|
|
51
|
+
config,
|
|
52
|
+
slug,
|
|
53
|
+
resolveTitle: getArticleTitle,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// ...in your route
|
|
57
|
+
return (
|
|
58
|
+
<Article
|
|
59
|
+
footerContent={graph && <LocalGraph graph={graph} />}
|
|
60
|
+
/>
|
|
61
|
+
);
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Graph layout
|
|
65
|
+
|
|
66
|
+
Node positions come from `layoutRadialGraph()`: the center node sits at the
|
|
67
|
+
middle, neighbors are arranged around it by link count; node radius grows with
|
|
68
|
+
the number of links. Edges are computed by `buildGraphEdges()`. Node links use
|
|
69
|
+
each node's resolved `permalink`; the header opens the full explorer through the
|
|
70
|
+
internal selection key `/explore?note=<slug>`.
|
|
71
|
+
|
|
72
|
+
## Exports
|
|
73
|
+
|
|
74
|
+
- `localGraphPlugin()` — plugin factory
|
|
75
|
+
- `LocalGraph` — SVG graph component (default export of `components/local-graph.tsx`)
|
|
76
|
+
- `getLocalGraph({ manifest, config, slug, resolveTitle })` — builds nearby-note
|
|
77
|
+
data for a slug (`null` when the note is absent or unpublished)
|
|
78
|
+
- `buildGraphEdges(nodes, visibleSlugs?)` — pure edge builder
|
|
79
|
+
- `layoutRadialGraph(nodes, options)` — pure radial layout
|
|
80
|
+
- Types: `LocalGraphData`, `LocalGraphNode`
|
|
81
|
+
|
|
82
|
+
## See also
|
|
83
|
+
|
|
84
|
+
- [Plugin guide](../../../docs/en/reference/plugin-api.md)
|
|
85
|
+
- [`@riebeckite/plugin-backlinks`](../backlinks/README.md)
|
|
86
86
|
- [`@riebeckite/plugin-garden-explorer`](../garden-explorer/README.md)
|
package/README_ja.md
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
# @riebeckite/plugin-local-graph
|
|
2
|
-
|
|
3
|
-
現在のノートと、その前後につながるノートを小さな放射状グラフで表示するプラグインです。
|
|
4
|
-
|
|
5
|
-
[English](./README.md)
|
|
6
|
-
|
|
7
|
-
## できること
|
|
8
|
-
|
|
9
|
-
`getLocalGraph()` はマニフェストからリンク先と被リンク元を集め、公開済みノートだけを残します。各方向は最大 10 件です。`LocalGraph` はそのデータを SVG として描画し、周辺ノートがなければ何も表示しません。
|
|
10
|
-
|
|
11
|
-
ノードには `current`、`outgoing`、`backlink`、`both` の関係が付きます。中央が現在のノート、周囲が直接つながるノートです。
|
|
12
|
-
|
|
13
|
-
## 設定と配置
|
|
14
|
-
|
|
15
|
-
```ts
|
|
16
|
-
import { defineConfig } from "@riebeckite/core";
|
|
17
|
-
import { localGraphPlugin } from "@riebeckite/plugin-local-graph";
|
|
18
|
-
|
|
19
|
-
export default defineConfig({ plugins: [localGraphPlugin()] });
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
```tsx
|
|
23
|
-
import LocalGraph, { getLocalGraph } from "@riebeckite/plugin-local-graph";
|
|
24
|
-
|
|
25
|
-
const graph = getLocalGraph({ manifest: await content.getManifest(), config, slug, resolveTitle });
|
|
26
|
-
return <Article footerContent={graph && <LocalGraph graph={graph} />} />;
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
グラフのノード位置は `layoutRadialGraph()`、辺は `buildGraphEdges()` が計算します。各ノードのリンクは解決済みの `permalink` を使い、見出しは internal selection key `/explore?note=<slug>` で Explorer を開きます。
|
|
30
|
-
|
|
31
|
-
## 公開 API
|
|
32
|
-
|
|
33
|
-
- `localGraphPlugin()`、`LocalGraph`
|
|
34
|
-
- `getLocalGraph({ manifest, config, slug, resolveTitle })`
|
|
35
|
-
- `buildGraphEdges(nodes, visibleSlugs?)`、`layoutRadialGraph(nodes, options)`
|
|
36
|
-
- `LocalGraphData`、`LocalGraphNode`
|
|
37
|
-
|
|
38
|
-
## 関連資料
|
|
39
|
-
|
|
40
|
-
- [プラグインシステム](../../../docs/ja/plugin-
|
|
41
|
-
- [`@riebeckite/plugin-backlinks`](../backlinks/README_ja.md)
|
|
42
|
-
- [`@riebeckite/plugin-garden-explorer`](../garden-explorer/README_ja.md)
|
|
1
|
+
# @riebeckite/plugin-local-graph
|
|
2
|
+
|
|
3
|
+
現在のノートと、その前後につながるノートを小さな放射状グラフで表示するプラグインです。
|
|
4
|
+
|
|
5
|
+
[English](./README.md)
|
|
6
|
+
|
|
7
|
+
## できること
|
|
8
|
+
|
|
9
|
+
`getLocalGraph()` はマニフェストからリンク先と被リンク元を集め、公開済みノートだけを残します。各方向は最大 10 件です。`LocalGraph` はそのデータを SVG として描画し、周辺ノートがなければ何も表示しません。
|
|
10
|
+
|
|
11
|
+
ノードには `current`、`outgoing`、`backlink`、`both` の関係が付きます。中央が現在のノート、周囲が直接つながるノートです。
|
|
12
|
+
|
|
13
|
+
## 設定と配置
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { defineConfig } from "@riebeckite/core";
|
|
17
|
+
import { localGraphPlugin } from "@riebeckite/plugin-local-graph";
|
|
18
|
+
|
|
19
|
+
export default defineConfig({ plugins: [localGraphPlugin()] });
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
import LocalGraph, { getLocalGraph } from "@riebeckite/plugin-local-graph";
|
|
24
|
+
|
|
25
|
+
const graph = getLocalGraph({ manifest: await content.getManifest(), config, slug, resolveTitle });
|
|
26
|
+
return <Article footerContent={graph && <LocalGraph graph={graph} />} />;
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
グラフのノード位置は `layoutRadialGraph()`、辺は `buildGraphEdges()` が計算します。各ノードのリンクは解決済みの `permalink` を使い、見出しは internal selection key `/explore?note=<slug>` で Explorer を開きます。
|
|
30
|
+
|
|
31
|
+
## 公開 API
|
|
32
|
+
|
|
33
|
+
- `localGraphPlugin()`、`LocalGraph`
|
|
34
|
+
- `getLocalGraph({ manifest, config, slug, resolveTitle })`
|
|
35
|
+
- `buildGraphEdges(nodes, visibleSlugs?)`、`layoutRadialGraph(nodes, options)`
|
|
36
|
+
- `LocalGraphData`、`LocalGraphNode`
|
|
37
|
+
|
|
38
|
+
## 関連資料
|
|
39
|
+
|
|
40
|
+
- [プラグインシステム](../../../docs/ja/reference/plugin-api.md)
|
|
41
|
+
- [`@riebeckite/plugin-backlinks`](../backlinks/README_ja.md)
|
|
42
|
+
- [`@riebeckite/plugin-garden-explorer`](../garden-explorer/README_ja.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-local-graph",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"hono": "^4.12.25",
|
|
25
|
-
"@riebeckite/core": "0.0.
|
|
25
|
+
"@riebeckite/core": "0.0.13"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"tsx": "^4.22.4",
|
|
29
|
-
"@riebeckite/test": "0.0.
|
|
29
|
+
"@riebeckite/test": "0.0.13"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|