@riebeckite/plugin-rich-embed 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
@@ -75,6 +75,15 @@ listed in `allowHosts`.
75
75
  | `providers` | `RichEmbedProvider[]` | all | Allowlist of providers to enable |
76
76
  | `disable` | `RichEmbedProvider[]` | `[]` | Providers to disable (wins over `providers`) |
77
77
 
78
+ ## Live example
79
+
80
+ ~~~embed
81
+ https://www.youtube.com/watch?v=dQw4w9WgXcQ
82
+ title: Demo video
83
+ caption: A short caption
84
+ aspect: 16/9
85
+ ~~~
86
+
78
87
  ## Output HTML
79
88
 
80
89
  ```html
@@ -136,7 +145,7 @@ warning through the vfile message channel:
136
145
  ## Exports
137
146
 
138
147
  - `richEmbed(options?)` — plugin factory
139
- - `richEmbedPlugin` — alias of `richEmbed`
148
+ - `richEmbed` — alias of `richEmbed`
140
149
  - Types: `RichEmbedOptions`, `RichEmbedProvider`
141
150
 
142
151
  ## See also
package/README_ja.md CHANGED
@@ -9,7 +9,7 @@
9
9
  ## 概要
10
10
 
11
11
  `richEmbed()` は ` ```embed ` フェンスをレスポンシブな
12
- `<figure class="rb-rich-embed">` に置き換えます。プロバイダの判定は URL の文字列解析だけで行うため、ビルド時にネットワークへアクセスしません。クライアント側 JavaScript も不要です。
12
+ `<figure class="rb-rich-embed">` に置き換えます。プロバイダーの判定は URL の文字列解析だけで行うため、ビルド時にネットワークへアクセスしません。クライアント側 JavaScript も不要です。
13
13
 
14
14
  ## 使い方
15
15
 
@@ -50,9 +50,9 @@ start: 30
50
50
 
51
51
  未知のキーは無視します。`aspect` が不正な場合は `16/9` に戻します。
52
52
 
53
- ## 対応プロバイダ
53
+ ## 対応プロバイダー
54
54
 
55
- | プロバイダ | 認識する URL | 出力する `src` |
55
+ | プロバイダー | 認識する URL | 出力する `src` |
56
56
  | ---------- | ------------ | -------------- |
57
57
  | YouTube | `youtube.com/watch?v=`, `youtu.be/`, `/shorts/`, `/embed/`, `/live/` | `https://www.youtube-nocookie.com/embed/<id>` |
58
58
  | Vimeo | `vimeo.com/<数値ID>` | `https://player.vimeo.com/video/<id>` |
@@ -66,9 +66,18 @@ start: 30
66
66
 
67
67
  | オプション | 型 | 既定値 | 説明 |
68
68
  | ---------- | -- | ------ | ---- |
69
- | `allowHosts` | `string[]` | `[]` | 汎用 iframe へのフォールバックを許可するホスト名 |
70
- | `providers` | `RichEmbedProvider[]` | すべて | 有効にするプロバイダの許可リスト |
71
- | `disable` | `RichEmbedProvider[]` | `[]` | 無効にするプロバイダ(`providers` より優先) |
69
+ | `allowHosts` | `string[]` | `[]` | 汎用 `<iframe>` へのフォールバックを許可するホスト名 |
70
+ | `providers` | `RichEmbedProvider[]` | すべて | 有効にするプロバイダーの許可リスト |
71
+ | `disable` | `RichEmbedProvider[]` | `[]` | 無効にするプロバイダー(`providers` より優先) |
72
+
73
+ ## 実行例
74
+
75
+ ~~~embed
76
+ https://www.youtube.com/watch?v=dQw4w9WgXcQ
77
+ title: Demo video
78
+ caption: A short caption
79
+ aspect: 16/9
80
+ ~~~
72
81
 
73
82
  ## 出力 HTML
74
83
 
@@ -113,8 +122,8 @@ Gist の場合は iframe の代わりに
113
122
  ## セキュリティ
114
123
 
115
124
  - `https:` の URL だけを受理します。
116
- - プロバイダの出力は検証済みのパスセグメントから組み立て、動的な部分は `encodeURIComponent` を通します。
117
- - 汎用 iframe には `allowHosts` への明示的な登録が必要です。
125
+ - プロバイダーの出力は検証済みのパスセグメントから組み立て、動的な部分は `encodeURIComponent` を通します。
126
+ - 汎用 `<iframe>` には `allowHosts` への明示的な登録が必要です。
118
127
  - 生のユーザー HTML は出力しません。タイトル・キャプション・ラベルはすべてエスケープされるテキストノードとして書き込みます。
119
128
 
120
129
  ## 制限事項
@@ -126,7 +135,7 @@ Gist の場合は iframe の代わりに
126
135
  ## エクスポート
127
136
 
128
137
  - `richEmbed(options?)`:プラグインファクトリ
129
- - `richEmbedPlugin`:`richEmbed` の別名
138
+ - `richEmbed`:`richEmbed` の別名
130
139
  - 型: `RichEmbedOptions`, `RichEmbedProvider`
131
140
 
132
141
  ## 関連
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  import type { RichEmbedOptions } from "./src/types.js";
2
2
  export type { RichEmbedOptions, RichEmbedProvider } from "./src/types.js";
3
3
  export declare function richEmbed(options?: RichEmbedOptions): import("@riebeckite/core").RiebeckitePlugin<RichEmbedOptions>;
4
- export declare const richEmbedPlugin: typeof richEmbed;
package/dist/index.js CHANGED
@@ -218,7 +218,6 @@ function parseStart(value) {
218
218
  // src/hast.ts
219
219
  import {
220
220
  element as sharedElement,
221
- getStringProperty as sharedGetStringProperty,
222
221
  getTextContent as sharedGetTextContent,
223
222
  hasClass as sharedHasClass,
224
223
  text as sharedText,
@@ -352,7 +351,6 @@ function richEmbed(options = {}) {
352
351
  ]
353
352
  });
354
353
  }
355
- var richEmbedPlugin = richEmbed;
356
354
  function validateRichEmbedOptions(options) {
357
355
  if (!options) return [];
358
356
  const issues = [];
@@ -403,6 +401,5 @@ function isRichEmbedProvider(value) {
403
401
  return typeof value === "string" && RICH_EMBED_PROVIDERS.includes(value);
404
402
  }
405
403
  export {
406
- richEmbed,
407
- richEmbedPlugin
404
+ richEmbed
408
405
  };
@@ -2,6 +2,5 @@ import type { ElementNode, HastNode, ParentNode, TextNode } from "./types.js";
2
2
  export declare const element: (tagName: string, properties?: Record<string, unknown>, children?: HastNode[]) => ElementNode;
3
3
  export declare const text: (value: string) => TextNode;
4
4
  export declare const getTextContent: (node: HastNode) => string;
5
- export declare const getStringProperty: (node: ElementNode, key: string) => string | null;
6
5
  export declare const hasClass: (node: ElementNode, className: string) => boolean;
7
6
  export declare const visitElements: (node: HastNode, visitor: (node: ElementNode, parent?: ParentNode, index?: number) => void, parent?: ParentNode, index?: number) => void;
@@ -1,11 +1,10 @@
1
1
  import type { RichEmbedBlockOptions, RichEmbedOptions, RichEmbedProvider } from "./types.js";
2
2
  export declare const RICH_EMBED_PROVIDERS: readonly RichEmbedProvider[];
3
- export declare const DEFAULT_ASPECT = "16/9";
4
- export type ParsedEmbedBlock = {
3
+ type ParsedEmbedBlock = {
5
4
  url: string;
6
5
  options: RichEmbedBlockOptions;
7
6
  };
8
- export type EmbedResolution = {
7
+ type EmbedResolution = {
9
8
  kind: "iframe";
10
9
  provider: RichEmbedProvider;
11
10
  src: string;
@@ -30,9 +29,9 @@ export type SupportedEmbedResolution = Exclude<EmbedResolution, {
30
29
  * every following `key: value` line is an option.
31
30
  */
32
31
  export declare function parseEmbedBlock(source: string): ParsedEmbedBlock | null;
33
- export declare function normalizeAspect(value: string): string | null;
34
32
  /**
35
33
  * Resolves a URL to an embeddable target using only string inspection. No
36
34
  * network request is performed.
37
35
  */
38
36
  export declare function resolveEmbed(urlText: string, block: RichEmbedBlockOptions, config: RichEmbedOptions): EmbedResolution;
37
+ export {};
@@ -39,7 +39,7 @@ export type TextNode = {
39
39
  type: "text";
40
40
  value: string;
41
41
  };
42
- export type RawNode = {
42
+ type RawNode = {
43
43
  type: "raw";
44
44
  value: string;
45
45
  };
@@ -47,3 +47,4 @@ export type HastNode = ElementNode | TextNode | RawNode | {
47
47
  type: string;
48
48
  [key: string]: unknown;
49
49
  };
50
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riebeckite/plugin-rich-embed",
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,8 +15,8 @@
15
15
  "./style.css": "./style.css"
16
16
  },
17
17
  "dependencies": {
18
- "@riebeckite/core": "0.0.32",
19
- "@riebeckite/diagram": "0.0.32"
18
+ "@riebeckite/core": "0.0.33",
19
+ "@riebeckite/diagram": "0.0.33"
20
20
  },
21
21
  "publishConfig": {
22
22
  "access": "public"