@riebeckite/plugin-shortcodes 0.0.20 → 0.0.21

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.
Files changed (3) hide show
  1. package/README.md +172 -1
  2. package/README_ja.md +172 -1
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -73,6 +73,178 @@ diagnostic, and malformed attributes emit `shortcodes-invalid` and are ignored.
73
73
  | `link-card` | leaf | yes | `url`/`href`, `title`, `description`, `image`/`icon` | Link preview card |
74
74
  | `file` | leaf | yes | `url`/`src`/`path`, `name`/`label`, `size` | Download link |
75
75
 
76
+ ## Actual Rendering
77
+
78
+ The following examples demonstrate all 12 built-in shortcodes. Each example shows the Markdown syntax followed by the shortcode itself, allowing you to see how it renders when the Shortcodes plugin is enabled.
79
+
80
+ ### Badge
81
+
82
+ Display status indicators or labels inline with text.
83
+
84
+ ```md
85
+ This feature is :badge[New]{variant=success}.
86
+
87
+ Current status: :badge[Beta]{variant=warning}
88
+ ```
89
+
90
+ This feature is :badge[New]{variant=success}.
91
+
92
+ Current status: :badge[Beta]{variant=warning}
93
+
94
+ ### Keyboard (kbd)
95
+
96
+ Display keyboard shortcuts using semantic `<kbd>` elements.
97
+
98
+ ```md
99
+ Press :kbd[Ctrl+S] to save your changes.
100
+
101
+ Use :kbd[Ctrl+K] to open search.
102
+ ```
103
+
104
+ Press :kbd[Ctrl+S] to save your changes.
105
+
106
+ Use :kbd[Ctrl+K] to open search.
107
+
108
+ ### Note
109
+
110
+ Highlight useful information, tips, and other supplementary content.
111
+
112
+ ```md
113
+ :::note[Tip]{type=info}
114
+ You can use **Markdown** inside this container.
115
+
116
+ - Lists
117
+ - **Bold text**
118
+ - [Links](https://example.com)
119
+ :::
120
+ ```
121
+
122
+ :::note[Tip]{type=info}
123
+ You can use **Markdown** inside this container.
124
+
125
+ - Lists
126
+ - **Bold text**
127
+ - [Links](https://example.com)
128
+ :::
129
+
130
+ ### Callout
131
+
132
+ Display important notices or warnings. `callout` is an alias of `note` with a different CSS class.
133
+
134
+ ```md
135
+ :::callout[Warning]{type=warning}
136
+ Remember to rebuild your site after changing the configuration file.
137
+ :::
138
+ ```
139
+
140
+ :::callout[Warning]{type=warning}
141
+ Remember to rebuild your site after changing the configuration file.
142
+ :::
143
+
144
+ ### Details
145
+
146
+ Create collapsible sections that users can expand to reveal additional content.
147
+
148
+ ```md
149
+ :::details[Show details]
150
+ This content is hidden until the section is expanded.
151
+
152
+ You can include **Markdown** and lists:
153
+
154
+ - Item A
155
+ - Item B
156
+ :::
157
+ ```
158
+
159
+ :::details[Show details]
160
+ This content is hidden until the section is expanded.
161
+
162
+ You can include **Markdown** and lists:
163
+
164
+ - Item A
165
+ - Item B
166
+ :::
167
+
168
+ ### Spoiler
169
+
170
+ Hide content behind an expandable section. `spoiler` works like `details` but uses a different CSS class.
171
+
172
+ ```md
173
+ :::spoiler[Reveal spoiler]
174
+ The hidden content appears when the user expands this section.
175
+
176
+ **Markdown** is supported here too.
177
+ :::
178
+ ```
179
+
180
+ :::spoiler[Reveal spoiler]
181
+ The hidden content appears when the user expands this section.
182
+
183
+ **Markdown** is supported here too.
184
+ :::
185
+
186
+ ### Figure
187
+
188
+ Display images with optional captions and dimensions using semantic `<figure>` markup.
189
+
190
+ ```md
191
+ ::figure[Sample image]{src="https://placehold.co/800x400/png" alt="Sample placeholder image" caption="Figure 1: Example image"}
192
+ ```
193
+
194
+ ::figure[Sample image]{src="https://placehold.co/800x400/png" alt="Sample placeholder image" caption="Figure 1: Example image"}
195
+
196
+ ### YouTube
197
+
198
+ Embed YouTube videos using the privacy-enhanced `youtube-nocookie.com` domain.
199
+
200
+ ```md
201
+ ::youtube[id=dQw4w9WgXcQ]
202
+ ```
203
+
204
+ ::youtube[id=dQw4w9WgXcQ]
205
+
206
+ ### Vimeo
207
+
208
+ Embed Vimeo videos with the `dnt=1` privacy parameter.
209
+
210
+ ```md
211
+ ::vimeo[id=76979871]
212
+ ```
213
+
214
+ ::vimeo[id=76979871]
215
+
216
+ ### GitHub Gist
217
+
218
+ Embed GitHub Gist code snippets directly into a page. A fallback link is provided for environments where JavaScript is disabled.
219
+
220
+ ```md
221
+ ::gist{user=octocat id=aa5a315d61ae9438b18d}
222
+ ```
223
+
224
+ ::gist{user=octocat id=aa5a315d61ae9438b18d}
225
+
226
+ ### Link Card
227
+
228
+ Display external links as preview cards with titles and descriptions.
229
+
230
+ ```md
231
+ ::link-card[GitHub]{url="https://github.com" title="GitHub" description="A platform for hosting code and collaborating on software projects"}
232
+ ```
233
+
234
+ ::link-card[GitHub]{url="https://github.com" title="GitHub" description="A platform for hosting code and collaborating on software projects"}
235
+
236
+ ### File
237
+
238
+ Create downloadable file links with optional filenames and file sizes.
239
+
240
+ ```md
241
+ ::file[Sample PDF]{url="https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf" name="sample.pdf" size="13 KB"}
242
+ ```
243
+
244
+ ::file[Sample PDF]{url="https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf" name="sample.pdf" size="13 KB"}
245
+
246
+ The code blocks above show the original Markdown syntax. The shortcode expressions immediately below them serve as live rendering examples when processed by Riebeckite with the Shortcodes plugin enabled.
247
+
76
248
  ## Options
77
249
 
78
250
  | Option | Type | Default | Description |
@@ -121,4 +293,3 @@ input themselves — `escapeHtml` and `escapeHtmlAttribute` are re-exported from
121
293
  ## See also
122
294
 
123
295
  - [Plugin guide](../../../docs/docs/reference/plugin-api.md)
124
-
package/README_ja.md CHANGED
@@ -72,6 +72,178 @@ export default defineConfig({
72
72
  | `link-card` | リーフ | 可 | `url`/`href`, `title`, `description`, `image`/`icon` | リンクプレビューカード |
73
73
  | `file` | リーフ | 可 | `url`/`src`/`path`, `name`/`label`, `size` | ダウンロードリンク |
74
74
 
75
+ ## 実際のレンダリング
76
+
77
+ 以下の例では、組み込みショートコード全12種類の使い方を紹介します。各例では Markdown の記法と、その直下にショートコード自体を記載しています。Shortcodes プラグインが有効な場合、実際のレンダリング結果を確認できます。
78
+
79
+ ### バッジ(badge)
80
+
81
+ 文章の途中にステータスやラベルを表示できます。
82
+
83
+ ```md
84
+ この機能は :badge[新着]{variant=success} です。
85
+
86
+ 現在の状態: :badge[ベータ版]{variant=warning}
87
+ ```
88
+
89
+ この機能は :badge[新着]{variant=success} です。
90
+
91
+ 現在の状態: :badge[ベータ版]{variant=warning}
92
+
93
+ ### キーボード(kbd)
94
+
95
+ キーボードショートカットを意味的に適切な `<kbd>` 要素で表示できます。
96
+
97
+ ```md
98
+ 変更を保存するには :kbd[Ctrl+S] を押してください。
99
+
100
+ 検索を開くには :kbd[Ctrl+K] を使用します。
101
+ ```
102
+
103
+ 変更を保存するには :kbd[Ctrl+S] を押してください。
104
+
105
+ 検索を開くには :kbd[Ctrl+K] を使用します。
106
+
107
+ ### ノート(note)
108
+
109
+ ヒントや補足情報などを目立たせて表示できます。
110
+
111
+ ```md
112
+ :::note[ヒント]{type=info}
113
+ このコンテナ内では **Markdown** を使用できます。
114
+
115
+ - リスト
116
+ - **太字**
117
+ - [リンク](https://example.com)
118
+ :::
119
+ ```
120
+
121
+ :::note[ヒント]{type=info}
122
+ このコンテナ内では **Markdown** を使用できます。
123
+
124
+ - リスト
125
+ - **太字**
126
+ - [リンク](https://example.com)
127
+ :::
128
+
129
+ ### コールアウト(callout)
130
+
131
+ 重要な通知や警告を表示できます。`callout` は `note` のエイリアスで、異なる CSS クラスが適用されます。
132
+
133
+ ```md
134
+ :::callout[注意]{type=warning}
135
+ 設定ファイルを変更した場合は、サイトを再ビルドしてください。
136
+ :::
137
+ ```
138
+
139
+ :::callout[注意]{type=warning}
140
+ 設定ファイルを変更した場合は、サイトを再ビルドしてください。
141
+ :::
142
+
143
+ ### 折りたたみ(details)
144
+
145
+ クリックすると追加のコンテンツを展開できるセクションを作成できます。
146
+
147
+ ```md
148
+ :::details[詳細を表示]
149
+ このコンテンツは、セクションを展開するまで非表示になります。
150
+
151
+ **Markdown** やリストも使用できます。
152
+
153
+ - 項目 A
154
+ - 項目 B
155
+ :::
156
+ ```
157
+
158
+ :::details[詳細を表示]
159
+ このコンテンツは、セクションを展開するまで非表示になります。
160
+
161
+ **Markdown** やリストも使用できます。
162
+
163
+ - 項目 A
164
+ - 項目 B
165
+ :::
166
+
167
+ ### スポイラー(spoiler)
168
+
169
+ コンテンツを折りたたみセクション内に隠せます。`spoiler` は `details` と同様に動作しますが、異なる CSS クラスが適用されます。
170
+
171
+ ```md
172
+ :::spoiler[ネタバレを表示]
173
+ ユーザーがこのセクションを展開すると、隠されたコンテンツが表示されます。
174
+
175
+ ここでも **Markdown** を使用できます。
176
+ :::
177
+ ```
178
+
179
+ :::spoiler[ネタバレを表示]
180
+ ユーザーがこのセクションを展開すると、隠されたコンテンツが表示されます。
181
+
182
+ ここでも **Markdown** を使用できます。
183
+ :::
184
+
185
+ ### 画像(figure)
186
+
187
+ 意味的に適切な `<figure>` 要素を使用して、キャプションやサイズを指定した画像を表示できます。
188
+
189
+ ```md
190
+ ::figure[サンプル画像]{src="https://placehold.co/800x400/png" alt="サンプルのプレースホルダー画像" caption="Figure 1: 画像の表示例"}
191
+ ```
192
+
193
+ ::figure[サンプル画像]{src="https://placehold.co/800x400/png" alt="サンプルのプレースホルダー画像" caption="Figure 1: 画像の表示例"}
194
+
195
+ ### YouTube
196
+
197
+ プライバシーに配慮した `youtube-nocookie.com` ドメインを使用して、YouTube 動画を埋め込めます。
198
+
199
+ ```md
200
+ ::youtube[id=dQw4w9WgXcQ]
201
+ ```
202
+
203
+ ::youtube[id=dQw4w9WgXcQ]
204
+
205
+ ### Vimeo
206
+
207
+ `dnt=1` プライバシーパラメータを使用して、Vimeo 動画を埋め込めます。
208
+
209
+ ```md
210
+ ::vimeo[id=76979871]
211
+ ```
212
+
213
+ ::vimeo[id=76979871]
214
+
215
+ ### GitHub Gist
216
+
217
+ GitHub Gist のコードスニペットをページ内に直接埋め込めます。JavaScript が無効な環境では、代替リンクが提供されます。
218
+
219
+ ```md
220
+ ::gist{user=octocat id=aa5a315d61ae9438b18d}
221
+ ```
222
+
223
+ ::gist{user=octocat id=aa5a315d61ae9438b18d}
224
+
225
+ ### リンクカード(link-card)
226
+
227
+ 外部リンクをタイトルや説明付きのプレビューカードとして表示できます。
228
+
229
+ ```md
230
+ ::link-card[GitHub]{url="https://github.com" title="GitHub" description="コードのホスティングとソフトウェア開発の共同作業を行うためのプラットフォーム"}
231
+ ```
232
+
233
+ ::link-card[GitHub]{url="https://github.com" title="GitHub" description="コードのホスティングとソフトウェア開発の共同作業を行うためのプラットフォーム"}
234
+
235
+ ### ファイル(file)
236
+
237
+ ファイル名やサイズを指定したダウンロードリンクを作成できます。
238
+
239
+ ```md
240
+ ::file[サンプルPDF]{url="https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf" name="sample.pdf" size="13 KB"}
241
+ ```
242
+
243
+ ::file[サンプルPDF]{url="https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf" name="sample.pdf" size="13 KB"}
244
+
245
+ 上記のコードブロックは元の Markdown 記法を示しています。その直下のショートコードは、Shortcodes プラグインを有効にした Riebeckite で処理された際の、実際のレンダリングを確認するための例です。
246
+
75
247
  ## オプション
76
248
 
77
249
  | オプション | 型 | 既定値 | 説明 |
@@ -120,4 +292,3 @@ container }` を受け取り、文字列を返します。独自レンダラー
120
292
  ## 関連
121
293
 
122
294
  - [プラグインガイド](../../../docs/docs/reference/plugin-api.ja.md)
123
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riebeckite/plugin-shortcodes",
3
- "version": "0.0.20",
3
+ "version": "0.0.21",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -17,11 +17,11 @@
17
17
  "dependencies": {
18
18
  "@types/mdast": "^4.0.4",
19
19
  "unist-util-visit": "^5.1.0",
20
- "@riebeckite/core": "0.0.20"
20
+ "@riebeckite/core": "0.0.21"
21
21
  },
22
22
  "devDependencies": {
23
23
  "tsx": "^4.22.4",
24
- "@riebeckite/test": "0.0.20"
24
+ "@riebeckite/test": "0.0.21"
25
25
  },
26
26
  "publishConfig": {
27
27
  "access": "public"