@riebeckite/plugin-dataview 0.0.13 → 0.0.15
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 +9 -8
- package/dist/index.js +5 -9
- package/dist/src/runtime.d.ts +1 -2
- package/package.json +2 -2
package/README.md
CHANGED
package/README_ja.md
CHANGED
|
@@ -18,7 +18,7 @@ LIMIT 10
|
|
|
18
18
|
```
|
|
19
19
|
````
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
ブロックはマニフェスト(全ノートの frontmatter・タグ・リンク・パーマリンク)を使って描画されます。DataviewJS(`dataviewjs`)には対応しません。そのブロックはコードブロックのまま残り、診断を 1 件出します。
|
|
22
22
|
|
|
23
23
|
## 設定
|
|
24
24
|
|
|
@@ -59,7 +59,7 @@ SORT file.date desc
|
|
|
59
59
|
|
|
60
60
|
### `TABLE`
|
|
61
61
|
|
|
62
|
-
`TABLE` は表を描画します。列を省略すると `file.link` の1列だけになります。列はフィールドパスで、`AS` で見出しを付けられます。
|
|
62
|
+
`TABLE` は表を描画します。列を省略すると `file.link` の 1 列だけになります。列はフィールドパスで、`AS` で見出しを付けられます。
|
|
63
63
|
|
|
64
64
|
```dataview
|
|
65
65
|
TABLE file.name AS "Name", status, priority
|
|
@@ -88,7 +88,7 @@ FROM #project
|
|
|
88
88
|
|
|
89
89
|
### `FROM`
|
|
90
90
|
|
|
91
|
-
`FROM` は候補となるノートを絞り込みます。使えるソースは次の3つです。
|
|
91
|
+
`FROM` は候補となるノートを絞り込みます。使えるソースは次の 3 つです。
|
|
92
92
|
|
|
93
93
|
| ソース | 意味 |
|
|
94
94
|
| --- | --- |
|
|
@@ -104,7 +104,7 @@ FROM (#project or #area) and "notes" and !#archive
|
|
|
104
104
|
|
|
105
105
|
### `WHERE`
|
|
106
106
|
|
|
107
|
-
`WHERE` は `file.*`
|
|
107
|
+
`WHERE` は `file.*` と frontmatter のフィールドに対する真偽式でノートを絞り込みます。
|
|
108
108
|
|
|
109
109
|
| 機能 | 例 |
|
|
110
110
|
| --- | --- |
|
|
@@ -116,7 +116,7 @@ FROM (#project or #area) and "notes" and !#archive
|
|
|
116
116
|
|
|
117
117
|
文字列の `=` / `!=` と `contains()` は大文字小文字を区別しません。`date()` はミリ秒のタイムスタンプ(または `null`)を返すので、`date(a) < date(b)` は時系列で比較できます。`null` や未定義の値は `<` / `>` を満たしません。
|
|
118
118
|
|
|
119
|
-
`file.*` で使えるフィールドは `file.name`、`file.title`、`file.slug`、`file.path`、`file.folder`、`file.link`、`file.permalink`、`file.url`、`file.tags`、`file.date`、`file.created`、`file.updated`、`file.published`
|
|
119
|
+
`file.*` で使えるフィールドは `file.name`、`file.title`、`file.slug`、`file.path`、`file.folder`、`file.link`、`file.permalink`、`file.url`、`file.tags`、`file.date`、`file.created`、`file.updated`、`file.published` です。それ以外は frontmatter のキーをそのまま名前で参照します(`status`、`priority`、`due` など)。
|
|
120
120
|
|
|
121
121
|
### `SORT`
|
|
122
122
|
|
|
@@ -167,10 +167,10 @@ SORT priority desc, file.name asc
|
|
|
167
167
|
## 制限事項
|
|
168
168
|
|
|
169
169
|
- **DataviewJS には対応しません。** `dataviewjs` は意図的に対象外です。
|
|
170
|
-
- **インラインフィールド(`field:: value`)には対応しません。**
|
|
170
|
+
- **インラインフィールド(`field:: value`)には対応しません。** 参照するのは frontmatter だけです。
|
|
171
171
|
- **`TABLE` の列はフィールドパスです。** 任意の式は書けません。見出しの変更は `AS "Label"` だけです(`file.size / 1024` のような計算列は不可)。
|
|
172
172
|
- **`TASK` が絞り込むのはノートです。** `FROM` / `WHERE` はタスクを含むノートに働きます。
|
|
173
|
-
- **`CALENDAR` が表示するのは1か月分**です。一致した日付のうち最も新しい月を描画します。
|
|
173
|
+
- **`CALENDAR` が表示するのは 1 か月分**です。一致した日付のうち最も新しい月を描画します。
|
|
174
174
|
- `file.size`、`file.mtime`、`file.ctime` はマニフェストから取得できず `undefined` になります。
|
|
175
175
|
- 結果はビルド時に確定します。dataview ブロックが生成したリンクはコンテンツグラフ(バックリンク)には含まれません。フルビルドでは常に正しく再計算されます。
|
|
176
176
|
|
|
@@ -188,4 +188,5 @@ SORT priority desc, file.name asc
|
|
|
188
188
|
|
|
189
189
|
## 関連資料
|
|
190
190
|
|
|
191
|
-
- [プラグインシステム](../../../docs/ja/reference/plugin-api.md)
|
|
191
|
+
- [プラグインシステム](../../../docs/ja/docs/reference/plugin-api.md)
|
|
192
|
+
|
package/dist/index.js
CHANGED
|
@@ -1134,11 +1134,7 @@ var DATAVIEWJS_MARKER = "language-dataviewjs";
|
|
|
1134
1134
|
var PLUGIN_NAME = "dataview";
|
|
1135
1135
|
function createDataviewRuntime(options = {}) {
|
|
1136
1136
|
const resolved = resolveDataviewOptions(options);
|
|
1137
|
-
const tracked = /* @__PURE__ */ new Map();
|
|
1138
1137
|
return {
|
|
1139
|
-
track(slug, content) {
|
|
1140
|
-
tracked.set(slug, content);
|
|
1141
|
-
},
|
|
1142
1138
|
resolve(manifest, diagnostics) {
|
|
1143
1139
|
for (const entry of manifest.entries) {
|
|
1144
1140
|
if (!entry.html.includes(DATAVIEW_ATTRIBUTE) && !entry.html.includes(DATAVIEWJS_MARKER)) {
|
|
@@ -1152,8 +1148,6 @@ function createDataviewRuntime(options = {}) {
|
|
|
1152
1148
|
);
|
|
1153
1149
|
if (html === entry.html) continue;
|
|
1154
1150
|
entry.html = html;
|
|
1155
|
-
const content = tracked.get(entry.slug);
|
|
1156
|
-
if (content) content.html = html;
|
|
1157
1151
|
}
|
|
1158
1152
|
}
|
|
1159
1153
|
};
|
|
@@ -1218,15 +1212,17 @@ function dataviewPlugin(options = {}) {
|
|
|
1218
1212
|
const runtime = createDataviewRuntime(options);
|
|
1219
1213
|
return definePlugin({
|
|
1220
1214
|
name: "dataview",
|
|
1215
|
+
processedContentCache: {
|
|
1216
|
+
version: "dataview-v1",
|
|
1217
|
+
dependencyMode: "none"
|
|
1218
|
+
},
|
|
1219
|
+
outputDependencies: [{ type: "global" }],
|
|
1221
1220
|
options,
|
|
1222
1221
|
provides: ["content.dataview"],
|
|
1223
1222
|
validateOptions: validateDataviewOptions,
|
|
1224
1223
|
extendMarkdownPipeline: (pipeline) => {
|
|
1225
1224
|
pipeline.use(remarkDataview, { language });
|
|
1226
1225
|
},
|
|
1227
|
-
onPostProcessed: (context) => {
|
|
1228
|
-
runtime.track(context.slug, context.content);
|
|
1229
|
-
},
|
|
1230
1226
|
onManifestCreated: (context) => {
|
|
1231
1227
|
runtime.resolve(context.manifest, context.diagnostics);
|
|
1232
1228
|
},
|
package/dist/src/runtime.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { ContentManifest, Diagnostic
|
|
1
|
+
import type { ContentManifest, Diagnostic } from "@riebeckite/core";
|
|
2
2
|
import { type DataviewOptions } from "./types.js";
|
|
3
3
|
export type DataviewRuntime = {
|
|
4
|
-
track(slug: string, content: PostContent): void;
|
|
5
4
|
resolve(manifest: ContentManifest, diagnostics: Diagnostic[]): void;
|
|
6
5
|
};
|
|
7
6
|
export declare function createDataviewRuntime(options?: DataviewOptions): DataviewRuntime;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-dataview",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@types/mdast": "^4.0.4",
|
|
19
19
|
"unist-util-visit": "^5.1.0",
|
|
20
|
-
"@riebeckite/core": "0.0.
|
|
20
|
+
"@riebeckite/core": "0.0.15"
|
|
21
21
|
},
|
|
22
22
|
"publishConfig": {
|
|
23
23
|
"access": "public"
|