@riebeckite/plugin-sidenotes 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
@@ -61,6 +61,12 @@ To render margin notes instead:
61
61
  plugins: [sidenotes({ placement: "margin" })];
62
62
  ```
63
63
 
64
+ ## Live example
65
+
66
+ A footnote reference appears here.[^live-example]
67
+
68
+ [^live-example]: The note is rendered by the sidenotes plugin.
69
+
64
70
  ## Options
65
71
 
66
72
  | Option | Type | Default | Description |
@@ -133,7 +139,7 @@ Stable hooks follow the `rr-sidenotes` convention: `rr-sidenotes__toggle`,
133
139
  ## Exports
134
140
 
135
141
  - `sidenotes(options?)` — plugin factory
136
- - `sidenotesPlugin` — alias of `sidenotes`
142
+ - `sidenotes` — alias of `sidenotes`
137
143
  - `rehypeSidenotes(options?)` — the rehype transformer
138
144
  - `resolveSidenotesOptions(options?)` — apply option defaults
139
145
  - `renderSidenotesReference(input)` / `renderSidenotesNote(input)` — HTML builders
package/README_ja.md CHANGED
@@ -2,17 +2,13 @@
2
2
 
3
3
  <!-- Generated from docs/docs/plugins/sidenotes.ja.md. Edit the canonical documentation in docs/docs/plugins and run `pnpm docs:sync`. -->
4
4
 
5
- Riebeckite 用の脚注スタイル・プラグインです。執筆者は通常の GFM 脚注
6
- (`[^1]` と `[^1]: 本文`)をそのまま書き続けます。既定では脚注定義は記事末尾の
7
- 脚注リストに残ります。`placement: "margin"` を指定すると、Tufte スタイルの
8
- マージンノートとして参照の横に表示します。
5
+ Riebeckite 用の脚注スタイルプラグインです。執筆者は通常の GFM 脚注(`[^1]` と `[^1]: 本文`)をそのまま書き続けます。既定では脚注定義は記事末尾の脚注リストに残ります。`placement: "margin"` を指定すると、Tufte スタイルのマージンノートとして参照の横に表示します。
9
6
 
10
7
  [English](./README.md)
11
8
 
12
9
  ## 仕組み
13
10
 
14
- このプラグインは、`remark-gfm` の出力をコアのパイプラインが脚注マークアップ
15
- に変換したものを、rehype プラグインで読み取ります。
11
+ このプラグインは、コアのパイプラインが `remark-gfm` の出力を脚注マークアップに変換した後、rehype プラグインとしてそれを読み取ります。
16
12
 
17
13
  既定の `placement: "end"` では:
18
14
 
@@ -61,6 +57,12 @@ Riebeckite は脚注を記事末尾のリストに表示します。[^1]
61
57
  plugins: [sidenotes({ placement: "margin" })];
62
58
  ```
63
59
 
60
+ ## 実行例
61
+
62
+ ここに脚注への参照を置きます。[^live-example]
63
+
64
+ [^live-example]: この注釈は sidenotes プラグインが描画します。
65
+
64
66
  ## オプション
65
67
 
66
68
  | オプション | 型 | 既定値 | 説明 |
@@ -133,7 +135,7 @@ import "@riebeckite/plugin-sidenotes/style.css";
133
135
  ## エクスポート
134
136
 
135
137
  - `sidenotes(options?)`:プラグインファクトリ
136
- - `sidenotesPlugin`:`sidenotes` のエイリアス
138
+ - `sidenotes`:`sidenotes` のエイリアス
137
139
  - `rehypeSidenotes(options?)`:rehype トランスフォーマー
138
140
  - `resolveSidenotesOptions(options?)`:オプションの既定値を適用する
139
141
  - `renderSidenotesReference(input)` / `renderSidenotesNote(input)`:HTML 生成関数
@@ -145,8 +147,7 @@ import "@riebeckite/plugin-sidenotes/style.css";
145
147
  します。
146
148
  - マージン配置では、文末の脚注定義セクションは DOM に残りますが非表示に
147
149
  なります。テーマは `.rr-sidenotes__note` を自由に再スタイルできます。
148
- - テーブル内や深く入れ子になったインライン要素の中の注は、最も近いブロック
149
- 要素の後ろに置かれるため、縦位置はおおよその位置になります。
150
+ - テーブル内や深く入れ子になったインライン要素の中の注記は、最も近いブロック要素の後ろに置かれるため、縦位置はおおよその位置になります。
150
151
 
151
152
  ## 関連リンク
152
153
 
package/dist/index.d.ts CHANGED
@@ -11,5 +11,3 @@ export declare const SIDENOTES_PLUGIN_NAME = "sidenotes";
11
11
  * markup into an inline reference plus a margin note.
12
12
  */
13
13
  export declare function sidenotes(options?: SidenotesOptions): import("@riebeckite/core").RiebeckitePlugin<SidenotesOptions>;
14
- /** Alias matching the `*Plugin` suffix used by other plugin factories. */
15
- export declare const sidenotesPlugin: typeof sidenotes;
package/dist/index.js CHANGED
@@ -400,7 +400,6 @@ function sidenotes(options = {}) {
400
400
  ]
401
401
  });
402
402
  }
403
- var sidenotesPlugin = sidenotes;
404
403
  function validateSidenotesOptions(options) {
405
404
  if (!options) return [];
406
405
  const issues = [];
@@ -427,6 +426,5 @@ export {
427
426
  resolveSidenotesOptions,
428
427
  sidenotes,
429
428
  sidenotesKey,
430
- sidenotesNoteId,
431
- sidenotesPlugin
429
+ sidenotesNoteId
432
430
  };
@@ -1,7 +1,4 @@
1
1
  import type { ResolvedSidenotesOptions, SidenotesOptions } from "./types.js";
2
- export declare const DEFAULT_SIDENOTES_ARIA_LABEL = "Sidenote";
3
- export declare const DEFAULT_SIDENOTES_OPEN_LABEL = "Footnote";
4
- export declare const DEFAULT_SIDENOTES_PLACEMENT = "end";
5
2
  /**
6
3
  * Applies defaults to `SidenotesOptions`. Pure and deterministic so the
7
4
  * plugin can resolve options once and reuse them for every processed tree.
@@ -2,17 +2,13 @@ import type { HastNode, ResolvedSidenotesOptions } from "./types.js";
2
2
  /** Feature hooks follow the `rr-sidenotes` convention from the CSS hooks doc. */
3
3
  export declare const SIDENOTES_REF_CLASS = "rr-sidenotes__ref";
4
4
  export declare const SIDENOTES_TOGGLE_CLASS = "rr-sidenotes__toggle";
5
- export declare const SIDENOTES_NOTE_CLASS = "rr-sidenotes__note";
6
- export declare const SIDENOTES_INDEX_CLASS = "rr-sidenotes__index";
7
- export declare const SIDENOTES_BODY_CLASS = "rr-sidenotes__body";
8
5
  export declare const SIDENOTES_FOOTNOTES_CLASS = "rr-sidenotes__footnotes";
9
- export declare const SIDENOTES_NOTE_ID_PREFIX = "rr-sidenotes-";
10
6
  /** Extracts the footnote key from a reference href. Returns `null` when the
11
7
  * href does not look like a footnote target. */
12
8
  export declare function sidenotesKey(href: string): string | null;
13
9
  /** Stable id shared by a sidenote and its reference links. */
14
10
  export declare function sidenotesNoteId(key: string): string;
15
- export type SidenotesReferenceInput = {
11
+ type SidenotesReferenceInput = {
16
12
  /** Existing `href` of the GFM footnote reference, used when no key exists. */
17
13
  href: string;
18
14
  /** Existing `id` of the GFM footnote reference, kept for back-links. */
@@ -27,7 +23,7 @@ export type SidenotesReferenceInput = {
27
23
  * so it can reuse the existing wrapper when one is already present.
28
24
  */
29
25
  export declare function renderSidenotesReference(input: SidenotesReferenceInput): string;
30
- export type SidenotesNoteInput = {
26
+ type SidenotesNoteInput = {
31
27
  key: string;
32
28
  index: string;
33
29
  /** Serialized definition content (back-links stripped). */
@@ -42,3 +38,4 @@ export declare function renderSidenotesNote(input: SidenotesNoteInput): string;
42
38
  * every text value and attribute is escaped here.
43
39
  */
44
40
  export declare function renderHastChildren(children: readonly HastNode[]): string;
41
+ export {};
@@ -37,7 +37,7 @@ export type HastElementNode = {
37
37
  properties?: Record<string, unknown>;
38
38
  children?: HastNode[];
39
39
  };
40
- export type HastTextNode = {
40
+ type HastTextNode = {
41
41
  type: "text";
42
42
  value: string;
43
43
  };
@@ -46,17 +46,18 @@ export type HastRawNode = {
46
46
  type: "raw";
47
47
  value: string;
48
48
  };
49
- export type HastCommentNode = {
49
+ type HastCommentNode = {
50
50
  type: "comment";
51
51
  value: string;
52
52
  };
53
- export type HastDoctypeNode = {
53
+ type HastDoctypeNode = {
54
54
  type: "doctype";
55
55
  name?: string;
56
56
  };
57
- export type HastRootNode = {
57
+ type HastRootNode = {
58
58
  type: "root";
59
59
  children?: HastNode[];
60
60
  };
61
61
  /** Any node the sidenotes transformer may encounter in a hast tree. */
62
62
  export type HastNode = HastElementNode | HastTextNode | HastRawNode | HastCommentNode | HastDoctypeNode | HastRootNode;
63
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riebeckite/plugin-sidenotes",
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",
@@ -15,7 +15,7 @@
15
15
  "./style.css": "./style.css"
16
16
  },
17
17
  "dependencies": {
18
- "@riebeckite/core": "0.0.32"
18
+ "@riebeckite/core": "0.0.33"
19
19
  },
20
20
  "publishConfig": {
21
21
  "access": "public"
@@ -50,6 +50,7 @@
50
50
  "./style.css"
51
51
  ],
52
52
  "scripts": {
53
- "build": "node ../../../scripts/build_package.mjs"
53
+ "build": "node ../../../scripts/build_package.mjs",
54
+ "test": "node --import tsx --test \"test/*.test.ts\""
54
55
  }
55
56
  }