@riebeckite/plugin-excalibrain 0.0.14 → 0.0.16
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 +2 -1
- package/README_ja.md +4 -3
- package/dist/index.js +16 -18
- package/dist/src/types.d.ts +1 -0
- package/package.json +3 -3
package/README.md
CHANGED
package/README_ja.md
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
| Next | 右端 | `next` |
|
|
19
19
|
| Siblings | 周辺 | `sibling` |
|
|
20
20
|
|
|
21
|
-
関係は ExcaliBrain のオントロジーに従い、YAML
|
|
21
|
+
関係は ExcaliBrain のオントロジーに従い、YAML frontmatter と本文中の Dataview インラインフィールドから取得します。明示されていない関係は、コンテンツグラフから推論します。
|
|
22
22
|
|
|
23
23
|
## 設定する
|
|
24
24
|
|
|
@@ -42,7 +42,7 @@ export default defineConfig({
|
|
|
42
42
|
|
|
43
43
|
明示した関係は推論より優先されます。
|
|
44
44
|
|
|
45
|
-
### YAML
|
|
45
|
+
### YAML frontmatter
|
|
46
46
|
|
|
47
47
|
```md
|
|
48
48
|
---
|
|
@@ -149,4 +149,5 @@ related:: [[note-a]] and [[note-b]] are similar
|
|
|
149
149
|
|
|
150
150
|
## 関連資料
|
|
151
151
|
|
|
152
|
-
- [プラグインシステム](../../../docs/ja/reference/plugin-api.md)
|
|
152
|
+
- [プラグインシステム](../../../docs/ja/docs/reference/plugin-api.md)
|
|
153
|
+
|
package/dist/index.js
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
createClientEntry,
|
|
4
4
|
createStyleAsset,
|
|
5
|
-
definePlugin
|
|
6
|
-
isPublished
|
|
5
|
+
definePlugin
|
|
7
6
|
} from "@riebeckite/core";
|
|
8
7
|
|
|
9
8
|
// src/ontology.ts
|
|
@@ -247,7 +246,7 @@ function buildExcaliBrainGraph(input) {
|
|
|
247
246
|
const relations = /* @__PURE__ */ new Map();
|
|
248
247
|
const add = (target, role, relationType) => {
|
|
249
248
|
if (role === "center") return;
|
|
250
|
-
const node = resolveNode(target, slug, manifest);
|
|
249
|
+
const node = resolveNode(target, slug, manifest, input.isRoutable);
|
|
251
250
|
if (!node) return;
|
|
252
251
|
const existing = relations.get(node.id);
|
|
253
252
|
if (existing) {
|
|
@@ -313,11 +312,12 @@ function buildExcaliBrainGraph(input) {
|
|
|
313
312
|
}));
|
|
314
313
|
return { center, nodes, links };
|
|
315
314
|
}
|
|
316
|
-
function resolveNode(target, selfSlug, manifest) {
|
|
315
|
+
function resolveNode(target, selfSlug, manifest, isRoutable) {
|
|
317
316
|
const raw = target.trim();
|
|
318
317
|
if (!raw) return null;
|
|
319
318
|
const targetSlug = resolveSlug(raw, manifest);
|
|
320
319
|
if (targetSlug && targetSlug !== selfSlug) {
|
|
320
|
+
if (isRoutable && !isRoutable(targetSlug)) return null;
|
|
321
321
|
const entry = manifest.bySlug.get(targetSlug);
|
|
322
322
|
if (entry) {
|
|
323
323
|
return {
|
|
@@ -708,12 +708,11 @@ function createExcaliBrainRuntime(options) {
|
|
|
708
708
|
const notes = /* @__PURE__ */ new Map();
|
|
709
709
|
const resolved = resolveExcaliBrainOptions(options);
|
|
710
710
|
return {
|
|
711
|
-
track(slug, markdown
|
|
712
|
-
notes.set(slug, { markdown
|
|
711
|
+
track(slug, markdown) {
|
|
712
|
+
notes.set(slug, { markdown });
|
|
713
713
|
},
|
|
714
|
-
resolve(manifest,
|
|
715
|
-
for (const entry of manifest.
|
|
716
|
-
if (config && !isPublished(config, entry.frontmatter)) continue;
|
|
714
|
+
resolve(manifest, _config) {
|
|
715
|
+
for (const entry of manifest.publicEntries) {
|
|
717
716
|
const note = notes.get(entry.slug);
|
|
718
717
|
const markdown = note?.markdown ?? "";
|
|
719
718
|
const graph = buildExcaliBrainGraph({
|
|
@@ -721,7 +720,8 @@ function createExcaliBrainRuntime(options) {
|
|
|
721
720
|
frontmatter: entry.frontmatter,
|
|
722
721
|
markdown,
|
|
723
722
|
manifest,
|
|
724
|
-
options
|
|
723
|
+
options,
|
|
724
|
+
isRoutable: (candidate) => manifest.bySlug.get(candidate)?.publishing.routable ?? false
|
|
725
725
|
});
|
|
726
726
|
const layout = layoutExcaliBrain(graph, options);
|
|
727
727
|
const hasNeighbour = graph.nodes.length > 0;
|
|
@@ -736,15 +736,8 @@ function createExcaliBrainRuntime(options) {
|
|
|
736
736
|
});
|
|
737
737
|
if (hasFence) {
|
|
738
738
|
entry.html = replaceExcaliBrainPlaceholders(entry.html, section);
|
|
739
|
-
if (note) {
|
|
740
|
-
note.content.html = replaceExcaliBrainPlaceholders(
|
|
741
|
-
note.content.html,
|
|
742
|
-
section
|
|
743
|
-
);
|
|
744
|
-
}
|
|
745
739
|
} else {
|
|
746
740
|
entry.html = `${entry.html}${section}`;
|
|
747
|
-
if (note) note.content.html = `${note.content.html}${section}`;
|
|
748
741
|
}
|
|
749
742
|
}
|
|
750
743
|
}
|
|
@@ -756,13 +749,18 @@ function excaliBrain(options = {}) {
|
|
|
756
749
|
return definePlugin({
|
|
757
750
|
name: "excalibrain",
|
|
758
751
|
order: -10,
|
|
752
|
+
processedContentCache: {
|
|
753
|
+
version: "excalibrain-v1",
|
|
754
|
+
dependencyMode: "none"
|
|
755
|
+
},
|
|
756
|
+
outputDependencies: [{ type: "global" }],
|
|
759
757
|
options,
|
|
760
758
|
validateOptions: validateExcaliBrainOptions,
|
|
761
759
|
extendHtmlPipeline: (pipeline) => {
|
|
762
760
|
pipeline.use(rehypeExcaliBrain, { language });
|
|
763
761
|
},
|
|
764
762
|
onPostParsed: (context) => {
|
|
765
|
-
runtime.track(context.slug, context.markdown
|
|
763
|
+
runtime.track(context.slug, context.markdown);
|
|
766
764
|
},
|
|
767
765
|
onManifestCreated: (context) => {
|
|
768
766
|
runtime.resolve(context.manifest, context.config);
|
package/dist/src/types.d.ts
CHANGED
|
@@ -71,6 +71,7 @@ export type ExcaliBrainBuildInput = {
|
|
|
71
71
|
markdown: string;
|
|
72
72
|
manifest: ContentManifest;
|
|
73
73
|
options?: ExcaliBrainOptions;
|
|
74
|
+
isRoutable?: (slug: string) => boolean;
|
|
74
75
|
};
|
|
75
76
|
export type ExcaliBrainRegion = "parents" | "children" | "left-friends" | "right-friends" | "previous" | "next" | "siblings" | "center";
|
|
76
77
|
export type ExcaliBrainPositionedNode = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-excalibrain",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"./style.css": "./style.css"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@riebeckite/core": "0.0.
|
|
24
|
+
"@riebeckite/core": "0.0.16"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"tsx": "^4.22.4",
|
|
28
|
-
"@riebeckite/test": "0.0.
|
|
28
|
+
"@riebeckite/test": "0.0.16"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|