@riebeckite/plugin-hover-preview 0.0.21 → 0.0.23
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 +3 -2
- package/README_ja.md +3 -2
- package/dist/index.js +29 -16
- package/dist/src/runtime.d.ts +3 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @riebeckite/plugin-hover-preview
|
|
2
2
|
|
|
3
|
+
<!-- Generated from docs/docs/plugins/hover-preview.md. Edit the canonical documentation in docs/docs/plugins and run `pnpm docs:sync`. -->
|
|
4
|
+
|
|
3
5
|
Quartz/Obsidian-Publish style popover previews for internal links. Hovering or
|
|
4
6
|
focusing a note link shows its title and a short excerpt without leaving the
|
|
5
7
|
page.
|
|
@@ -76,5 +78,4 @@ hoverPreviewPlugin({
|
|
|
76
78
|
|
|
77
79
|
## See also
|
|
78
80
|
|
|
79
|
-
- [Plugin guide](
|
|
80
|
-
|
|
81
|
+
- [Plugin guide](https://github.com/Rerurate514/riebeckite/blob/main/docs/docs/reference/plugin-api.md)
|
package/README_ja.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @riebeckite/plugin-hover-preview
|
|
2
2
|
|
|
3
|
+
<!-- Generated from docs/docs/plugins/hover-preview.ja.md. Edit the canonical documentation in docs/docs/plugins and run `pnpm docs:sync`. -->
|
|
4
|
+
|
|
3
5
|
内部リンクにカーソルを合わせると、リンク先のタイトルと抜粋をポップオーバーで表示するプラグインです。Quartz や Obsidian Publish のプレビューに近い挙動で、ページを離れずにリンク先の内容を確認できます。
|
|
4
6
|
|
|
5
7
|
[English](./README.md)
|
|
@@ -59,5 +61,4 @@ hoverPreviewPlugin({
|
|
|
59
61
|
|
|
60
62
|
## 関連資料
|
|
61
63
|
|
|
62
|
-
- [プラグインシステム](
|
|
63
|
-
|
|
64
|
+
- [プラグインシステム](https://github.com/Rerurate514/riebeckite/blob/main/docs/docs/reference/plugin-api.ja.md)
|
package/dist/index.js
CHANGED
|
@@ -89,18 +89,23 @@ function hasInternalLink(html) {
|
|
|
89
89
|
// src/runtime.ts
|
|
90
90
|
function createHoverPreviewRuntime(options) {
|
|
91
91
|
return {
|
|
92
|
-
|
|
93
|
-
const entries = shouldInclude ? manifest.entries.filter(shouldInclude) : manifest.entries;
|
|
92
|
+
plan(entries) {
|
|
94
93
|
const index = buildPreviewIndex(entries, {
|
|
95
94
|
excerptLength: options.excerptLength,
|
|
96
95
|
...options.maxEntries === void 0 ? {} : { maxEntries: options.maxEntries }
|
|
97
96
|
});
|
|
98
|
-
if (Object.keys(index).length === 0) return;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
97
|
+
if (Object.keys(index).length === 0) return [];
|
|
98
|
+
return [
|
|
99
|
+
{
|
|
100
|
+
path: HOVER_PREVIEW_INDEX_PATH,
|
|
101
|
+
content: JSON.stringify(index),
|
|
102
|
+
dependencies: [{ type: "global" }]
|
|
103
|
+
}
|
|
104
|
+
];
|
|
105
|
+
},
|
|
106
|
+
inject(manifest, shouldInclude) {
|
|
107
|
+
const entries = shouldInclude ? manifest.entries.filter(shouldInclude) : manifest.entries;
|
|
108
|
+
if (this.plan(entries).length === 0) return;
|
|
104
109
|
const payload = renderHoverPreviewPayload(
|
|
105
110
|
options,
|
|
106
111
|
`/${HOVER_PREVIEW_INDEX_PATH}`
|
|
@@ -309,19 +314,27 @@ function hoverPreviewPlugin(options = {}) {
|
|
|
309
314
|
version: "hover-preview-v1",
|
|
310
315
|
dependencyMode: "none"
|
|
311
316
|
},
|
|
312
|
-
|
|
317
|
+
contentOutputDependencies: [{ type: "global" }],
|
|
313
318
|
options,
|
|
314
319
|
validateOptions: validateHoverPreviewOptions,
|
|
315
320
|
onManifestCreated: (context) => {
|
|
316
321
|
const publicEntries = new Set(context.manifest.publicEntries);
|
|
317
|
-
runtime.inject(
|
|
318
|
-
context.manifest,
|
|
319
|
-
context.output,
|
|
320
|
-
(entry) => publicEntries.has(entry)
|
|
321
|
-
);
|
|
322
|
+
runtime.inject(context.manifest, (entry) => publicEntries.has(entry));
|
|
322
323
|
},
|
|
323
|
-
|
|
324
|
-
|
|
324
|
+
planGeneratedOutputs: ({ manifest }) => runtime.plan(manifest.routableEntries),
|
|
325
|
+
assets: [
|
|
326
|
+
createStyleAsset(
|
|
327
|
+
"hover-preview",
|
|
328
|
+
"@riebeckite/plugin-hover-preview/style.css"
|
|
329
|
+
)
|
|
330
|
+
],
|
|
331
|
+
clientEntries: [
|
|
332
|
+
createClientEntry(
|
|
333
|
+
"hover-preview",
|
|
334
|
+
"@riebeckite/plugin-hover-preview/client",
|
|
335
|
+
"initHoverPreview"
|
|
336
|
+
)
|
|
337
|
+
]
|
|
325
338
|
});
|
|
326
339
|
}
|
|
327
340
|
var hoverPreview = hoverPreviewPlugin;
|
package/dist/src/runtime.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { ContentManifest, ContentManifestEntry,
|
|
1
|
+
import type { ContentManifest, ContentManifestEntry, PlannedGeneratedOutput } from "@riebeckite/core";
|
|
2
2
|
import type { ResolvedHoverPreviewOptions } from "./types.js";
|
|
3
3
|
export type HoverPreviewRuntime = {
|
|
4
|
-
|
|
4
|
+
plan(entries: readonly ContentManifestEntry[]): readonly PlannedGeneratedOutput[];
|
|
5
|
+
inject(manifest: ContentManifest, shouldInclude?: (entry: ContentManifestEntry) => boolean): void;
|
|
5
6
|
};
|
|
6
7
|
export declare function createHoverPreviewRuntime(options: ResolvedHoverPreviewOptions): HoverPreviewRuntime;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-hover-preview",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.23",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"./style.css": "./style.css"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@riebeckite/core": "0.0.
|
|
24
|
+
"@riebeckite/core": "0.0.23"
|
|
25
25
|
},
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|