@riebeckite/plugin-docs 0.0.32 → 0.0.33

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 CHANGED
@@ -8,6 +8,10 @@ router or recalculating public URLs from filesystem paths.
8
8
 
9
9
  [日本語](./README_ja.md)
10
10
 
11
+ ## Live example
12
+
13
+ This page is a Docs entry. The Documentation sidebar on the right, the previous/next links below the article, and the [Docs index](/docs/) all come from this plugin.
14
+
11
15
  ## Installation
12
16
 
13
17
  ```sh
@@ -85,7 +89,7 @@ outside-root content does not appear in the sidebar or previous/next sequence.
85
89
 
86
90
  ## Exports
87
91
 
88
- - `docs(options)` / `docsPlugin(options)` — plugin factory
92
+ - `docs(options)` / `docs(options)` — plugin factory
89
93
  - `buildDocsNavigation(entries, options)` — build the framework-independent model
90
94
  - `flattenDocsNavigation(items)` — derive the previous/next sequence
91
95
  - `renderDocsSidebar(...)` and `renderDocsPrevNext(...)` — server HTML renderers
package/README_ja.md CHANGED
@@ -3,11 +3,15 @@
3
3
  <!-- Generated from docs/docs/plugins/docs.ja.md. Edit the canonical documentation in docs/docs/plugins and run `pnpm docs:sync`. -->
4
4
 
5
5
  Riebeckite の Markdown コンテンツから、Docs 用のサイドバーと前後ページリンクを
6
- ビルド時に生成するプラグインです。Docs 専用の router は追加せず、公開 URL も
6
+ ビルド時に生成するプラグインです。Docs 専用のルーターは追加せず、公開 URL も
7
7
  ファイルシステムのパスから再計算しません。
8
8
 
9
9
  [English](./README.md)
10
10
 
11
+ ## 実行例
12
+
13
+ このページは Docs のエントリです。右側の Documentation サイドバー、記事下の前後リンク、[Docs の一覧](/ja/docs/) はすべてこのプラグインが生成しています。
14
+
11
15
  ## インストール
12
16
 
13
17
  ```sh
@@ -34,7 +38,7 @@ export default defineConfig({
34
38
  `root` は Docs として扱うコンテンツサブツリーです。`root: "docs"` の場合、
35
39
  `content/docs/` 配下だけが対象になり、`notes/` や `blog/` には Docs の UI を出しません。
36
40
 
37
- ## Frontmatter
41
+ ## frontmatter
38
42
 
39
43
  ```yaml
40
44
  ---
@@ -47,12 +51,12 @@ sidebar:
47
51
  ---
48
52
  ```
49
53
 
50
- 対応するメタデータは次の通りです。
54
+ 対応するメタデータは次のとおりです。
51
55
 
52
56
  - `label`: ナビゲーションに表示する名前。未指定なら `title`、さらに未指定ならファイル名。
53
- - `order`: 明示的な並び順。未指定の項目は明示された order のあとを title、path の順に並びます。
57
+ - `order`: 明示的な並び順。指定のない項目は、`order` を持つ項目の後に、タイトル、パスの順で並びます。
54
58
  - `hidden`: サイドバーと前後ページリンクから除外します。
55
- - `collapsed`: Theme やクライアント側の拡張のために `data-docs-collapsed` として出力します。
59
+ - `collapsed`: Theme やクライアント側の拡張で使えるよう、`data-docs-collapsed` として出力します。
56
60
 
57
61
  これらのフィールドはすべて任意です。`sidebar` frontmatter のないページも
58
62
  ナビゲーションに表示されます。階層はフォルダ構造に従い、ラベルは `title`、
@@ -60,27 +64,27 @@ sidebar:
60
64
  設定ではなくコンテンツ側に置きます。上書きしたいフィールドだけを指定し、それ
61
65
  以外は Vault に手を入れないでください。
62
66
 
63
- ## Theme との統合
67
+ ## 出力と Theme の統合
64
68
 
65
- Plugin は React ライクな JSX コンポーネントをサイト統合に提供します。
69
+ プラグインは、サイトへ組み込むための React 風の JSX コンポーネントを提供します。
66
70
 
67
71
  - `<DocsSidebar items={...} currentPermalink? label? />` は `details.rb-docs-sidebar-details` と `nav.rb-docs-sidebar` を描画
68
72
  - `<DocsPrevNext previous? next? />` は `nav.rb-docs-prev-next` を描画
69
73
 
70
- クライアント `initDocsSidebar` がサイドバーを畳めるようにします。
74
+ クライアント側の `initDocsSidebar` を使うと、サイドバーを折りたためます。
71
75
 
72
76
  ## l10n と公開の境界
73
77
 
74
78
  `@riebeckite/plugin-l10n` のメタデータがある場合、現在の言語に対応する項目だけで
75
- ナビゲーションを作ります。URL は manifest の解決済み permalink をそのまま使うため、
76
- permalink / alias / rename / l10n の責務を壊しません。
79
+ ナビゲーションを作ります。URL はマニフェストの解決済みパーマリンクをそのまま使うため、
80
+ パーマリンク、エイリアス、リネーム、l10n の扱いはコンテンツ側の責務のままです。
77
81
 
78
82
  公開対象の項目だけを含めます。draft、private、excluded、hidden、root 外のコンテンツは
79
- サイドバーと前後ページリンクに出ません。
83
+ サイドバーと前後ページリンクに表示されません。
80
84
 
81
85
  ## エクスポート
82
86
 
83
- - `docs(options)` / `docsPlugin(options)`: プラグインファクトリ
87
+ - `docs(options)` / `docs(options)`: プラグインファクトリ
84
88
  - `buildDocsNavigation(entries, options)`: フレームワークに依存しないナビゲーションモデル
85
89
  - `flattenDocsNavigation(items)`: 前後ページリンク用の並び
86
90
  - `renderDocsSidebar(...)` / `renderDocsPrevNext(...)`: サーバー側の HTML レンダラー
@@ -3,6 +3,7 @@ export type DocsSidebarProps = {
3
3
  readonly items?: readonly DocsNavigationItem[];
4
4
  readonly currentPermalink?: string;
5
5
  readonly label?: string;
6
+ readonly placement?: "inline" | "article-rail";
6
7
  };
7
8
  declare const DocsSidebar: (props: Readonly<DocsSidebarProps>) => Promise<import("hono/utils/html").HtmlEscapedString>;
8
9
  export default DocsSidebar;
@@ -175,7 +175,7 @@ var DocsSidebar = (async (props) => {
175
175
  const label = props.label ?? options?.sidebar?.label ?? "Docs navigation";
176
176
  if (items.length === 0) return html``;
177
177
  const permalink = currentPermalink ?? "";
178
- return /* @__PURE__ */ jsxs("details", { class: "rb-docs-sidebar-details", "data-docs-sidebar-details": true, open: true, children: [
178
+ const sidebar = /* @__PURE__ */ jsxs("details", { class: "rb-docs-sidebar-details", "data-docs-sidebar-details": true, open: true, children: [
179
179
  /* @__PURE__ */ jsx("summary", { class: "rb-docs-sidebar-summary", children: label }),
180
180
  /* @__PURE__ */ jsx("nav", { class: "rb-docs-sidebar", "aria-label": label, "data-docs-sidebar": true, children: /* @__PURE__ */ jsx(
181
181
  DocsSidebarItems,
@@ -186,6 +186,7 @@ var DocsSidebar = (async (props) => {
186
186
  }
187
187
  ) })
188
188
  ] });
189
+ return props.placement === "article-rail" ? /* @__PURE__ */ jsx("aside", { class: "rb-docs-sidebar-rail", children: sidebar }) : sidebar;
189
190
  });
190
191
  function DocsSidebarItems({
191
192
  items,
package/dist/index.d.ts CHANGED
@@ -10,4 +10,3 @@ export { renderDocsPrevNext, renderDocsSidebar } from "./src/render.js";
10
10
  export type { DocsNavigationItem, DocsOptions, DocsSidebarFrontmatter, ResolvedDocsOptions, } from "./src/types.js";
11
11
  export declare const DOCS_PLUGIN_NAME = "docs";
12
12
  export declare function docs(options: DocsOptions): import("@riebeckite/core").RiebeckitePlugin<DocsOptions>;
13
- export declare const docsPlugin: typeof docs;
package/dist/index.js CHANGED
@@ -261,7 +261,7 @@ var DocsSidebar = (async (props) => {
261
261
  const label = props.label ?? options?.sidebar?.label ?? "Docs navigation";
262
262
  if (items.length === 0) return html2``;
263
263
  const permalink = currentPermalink ?? "";
264
- return /* @__PURE__ */ jsxs2("details", { class: "rb-docs-sidebar-details", "data-docs-sidebar-details": true, open: true, children: [
264
+ const sidebar = /* @__PURE__ */ jsxs2("details", { class: "rb-docs-sidebar-details", "data-docs-sidebar-details": true, open: true, children: [
265
265
  /* @__PURE__ */ jsx2("summary", { class: "rb-docs-sidebar-summary", children: label }),
266
266
  /* @__PURE__ */ jsx2("nav", { class: "rb-docs-sidebar", "aria-label": label, "data-docs-sidebar": true, children: /* @__PURE__ */ jsx2(
267
267
  DocsSidebarItems,
@@ -272,6 +272,7 @@ var DocsSidebar = (async (props) => {
272
272
  }
273
273
  ) })
274
274
  ] });
275
+ return props.placement === "article-rail" ? /* @__PURE__ */ jsx2("aside", { class: "rb-docs-sidebar-rail", children: sidebar }) : sidebar;
275
276
  });
276
277
  function DocsSidebarItems({
277
278
  items,
@@ -463,7 +464,6 @@ function docs(options) {
463
464
  ]
464
465
  });
465
466
  }
466
- var docsPlugin = docs;
467
467
  function validateDocsOptions(options) {
468
468
  const issues = [];
469
469
  if (!options || typeof options !== "object") {
@@ -486,7 +486,6 @@ export {
486
486
  docs_sidebar_default as DocsSidebar,
487
487
  buildDocsNavigation,
488
488
  docs,
489
- docsPlugin,
490
489
  flattenDocsNavigation,
491
490
  getDocsNavigation,
492
491
  getDocsPrevNext,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riebeckite/plugin-docs",
3
- "version": "0.0.32",
3
+ "version": "0.0.33",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -27,13 +27,13 @@
27
27
  "./style.css": "./style.css"
28
28
  },
29
29
  "dependencies": {
30
- "hono": "^4.12.25",
31
- "@riebeckite/core": "0.0.32",
32
- "@riebeckite/ui": "0.0.32"
30
+ "@riebeckite/core": "0.0.33",
31
+ "@riebeckite/ui": "0.0.33",
32
+ "hono": "^4.12.25"
33
33
  },
34
34
  "devDependencies": {
35
- "tsx": "^4.22.4",
36
- "@riebeckite/test": "0.0.32"
35
+ "@riebeckite/test": "0.0.33",
36
+ "tsx": "^4.22.4"
37
37
  },
38
38
  "publishConfig": {
39
39
  "access": "public"
package/style.css CHANGED
@@ -2,6 +2,43 @@
2
2
  --rb-docs-sidebar-collapsible: 1;
3
3
  }
4
4
 
5
+ .rb-docs-sidebar-rail {
6
+ display: none;
7
+ }
8
+
9
+ @media (min-width: 48rem) {
10
+ .rb-docs-sidebar-rail {
11
+ display: block;
12
+ min-width: 0;
13
+ margin-block: var(--rb-space-4);
14
+ }
15
+ }
16
+
17
+ @media (min-width: 88rem) {
18
+ :is(:root, .rb-theme-root)[data-article-layout="article"]
19
+ .rb-docs-sidebar-rail {
20
+ display: block;
21
+ grid-column: 1;
22
+ grid-row: 1;
23
+ position: sticky;
24
+ top: var(--rb-docs-rail-top);
25
+ align-self: start;
26
+ width: var(--rb-layout-sidebar);
27
+ max-height: var(--rb-docs-rail-max-block-size);
28
+ margin-block: 0;
29
+ margin-inline-start: calc(
30
+ -1 *
31
+ var(--rb-layout-sidebar) -
32
+ var(--rb-layout-gap)
33
+ );
34
+ overflow: auto;
35
+ padding-block: 0;
36
+ padding-inline-end: 1rem;
37
+ border-inline-end: 1px solid
38
+ color-mix(in oklab, currentColor 18%, transparent);
39
+ }
40
+ }
41
+
5
42
  .rb-docs-sidebar-details > .rb-docs-sidebar-summary {
6
43
  cursor: pointer;
7
44
  font-size: 0.95rem;