@riebeckite/plugin-local-graph 0.0.16 → 0.0.18
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 +1 -1
- package/README_ja.md +1 -1
- package/dist/index.js +24 -0
- package/package.json +3 -3
- package/style.css +1 -1
package/README.md
CHANGED
|
@@ -81,6 +81,6 @@ internal selection key `/explore?note=<slug>`.
|
|
|
81
81
|
|
|
82
82
|
## See also
|
|
83
83
|
|
|
84
|
-
- [Plugin guide](../../../docs/
|
|
84
|
+
- [Plugin guide](../../../docs/docs/reference/plugin-api.en.md)
|
|
85
85
|
- [`@riebeckite/plugin-backlinks`](../backlinks/README.md)
|
|
86
86
|
- [`@riebeckite/plugin-garden-explorer`](../garden-explorer/README.md)
|
package/README_ja.md
CHANGED
|
@@ -37,7 +37,7 @@ return <Article footerContent={graph && <LocalGraph graph={graph} />} />;
|
|
|
37
37
|
|
|
38
38
|
## 関連資料
|
|
39
39
|
|
|
40
|
-
- [プラグインシステム](../../../docs/
|
|
40
|
+
- [プラグインシステム](../../../docs/docs/reference/plugin-api.md)
|
|
41
41
|
- [`@riebeckite/plugin-backlinks`](../backlinks/README_ja.md)
|
|
42
42
|
- [`@riebeckite/plugin-garden-explorer`](../garden-explorer/README_ja.md)
|
|
43
43
|
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// index.ts
|
|
2
2
|
import {
|
|
3
|
+
appendContentBodySlot,
|
|
3
4
|
buildGraphEdges as buildGraphEdges2,
|
|
4
5
|
definePlugin,
|
|
5
6
|
layoutRadialGraph as layoutRadialGraph2
|
|
6
7
|
} from "@riebeckite/core";
|
|
8
|
+
import { renderToString } from "hono/jsx/dom/server";
|
|
7
9
|
|
|
8
10
|
// components/local-graph.tsx
|
|
9
11
|
import { buildGraphEdges, layoutRadialGraph } from "@riebeckite/core";
|
|
@@ -186,6 +188,24 @@ function getRelation(slug, currentSlug, outgoing, backlinks) {
|
|
|
186
188
|
function localGraphPlugin() {
|
|
187
189
|
return definePlugin({
|
|
188
190
|
name: "local-graph",
|
|
191
|
+
order: 400,
|
|
192
|
+
onManifestCreated: ({ config, manifest }) => {
|
|
193
|
+
if (!config) return;
|
|
194
|
+
for (const entry of manifest.discoverableEntries) {
|
|
195
|
+
const graph = getLocalGraph({
|
|
196
|
+
manifest,
|
|
197
|
+
config,
|
|
198
|
+
slug: entry.slug,
|
|
199
|
+
resolveTitle
|
|
200
|
+
});
|
|
201
|
+
if (!graph || graph.nodes.length <= 1) continue;
|
|
202
|
+
appendContentBodySlot(
|
|
203
|
+
entry,
|
|
204
|
+
"article.footer",
|
|
205
|
+
renderToString(LocalGraph({ graph }))
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
},
|
|
189
209
|
assets: [
|
|
190
210
|
{
|
|
191
211
|
pluginName: "local-graph",
|
|
@@ -195,6 +215,10 @@ function localGraphPlugin() {
|
|
|
195
215
|
]
|
|
196
216
|
});
|
|
197
217
|
}
|
|
218
|
+
function resolveTitle(slug, title) {
|
|
219
|
+
if (typeof title === "string" && title.trim()) return title;
|
|
220
|
+
return slug.split("/").at(-1) ?? slug;
|
|
221
|
+
}
|
|
198
222
|
export {
|
|
199
223
|
LocalGraph,
|
|
200
224
|
buildGraphEdges2 as buildGraphEdges,
|
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.18",
|
|
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.18"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"tsx": "^4.22.4",
|
|
29
|
-
"@riebeckite/test": "0.0.
|
|
29
|
+
"@riebeckite/test": "0.0.18"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|