@riebeckite/plugin-query 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 +122 -122
- package/README_ja.md +114 -114
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,122 +1,122 @@
|
|
|
1
|
-
# @riebeckite/plugin-query
|
|
2
|
-
|
|
3
|
-
Turn `query` code blocks into lists or tables of content. Filtering, sorting,
|
|
4
|
-
and pagination run against frontmatter and tags at build time, so no client-side
|
|
5
|
-
JavaScript is required.
|
|
6
|
-
|
|
7
|
-
[日本語](./README_ja.md)
|
|
8
|
-
|
|
9
|
-
## Overview
|
|
10
|
-
|
|
11
|
-
`queryPlugin()` recognises fenced blocks
|
|
12
|
-
|
|
13
|
-
````md
|
|
14
|
-
```query
|
|
15
|
-
filter:
|
|
16
|
-
tags:
|
|
17
|
-
any: [diary]
|
|
18
|
-
sort:
|
|
19
|
-
field: date
|
|
20
|
-
order: desc
|
|
21
|
-
limit: 5
|
|
22
|
-
```
|
|
23
|
-
````
|
|
24
|
-
|
|
25
|
-
and renders them using the content manifest (every note's frontmatter, tags, and
|
|
26
|
-
permalink).
|
|
27
|
-
|
|
28
|
-
## Usage
|
|
29
|
-
|
|
30
|
-
```ts
|
|
31
|
-
import { defineConfig } from "@riebeckite/core";
|
|
32
|
-
import { queryPlugin } from "@riebeckite/plugin-query";
|
|
33
|
-
|
|
34
|
-
export default defineConfig({
|
|
35
|
-
// ...
|
|
36
|
-
plugins: [queryPlugin()],
|
|
37
|
-
});
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## Block syntax
|
|
41
|
-
|
|
42
|
-
The block body is a YAML mapping. Every field is optional.
|
|
43
|
-
|
|
44
|
-
| Field | Type | Description |
|
|
45
|
-
| ----- | ---- | ----------- |
|
|
46
|
-
| `filter` | object | Filtering conditions (below) |
|
|
47
|
-
| `sort` | object \| object[] | `field` (a frontmatter key, `title`, `slug`, or `permalink`) and `order` (`asc` / `desc`, default `asc`). The default field is `date` |
|
|
48
|
-
| `limit` | number | Maximum number of entries |
|
|
49
|
-
| `offset` | number | Entries to skip from the top |
|
|
50
|
-
| `format` | `"table"` \| `"list"` | Output format. Defaults to `table` |
|
|
51
|
-
| `columns` | string[] | Table columns: presets (`title`, `date`, `updated`, `created`, `published`, `tags`, `description`, `permalink`) or frontmatter keys |
|
|
52
|
-
| `excludeSelf` | boolean | Exclude the note hosting the block from its own results |
|
|
53
|
-
| `empty` | string | Message shown when nothing matches |
|
|
54
|
-
|
|
55
|
-
### `filter`
|
|
56
|
-
|
|
57
|
-
| Field | Type | Description |
|
|
58
|
-
| ----- | ---- | ----------- |
|
|
59
|
-
| `tags.any` | string[] | Has at least one of these tags |
|
|
60
|
-
| `tags.all` | string[] | Has every one of these tags |
|
|
61
|
-
| `tags.none` | string[] | Has none of these tags |
|
|
62
|
-
| `folder` | string \| string[] | Slug prefix match |
|
|
63
|
-
| `frontmatter` | object | Frontmatter equality. An array matches any member; string comparisons are case-insensitive |
|
|
64
|
-
| `date` | object | `field` (default `date`) plus inclusive `from` / `to` bounds |
|
|
65
|
-
|
|
66
|
-
```yaml
|
|
67
|
-
filter:
|
|
68
|
-
tags:
|
|
69
|
-
any: [diary, note]
|
|
70
|
-
none: [draft]
|
|
71
|
-
folder: articles
|
|
72
|
-
frontmatter:
|
|
73
|
-
draft: false
|
|
74
|
-
date:
|
|
75
|
-
field: published
|
|
76
|
-
from: 2024-01-01
|
|
77
|
-
to: 2024-12-31
|
|
78
|
-
sort:
|
|
79
|
-
- field: date
|
|
80
|
-
order: desc
|
|
81
|
-
- field: title
|
|
82
|
-
limit: 10
|
|
83
|
-
format: list
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
## Options
|
|
87
|
-
|
|
88
|
-
| Option | Type | Default | Description |
|
|
89
|
-
| ------ | ---- | ------- | ----------- |
|
|
90
|
-
| `className` | `string` | `"rr-query"` | Root CSS class |
|
|
91
|
-
| `language` | `string` | `"query"` | Fence language to target |
|
|
92
|
-
| `defaultFormat` | `"table"` \| `"list"` | `"table"` | Format when a block omits `format` |
|
|
93
|
-
| `defaultColumns` | `string[]` | `["title", "date"]` | Columns when a block omits `columns` |
|
|
94
|
-
| `defaultSort` | object | none | Sort when a block omits `sort` |
|
|
95
|
-
| `defaultLimit` | `number` | none | Row cap when a block omits `limit` |
|
|
96
|
-
| `emptyMessage` | `string` | `"No matching content."` | Empty-state message |
|
|
97
|
-
| `excludeSelf` | `boolean` | `false` | Exclude the host page by default |
|
|
98
|
-
|
|
99
|
-
## Diagnostics
|
|
100
|
-
|
|
101
|
-
A block that is not valid YAML (or not a mapping) renders an inline error and
|
|
102
|
-
emits a `content-query-invalid` error diagnostic. Unknown fields emit a
|
|
103
|
-
`content-query-unknown-field` warning.
|
|
104
|
-
|
|
105
|
-
## Limitations
|
|
106
|
-
|
|
107
|
-
- Links produced by a query are not added to the content graph (backlinks).
|
|
108
|
-
Only links written in the source Markdown participate.
|
|
109
|
-
- Results are fixed at build time. Rebuilding a host note when a queried note
|
|
110
|
-
changes is future work; a full build always recomputes correctly.
|
|
111
|
-
|
|
112
|
-
## Exports
|
|
113
|
-
|
|
114
|
-
- `queryPlugin(options?)` — plugin factory
|
|
115
|
-
- `remarkQuery(options?)` — remark transform usable on its own (`options.language` selects the fence language)
|
|
116
|
-
- `queryContentEntries(entries, spec)` — the Core matching engine (also
|
|
117
|
-
available from `@riebeckite/core`)
|
|
118
|
-
- Types: `QueryOptions`, `QuerySpec`, `QueryOutputFormat`
|
|
119
|
-
|
|
120
|
-
## See also
|
|
121
|
-
|
|
122
|
-
- [Plugin guide](../../../docs/en/plugin-
|
|
1
|
+
# @riebeckite/plugin-query
|
|
2
|
+
|
|
3
|
+
Turn `query` code blocks into lists or tables of content. Filtering, sorting,
|
|
4
|
+
and pagination run against frontmatter and tags at build time, so no client-side
|
|
5
|
+
JavaScript is required.
|
|
6
|
+
|
|
7
|
+
[日本語](./README_ja.md)
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
`queryPlugin()` recognises fenced blocks
|
|
12
|
+
|
|
13
|
+
````md
|
|
14
|
+
```query
|
|
15
|
+
filter:
|
|
16
|
+
tags:
|
|
17
|
+
any: [diary]
|
|
18
|
+
sort:
|
|
19
|
+
field: date
|
|
20
|
+
order: desc
|
|
21
|
+
limit: 5
|
|
22
|
+
```
|
|
23
|
+
````
|
|
24
|
+
|
|
25
|
+
and renders them using the content manifest (every note's frontmatter, tags, and
|
|
26
|
+
permalink).
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { defineConfig } from "@riebeckite/core";
|
|
32
|
+
import { queryPlugin } from "@riebeckite/plugin-query";
|
|
33
|
+
|
|
34
|
+
export default defineConfig({
|
|
35
|
+
// ...
|
|
36
|
+
plugins: [queryPlugin()],
|
|
37
|
+
});
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Block syntax
|
|
41
|
+
|
|
42
|
+
The block body is a YAML mapping. Every field is optional.
|
|
43
|
+
|
|
44
|
+
| Field | Type | Description |
|
|
45
|
+
| ----- | ---- | ----------- |
|
|
46
|
+
| `filter` | object | Filtering conditions (below) |
|
|
47
|
+
| `sort` | object \| object[] | `field` (a frontmatter key, `title`, `slug`, or `permalink`) and `order` (`asc` / `desc`, default `asc`). The default field is `date` |
|
|
48
|
+
| `limit` | number | Maximum number of entries |
|
|
49
|
+
| `offset` | number | Entries to skip from the top |
|
|
50
|
+
| `format` | `"table"` \| `"list"` | Output format. Defaults to `table` |
|
|
51
|
+
| `columns` | string[] | Table columns: presets (`title`, `date`, `updated`, `created`, `published`, `tags`, `description`, `permalink`) or frontmatter keys |
|
|
52
|
+
| `excludeSelf` | boolean | Exclude the note hosting the block from its own results |
|
|
53
|
+
| `empty` | string | Message shown when nothing matches |
|
|
54
|
+
|
|
55
|
+
### `filter`
|
|
56
|
+
|
|
57
|
+
| Field | Type | Description |
|
|
58
|
+
| ----- | ---- | ----------- |
|
|
59
|
+
| `tags.any` | string[] | Has at least one of these tags |
|
|
60
|
+
| `tags.all` | string[] | Has every one of these tags |
|
|
61
|
+
| `tags.none` | string[] | Has none of these tags |
|
|
62
|
+
| `folder` | string \| string[] | Slug prefix match |
|
|
63
|
+
| `frontmatter` | object | Frontmatter equality. An array matches any member; string comparisons are case-insensitive |
|
|
64
|
+
| `date` | object | `field` (default `date`) plus inclusive `from` / `to` bounds |
|
|
65
|
+
|
|
66
|
+
```yaml
|
|
67
|
+
filter:
|
|
68
|
+
tags:
|
|
69
|
+
any: [diary, note]
|
|
70
|
+
none: [draft]
|
|
71
|
+
folder: articles
|
|
72
|
+
frontmatter:
|
|
73
|
+
draft: false
|
|
74
|
+
date:
|
|
75
|
+
field: published
|
|
76
|
+
from: 2024-01-01
|
|
77
|
+
to: 2024-12-31
|
|
78
|
+
sort:
|
|
79
|
+
- field: date
|
|
80
|
+
order: desc
|
|
81
|
+
- field: title
|
|
82
|
+
limit: 10
|
|
83
|
+
format: list
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Options
|
|
87
|
+
|
|
88
|
+
| Option | Type | Default | Description |
|
|
89
|
+
| ------ | ---- | ------- | ----------- |
|
|
90
|
+
| `className` | `string` | `"rr-query"` | Root CSS class |
|
|
91
|
+
| `language` | `string` | `"query"` | Fence language to target |
|
|
92
|
+
| `defaultFormat` | `"table"` \| `"list"` | `"table"` | Format when a block omits `format` |
|
|
93
|
+
| `defaultColumns` | `string[]` | `["title", "date"]` | Columns when a block omits `columns` |
|
|
94
|
+
| `defaultSort` | object | none | Sort when a block omits `sort` |
|
|
95
|
+
| `defaultLimit` | `number` | none | Row cap when a block omits `limit` |
|
|
96
|
+
| `emptyMessage` | `string` | `"No matching content."` | Empty-state message |
|
|
97
|
+
| `excludeSelf` | `boolean` | `false` | Exclude the host page by default |
|
|
98
|
+
|
|
99
|
+
## Diagnostics
|
|
100
|
+
|
|
101
|
+
A block that is not valid YAML (or not a mapping) renders an inline error and
|
|
102
|
+
emits a `content-query-invalid` error diagnostic. Unknown fields emit a
|
|
103
|
+
`content-query-unknown-field` warning.
|
|
104
|
+
|
|
105
|
+
## Limitations
|
|
106
|
+
|
|
107
|
+
- Links produced by a query are not added to the content graph (backlinks).
|
|
108
|
+
Only links written in the source Markdown participate.
|
|
109
|
+
- Results are fixed at build time. Rebuilding a host note when a queried note
|
|
110
|
+
changes is future work; a full build always recomputes correctly.
|
|
111
|
+
|
|
112
|
+
## Exports
|
|
113
|
+
|
|
114
|
+
- `queryPlugin(options?)` — plugin factory
|
|
115
|
+
- `remarkQuery(options?)` — remark transform usable on its own (`options.language` selects the fence language)
|
|
116
|
+
- `queryContentEntries(entries, spec)` — the Core matching engine (also
|
|
117
|
+
available from `@riebeckite/core`)
|
|
118
|
+
- Types: `QueryOptions`, `QuerySpec`, `QueryOutputFormat`
|
|
119
|
+
|
|
120
|
+
## See also
|
|
121
|
+
|
|
122
|
+
- [Plugin guide](../../../docs/en/reference/plugin-api.md)
|
package/README_ja.md
CHANGED
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
# @riebeckite/plugin-query
|
|
2
|
-
|
|
3
|
-
`query` コードブロックを、コンテンツの一覧(表またはリスト)に変換するプラグインです。絞り込み・並べ替え・件数制限をフロントマターとタグに対して行い、ビルド時に HTML を生成します。クライアント側の JavaScript は不要です。
|
|
4
|
-
|
|
5
|
-
[English](./README.md)
|
|
6
|
-
|
|
7
|
-
## できること
|
|
8
|
-
|
|
9
|
-
`queryPlugin()` は Markdown 中のフェンスコードブロック
|
|
10
|
-
|
|
11
|
-
````md
|
|
12
|
-
```query
|
|
13
|
-
filter:
|
|
14
|
-
tags:
|
|
15
|
-
any: [diary]
|
|
16
|
-
sort:
|
|
17
|
-
field: date
|
|
18
|
-
order: desc
|
|
19
|
-
limit: 5
|
|
20
|
-
```
|
|
21
|
-
````
|
|
22
|
-
|
|
23
|
-
を検出し、マニフェスト(全ノートのフロントマター・タグ・パーマリンク)を使って結果を描画します。
|
|
24
|
-
|
|
25
|
-
## 設定
|
|
26
|
-
|
|
27
|
-
```ts
|
|
28
|
-
import { defineConfig } from "@riebeckite/core";
|
|
29
|
-
import { queryPlugin } from "@riebeckite/plugin-query";
|
|
30
|
-
|
|
31
|
-
export default defineConfig({
|
|
32
|
-
// ...
|
|
33
|
-
plugins: [queryPlugin()],
|
|
34
|
-
});
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## ブロックの書き方
|
|
38
|
-
|
|
39
|
-
ブロック本文は YAML のマッピングです。すべて省略できます。
|
|
40
|
-
|
|
41
|
-
| フィールド | 型 | 内容 |
|
|
42
|
-
| --- | --- | --- |
|
|
43
|
-
| `filter` | object | 絞り込み条件(下記) |
|
|
44
|
-
| `sort` | object \| object[] | 並べ替え。`field`(フロントマターキー、`title`、`slug`、`permalink`)と `order`(`asc` / `desc`、既定 `asc`)。既定のフィールドは `date` |
|
|
45
|
-
| `limit` | number | 最大件数 |
|
|
46
|
-
| `offset` | number | 先頭から読み飛ばす件数 |
|
|
47
|
-
| `format` | `"table"` \| `"list"` | 表示形式。既定は `table` |
|
|
48
|
-
| `columns` | string[] | 表の列。プリセット(`title`、`date`、`updated`、`created`、`published`、`tags`、`description`、`permalink`)またはフロントマターキー |
|
|
49
|
-
| `excludeSelf` | boolean | このブロックを含むノート自身を結果から除く |
|
|
50
|
-
| `empty` | string | 一致が無いときのメッセージ |
|
|
51
|
-
|
|
52
|
-
### `filter`
|
|
53
|
-
|
|
54
|
-
| フィールド | 型 | 内容 |
|
|
55
|
-
| --- | --- | --- |
|
|
56
|
-
| `tags.any` | string[] | いずれかのタグを持つ |
|
|
57
|
-
| `tags.all` | string[] | すべてのタグを持つ |
|
|
58
|
-
| `tags.none` | string[] | どのタグも持たない |
|
|
59
|
-
| `folder` | string \| string[] | スラッグの前方一致 |
|
|
60
|
-
| `frontmatter` | object | フロントマターの一致。値が配列ならそのいずれかに一致。文字列比較は大文字小文字を区別しない |
|
|
61
|
-
| `date` | object | `field`(既定 `date`)と `from` / `to`(両端を含む) |
|
|
62
|
-
|
|
63
|
-
```yaml
|
|
64
|
-
filter:
|
|
65
|
-
tags:
|
|
66
|
-
any: [diary, note]
|
|
67
|
-
none: [draft]
|
|
68
|
-
folder: articles
|
|
69
|
-
frontmatter:
|
|
70
|
-
draft: false
|
|
71
|
-
date:
|
|
72
|
-
field: published
|
|
73
|
-
from: 2024-01-01
|
|
74
|
-
to: 2024-12-31
|
|
75
|
-
sort:
|
|
76
|
-
- field: date
|
|
77
|
-
order: desc
|
|
78
|
-
- field: title
|
|
79
|
-
limit: 10
|
|
80
|
-
format: list
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## オプション
|
|
84
|
-
|
|
85
|
-
| オプション | 型 | 既定値 | 内容 |
|
|
86
|
-
| --- | --- | --- | --- |
|
|
87
|
-
| `className` | `string` | `"rr-query"` | ルート要素の CSS クラス |
|
|
88
|
-
| `language` | `string` | `"query"` | 対象のフェンス言語 |
|
|
89
|
-
| `defaultFormat` | `"table"` \| `"list"` | `"table"` | ブロックが `format` を省略したときの形式 |
|
|
90
|
-
| `defaultColumns` | `string[]` | `["title", "date"]` | ブロックが `columns` を省略したときの列 |
|
|
91
|
-
| `defaultSort` | object | なし | ブロックが `sort` を省略したときの並べ替え |
|
|
92
|
-
| `defaultLimit` | `number` | なし | ブロックが `limit` を省略したときの上限 |
|
|
93
|
-
| `emptyMessage` | `string` | `"No matching content."` | 空結果のメッセージ |
|
|
94
|
-
| `excludeSelf` | `boolean` | `false` | 既定で自身を除外する |
|
|
95
|
-
|
|
96
|
-
## 診断
|
|
97
|
-
|
|
98
|
-
不正な YAML やマッピングでないブロックは、その場にエラー表示を出しつつ、`content-query-invalid` のエラー診断を生成します。未知のフィールドは `content-query-unknown-field` の警告になります。
|
|
99
|
-
|
|
100
|
-
## 制限事項
|
|
101
|
-
|
|
102
|
-
- クエリ結果として生成したリンクは、コンテンツグラフ(バックリンク)には含まれません。元の Markdown に書かれたリンクだけが対象です。
|
|
103
|
-
- 結果はビルド時に確定します。クエリ対象ノートの変更でホストノートを再生成する増分最適化は今後の課題です(フルビルドでは正しく再計算されます)。
|
|
104
|
-
|
|
105
|
-
## エクスポート
|
|
106
|
-
|
|
107
|
-
- `queryPlugin(options?)` — プラグインファクトリ
|
|
108
|
-
- `remarkQuery(options?)` — Remark 変換だけを利用する場合の API(`options.language` でフェンス言語を指定)
|
|
109
|
-
- `queryContentEntries(entries, spec)` — Core の照合エンジン(`@riebeckite/core` からも利用可能)
|
|
110
|
-
- 型: `QueryOptions`、`QuerySpec`、`QueryOutputFormat`
|
|
111
|
-
|
|
112
|
-
## 関連資料
|
|
113
|
-
|
|
114
|
-
- [プラグインシステム](../../../docs/ja/plugin-
|
|
1
|
+
# @riebeckite/plugin-query
|
|
2
|
+
|
|
3
|
+
`query` コードブロックを、コンテンツの一覧(表またはリスト)に変換するプラグインです。絞り込み・並べ替え・件数制限をフロントマターとタグに対して行い、ビルド時に HTML を生成します。クライアント側の JavaScript は不要です。
|
|
4
|
+
|
|
5
|
+
[English](./README.md)
|
|
6
|
+
|
|
7
|
+
## できること
|
|
8
|
+
|
|
9
|
+
`queryPlugin()` は Markdown 中のフェンスコードブロック
|
|
10
|
+
|
|
11
|
+
````md
|
|
12
|
+
```query
|
|
13
|
+
filter:
|
|
14
|
+
tags:
|
|
15
|
+
any: [diary]
|
|
16
|
+
sort:
|
|
17
|
+
field: date
|
|
18
|
+
order: desc
|
|
19
|
+
limit: 5
|
|
20
|
+
```
|
|
21
|
+
````
|
|
22
|
+
|
|
23
|
+
を検出し、マニフェスト(全ノートのフロントマター・タグ・パーマリンク)を使って結果を描画します。
|
|
24
|
+
|
|
25
|
+
## 設定
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { defineConfig } from "@riebeckite/core";
|
|
29
|
+
import { queryPlugin } from "@riebeckite/plugin-query";
|
|
30
|
+
|
|
31
|
+
export default defineConfig({
|
|
32
|
+
// ...
|
|
33
|
+
plugins: [queryPlugin()],
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## ブロックの書き方
|
|
38
|
+
|
|
39
|
+
ブロック本文は YAML のマッピングです。すべて省略できます。
|
|
40
|
+
|
|
41
|
+
| フィールド | 型 | 内容 |
|
|
42
|
+
| --- | --- | --- |
|
|
43
|
+
| `filter` | object | 絞り込み条件(下記) |
|
|
44
|
+
| `sort` | object \| object[] | 並べ替え。`field`(フロントマターキー、`title`、`slug`、`permalink`)と `order`(`asc` / `desc`、既定 `asc`)。既定のフィールドは `date` |
|
|
45
|
+
| `limit` | number | 最大件数 |
|
|
46
|
+
| `offset` | number | 先頭から読み飛ばす件数 |
|
|
47
|
+
| `format` | `"table"` \| `"list"` | 表示形式。既定は `table` |
|
|
48
|
+
| `columns` | string[] | 表の列。プリセット(`title`、`date`、`updated`、`created`、`published`、`tags`、`description`、`permalink`)またはフロントマターキー |
|
|
49
|
+
| `excludeSelf` | boolean | このブロックを含むノート自身を結果から除く |
|
|
50
|
+
| `empty` | string | 一致が無いときのメッセージ |
|
|
51
|
+
|
|
52
|
+
### `filter`
|
|
53
|
+
|
|
54
|
+
| フィールド | 型 | 内容 |
|
|
55
|
+
| --- | --- | --- |
|
|
56
|
+
| `tags.any` | string[] | いずれかのタグを持つ |
|
|
57
|
+
| `tags.all` | string[] | すべてのタグを持つ |
|
|
58
|
+
| `tags.none` | string[] | どのタグも持たない |
|
|
59
|
+
| `folder` | string \| string[] | スラッグの前方一致 |
|
|
60
|
+
| `frontmatter` | object | フロントマターの一致。値が配列ならそのいずれかに一致。文字列比較は大文字小文字を区別しない |
|
|
61
|
+
| `date` | object | `field`(既定 `date`)と `from` / `to`(両端を含む) |
|
|
62
|
+
|
|
63
|
+
```yaml
|
|
64
|
+
filter:
|
|
65
|
+
tags:
|
|
66
|
+
any: [diary, note]
|
|
67
|
+
none: [draft]
|
|
68
|
+
folder: articles
|
|
69
|
+
frontmatter:
|
|
70
|
+
draft: false
|
|
71
|
+
date:
|
|
72
|
+
field: published
|
|
73
|
+
from: 2024-01-01
|
|
74
|
+
to: 2024-12-31
|
|
75
|
+
sort:
|
|
76
|
+
- field: date
|
|
77
|
+
order: desc
|
|
78
|
+
- field: title
|
|
79
|
+
limit: 10
|
|
80
|
+
format: list
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## オプション
|
|
84
|
+
|
|
85
|
+
| オプション | 型 | 既定値 | 内容 |
|
|
86
|
+
| --- | --- | --- | --- |
|
|
87
|
+
| `className` | `string` | `"rr-query"` | ルート要素の CSS クラス |
|
|
88
|
+
| `language` | `string` | `"query"` | 対象のフェンス言語 |
|
|
89
|
+
| `defaultFormat` | `"table"` \| `"list"` | `"table"` | ブロックが `format` を省略したときの形式 |
|
|
90
|
+
| `defaultColumns` | `string[]` | `["title", "date"]` | ブロックが `columns` を省略したときの列 |
|
|
91
|
+
| `defaultSort` | object | なし | ブロックが `sort` を省略したときの並べ替え |
|
|
92
|
+
| `defaultLimit` | `number` | なし | ブロックが `limit` を省略したときの上限 |
|
|
93
|
+
| `emptyMessage` | `string` | `"No matching content."` | 空結果のメッセージ |
|
|
94
|
+
| `excludeSelf` | `boolean` | `false` | 既定で自身を除外する |
|
|
95
|
+
|
|
96
|
+
## 診断
|
|
97
|
+
|
|
98
|
+
不正な YAML やマッピングでないブロックは、その場にエラー表示を出しつつ、`content-query-invalid` のエラー診断を生成します。未知のフィールドは `content-query-unknown-field` の警告になります。
|
|
99
|
+
|
|
100
|
+
## 制限事項
|
|
101
|
+
|
|
102
|
+
- クエリ結果として生成したリンクは、コンテンツグラフ(バックリンク)には含まれません。元の Markdown に書かれたリンクだけが対象です。
|
|
103
|
+
- 結果はビルド時に確定します。クエリ対象ノートの変更でホストノートを再生成する増分最適化は今後の課題です(フルビルドでは正しく再計算されます)。
|
|
104
|
+
|
|
105
|
+
## エクスポート
|
|
106
|
+
|
|
107
|
+
- `queryPlugin(options?)` — プラグインファクトリ
|
|
108
|
+
- `remarkQuery(options?)` — Remark 変換だけを利用する場合の API(`options.language` でフェンス言語を指定)
|
|
109
|
+
- `queryContentEntries(entries, spec)` — Core の照合エンジン(`@riebeckite/core` からも利用可能)
|
|
110
|
+
- 型: `QueryOptions`、`QuerySpec`、`QueryOutputFormat`
|
|
111
|
+
|
|
112
|
+
## 関連資料
|
|
113
|
+
|
|
114
|
+
- [プラグインシステム](../../../docs/ja/reference/plugin-api.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-query",
|
|
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",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
"@types/mdast": "^4.0.4",
|
|
19
19
|
"unist-util-visit": "^5.1.0",
|
|
20
20
|
"vfile-matter": "^5.0.1",
|
|
21
|
-
"@riebeckite/core": "0.0.
|
|
21
|
+
"@riebeckite/core": "0.0.13"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"tsx": "^4.22.4",
|
|
25
|
-
"@riebeckite/test": "0.0.
|
|
25
|
+
"@riebeckite/test": "0.0.13"
|
|
26
26
|
},
|
|
27
27
|
"publishConfig": {
|
|
28
28
|
"access": "public"
|