rehype-video 2.3.0 → 2.3.2
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/LICENSE +21 -0
- package/README.md +80 -1
- package/lib/detailsNode.js +3 -3
- package/lib/detailsNode.js.map +1 -1
- package/package.json +1 -1
- package/src/detailsNode.ts +3 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Kenny Wang <kennyiseeyou@gmail.com> (https://github.com/jaywcjlove)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,7 +1,48 @@
|
|
|
1
|
+
<div markdown="1">
|
|
2
|
+
<sup>Using <a href="https://wangchujiang.com/#/app" target="_blank">my app</a> is also a way to <a href="https://wangchujiang.com/#/sponsor" target="_blank">support</a> me:</sup>
|
|
3
|
+
<br>
|
|
4
|
+
<a target="_blank" href="https://wangchujiang.com/dock-lift/" title="DockLift: Windows, Here"><img alt="DockLift: Windows, Here" height="52" src="https://wangchujiang.com/appicon/dock-lift.png"></a>
|
|
5
|
+
<a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6766860898" title="Zipora: Zip/RAR/7Z Unarchiver"><img alt="Zipora: Zip/RAR/7Z Unarchiver" height="52" src="https://wangchujiang.com/appicon/zipora.png"></a>
|
|
6
|
+
<a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6758053530" title="Scap: Screenshot & Markup Edit for macOS"><img alt="Scap: Screenshot & Markup Edit" height="52" src="https://wangchujiang.com/appicon/scap.png"></a>
|
|
7
|
+
<a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6757317079" title="Screen Test for macOS"><img alt="Screen Test" height="52" src="https://wangchujiang.com/appicon/screen-test.png"></a>
|
|
8
|
+
<a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6755948110" title="Deskmark for macOS"><img alt="Deskmark" height="52" src="https://wangchujiang.com/appicon/deskmark.png"></a>
|
|
9
|
+
<a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6500434773" title="Keyzer for macOS"><img alt="Keyzer" height="52" src="https://wangchujiang.com/appicon/keyzer.png"></a>
|
|
10
|
+
<a target="_blank" href="https://github.com/jaywcjlove/vidwall-hub" title="Vidwall Hub for macOS"><img alt="Vidwall Hub" height="52" src="https://wangchujiang.com/appicon/vidwall-hub.png"></a>
|
|
11
|
+
<a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6752624705" title="VidCrop for macOS"><img alt="VidCrop" height="52" src="https://wangchujiang.com/appicon/vidcrop.png"></a>
|
|
12
|
+
<a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6747587746" title="Vidwall for macOS"><img alt="Vidwall" height="52" src="https://wangchujiang.com/appicon/vidwall.png"></a>
|
|
13
|
+
<a target="_blank" href="https://wangchujiang.com/mousio-hint/" title="Mousio Hint for macOS"><img alt="Mousio Hint" height="52" src="https://wangchujiang.com/appicon/mousio-hint.png"></a>
|
|
14
|
+
<a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6746747327" title="Mousio for macOS"><img alt="Mousio" height="52" src="https://wangchujiang.com/appicon/mousio.png"></a>
|
|
15
|
+
<a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6745227444" title="Musicer for macOS"><img alt="Musicer" height="52" src="https://wangchujiang.com/appicon/musicer.png"></a>
|
|
16
|
+
<a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6743841447" title="Audioer for macOS"><img alt="Audioer" height="52" src="https://wangchujiang.com/appicon/audioer.png"></a>
|
|
17
|
+
<a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6744690194" title="FileSentinel for macOS"><img alt="FileSentinel" height="52" src="https://wangchujiang.com/appicon/file-sentinel.png"></a>
|
|
18
|
+
<a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6743495172" title="FocusCursor for macOS"><img alt="FocusCursor" height="52" src="https://wangchujiang.com/appicon/focus-cursor.png"></a>
|
|
19
|
+
<a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6742680573" title="Videoer for macOS"><img alt="Videoer" height="52" src="https://wangchujiang.com/appicon/videoer.png"></a>
|
|
20
|
+
<a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6740425504" title="KeyClicker for macOS"><img alt="KeyClicker" height="52" src="https://wangchujiang.com/appicon/key-clicker.png"></a>
|
|
21
|
+
<a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6739052447" title="DayBar for macOS"><img alt="DayBar" height="52" src="https://wangchujiang.com/appicon/daybar.png"></a>
|
|
22
|
+
<a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6739444407" title="Iconed for macOS"><img alt="Iconed" height="52" src="https://wangchujiang.com/appicon/iconed.png"></a>
|
|
23
|
+
<a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6737160756" title="Menuist for macOS"><img alt="Menuist" height="52" src="https://wangchujiang.com/appicon/rightmenu-master.png"></a>
|
|
24
|
+
<a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6723903021" title="Paste Quick for macOS"><img alt="Quick RSS" height="52" src="https://wangchujiang.com/appicon/paste-quick.png"></a>
|
|
25
|
+
<a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6670696072&platform=mac" title="Quick RSS for macOS/iOS"><img alt="Quick RSS" height="52" src="https://wangchujiang.com/appicon/quick-rss.png"></a>
|
|
26
|
+
<a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6670167443" title="Web Serve for macOS"><img alt="Web Serve" height="52" src="https://wangchujiang.com/appicon/web-serve.png"></a>
|
|
27
|
+
<a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6503953628&platform=mac" title="Copybook Generator for macOS/iOS"><img alt="Copybook Generator" height="52" src="https://wangchujiang.com/appicon/copybook-generator.png"></a>
|
|
28
|
+
<a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6471227008&platform=mac" title="DevTutor for macOS/iOS"><img alt="DevTutor for SwiftUI" height="52" src="https://wangchujiang.com/appicon/devtutor.png"></a>
|
|
29
|
+
<a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6479819388&platform=mac" title="RegexMate for macOS/iOS"><img alt="RegexMate" height="52" src="https://wangchujiang.com/appicon/regex-mate.png"></a>
|
|
30
|
+
<a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6479194014&platform=mac" title="Time Passage for macOS/iOS"><img alt="Time Passage" height="52" src="https://wangchujiang.com/appicon/time-passage.png"></a>
|
|
31
|
+
<a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6478772538" title="IconizeFolder for macOS"><img alt="Iconize Folder" height="52" src="https://wangchujiang.com/appicon/iconize-folder.png"></a>
|
|
32
|
+
<a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6478511402&platform=mac" title="Textsound Saver for macOS/iOS"><img alt="Textsound Saver" height="52" src="https://wangchujiang.com/appicon/textsound-saver.png"></a>
|
|
33
|
+
<a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6476924627" title="Create Custom Symbols for macOS"><img alt="Create Custom Symbols" height="52" src="https://wangchujiang.com/appicon/create-custom-symbols.png"></a>
|
|
34
|
+
<a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6476452351" title="DevHub for macOS"><img alt="DevHub" height="52" src="https://wangchujiang.com/appicon/devhub.png"></a>
|
|
35
|
+
<a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6476400184" title="Resume Revise for macOS"><img alt="Resume Revise" height="52" src="https://wangchujiang.com/appicon/resume-revise.png"></a>
|
|
36
|
+
<a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6472593276" title="Palette Genius for macOS"><img alt="Palette Genius" height="52" src="https://wangchujiang.com/appicon/palette-genius.png"></a>
|
|
37
|
+
<a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6470879005" title="Symbol Scribe for macOS"><img alt="Symbol Scribe" height="52" src="https://wangchujiang.com/appicon/symbol-scribe.png"></a>
|
|
38
|
+
</div>
|
|
39
|
+
<hr>
|
|
40
|
+
|
|
1
41
|
rehype-video
|
|
2
42
|
===
|
|
3
43
|
|
|
4
|
-
[](https://jaywcjlove.github.io/#/sponsor)
|
|
45
|
+
[](https://x.com/jaywcjlove)
|
|
5
46
|
[](https://www.npmjs.com/package/rehype-video)
|
|
6
47
|
[](https://npmjs.org/package/rehype-video)
|
|
7
48
|
[](https://github.com/jaywcjlove/rehype-video/actions/workflows/ci.yml)
|
|
@@ -113,6 +154,44 @@ Output:
|
|
|
113
154
|
<video muted controls style="max-height:640px;" src="https://github.com/004.mp4"></video>
|
|
114
155
|
```
|
|
115
156
|
|
|
157
|
+
### Example 3
|
|
158
|
+
|
|
159
|
+
```js
|
|
160
|
+
import remarkParse from 'remark-parse';
|
|
161
|
+
import rehypeVideo from 'rehype-video';
|
|
162
|
+
import { unified } from 'unified';
|
|
163
|
+
import remark2rehype from 'remark-rehype';
|
|
164
|
+
import remarkParse from 'remark-parse';
|
|
165
|
+
import stringify from 'rehype-stringify';
|
|
166
|
+
|
|
167
|
+
const mrkStr = 'https://github.com/user-attachments/assets/0d808e2e-84c7-46ca-a220-440fa9f34118?title=rehype-video&rehype=video'
|
|
168
|
+
|
|
169
|
+
const htmlStr = unified()
|
|
170
|
+
.use(remarkParse)
|
|
171
|
+
.use(remark2rehype, { allowDangerousHtml: true })
|
|
172
|
+
.use(rehypeVideo, {
|
|
173
|
+
test: (url) => {
|
|
174
|
+
return /\.(mp4|mov)|[?&]rehype=video/i.test(url);
|
|
175
|
+
}
|
|
176
|
+
})
|
|
177
|
+
.use(stringify)
|
|
178
|
+
.processSync(mrkStr)
|
|
179
|
+
.toString();
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Output:
|
|
183
|
+
|
|
184
|
+
```html
|
|
185
|
+
<details open class="octicon octicon-video">
|
|
186
|
+
<summary>
|
|
187
|
+
<svg aria-hidden height="16" width="16" viewBox="0 0 16 16" version="1.1" data-view-component class="octicon octicon-device-camera-video"><path fill-rule="evenodd" d="M16 3.75a.75.75 0 00-1.136-.643L11 5.425V4.75A1.75 1.75 0 009.25 3h-7.5A1.75 1.75 0 000 4.75v6.5C0 12.216.784 13 1.75 13h7.5A1.75 1.75 0 0011 11.25v-.675l3.864 2.318A.75.75 0 0016 12.25v-8.5zm-5 5.075l3.5 2.1v-5.85l-3.5 2.1v1.65zM9.5 6.75v-2a.25.25 0 00-.25-.25h-7.5a.25.25 0 00-.25.25v6.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-4.5z"></path></svg>
|
|
188
|
+
<span aria-label="Video description rehype-video">rehype-video</span><span class="dropdown-caret"></span>
|
|
189
|
+
</summary>
|
|
190
|
+
<video muted controls style="max-height:640px;" src="https://github.com/user-attachments/assets/0d808e2e-84c7-46ca-a220-440fa9f34118?title=rehype-video&rehype=video">
|
|
191
|
+
</video>
|
|
192
|
+
</details>
|
|
193
|
+
```
|
|
194
|
+
|
|
116
195
|
## Custom Title
|
|
117
196
|
|
|
118
197
|
Define custom title parameter(E.g: `title=RehypeVideo`) with hash route:
|
package/lib/detailsNode.js
CHANGED
|
@@ -2,7 +2,7 @@ export function detailsNode(title) {
|
|
|
2
2
|
return {
|
|
3
3
|
type: 'element',
|
|
4
4
|
tagName: 'details',
|
|
5
|
-
properties: { open: true, className: 'octicon octicon-video' },
|
|
5
|
+
properties: { open: true, className: ['octicon', 'octicon-video'] },
|
|
6
6
|
children: [
|
|
7
7
|
{
|
|
8
8
|
type: 'element',
|
|
@@ -14,7 +14,7 @@ export function detailsNode(title) {
|
|
|
14
14
|
tagName: 'svg',
|
|
15
15
|
properties: {
|
|
16
16
|
'aria-hidden': true, height: 16, width: 16, viewBox: '0 0 16 16', version: '1.1', 'data-view-component': true,
|
|
17
|
-
className: 'octicon octicon-device-camera-video'
|
|
17
|
+
className: ['octicon', 'octicon-device-camera-video']
|
|
18
18
|
},
|
|
19
19
|
children: [
|
|
20
20
|
{
|
|
@@ -45,7 +45,7 @@ export function detailsNode(title) {
|
|
|
45
45
|
type: 'element',
|
|
46
46
|
tagName: 'span',
|
|
47
47
|
properties: {
|
|
48
|
-
className: 'dropdown-caret'
|
|
48
|
+
className: ['dropdown-caret']
|
|
49
49
|
},
|
|
50
50
|
children: []
|
|
51
51
|
}
|
package/lib/detailsNode.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detailsNode.js","sourceRoot":"","sources":["../src/detailsNode.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,OAAO;QACL,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,SAAS;QAClB,UAAU,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"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F;SACF;KACF,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
package/src/detailsNode.ts
CHANGED
|
@@ -4,7 +4,7 @@ export function detailsNode(title?: string): Element {
|
|
|
4
4
|
return {
|
|
5
5
|
type: 'element',
|
|
6
6
|
tagName: 'details',
|
|
7
|
-
properties: { open: true, className: 'octicon octicon-video' },
|
|
7
|
+
properties: { open: true, className: ['octicon', 'octicon-video'] },
|
|
8
8
|
children: [
|
|
9
9
|
{
|
|
10
10
|
type: 'element',
|
|
@@ -16,7 +16,7 @@ export function detailsNode(title?: string): Element {
|
|
|
16
16
|
tagName: 'svg',
|
|
17
17
|
properties: {
|
|
18
18
|
'aria-hidden': true, height: 16, width: 16, viewBox: '0 0 16 16', version: '1.1', 'data-view-component': true,
|
|
19
|
-
className: 'octicon octicon-device-camera-video'
|
|
19
|
+
className: ['octicon', 'octicon-device-camera-video']
|
|
20
20
|
},
|
|
21
21
|
children: [
|
|
22
22
|
{
|
|
@@ -47,7 +47,7 @@ export function detailsNode(title?: string): Element {
|
|
|
47
47
|
type: 'element',
|
|
48
48
|
tagName: 'span',
|
|
49
49
|
properties: {
|
|
50
|
-
className: 'dropdown-caret'
|
|
50
|
+
className: ['dropdown-caret']
|
|
51
51
|
},
|
|
52
52
|
children: []
|
|
53
53
|
}
|