You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-12Lines changed: 17 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,8 @@
1
1
# Devbook Docusaurus Video Plugin
2
-
The Devbook Docusaurus Video Plugin allows you to [attach a video to a code block](#add-video-to-a-code-snippet) in your docs and [highlight code lines](#add-code-highlights-at-video-timestamps) as the video plays.
2
+
The Devbook Docusaurus Video Plugin allows you to [add a video to a code block](#add-video-to-a-code-snippet) in your docs and [highlight code lines](#highlight-code-lines-as-the-video-plays) as the video plays.
3
+
4
+
## Supported video sources
5
+
- YouTube
3
6
4
7
## Usage
5
8
Install plugin:
@@ -20,6 +23,7 @@ In **Markdown** add `youtubeID` attribute to the code block:
20
23
```js youtubeID=4HGNqFdaD34
21
24
function main() {
22
25
26
+
23
27
}
24
28
```
25
29
@@ -32,32 +36,33 @@ import MyComponentSource from '!!raw-loader!./myComponent';
> You need to pass just the YouTube video ID, not the whole URL. You can get the `youtubeID` from the normal video URL - `https://www.youtube.com/watch?v=[youtubeID]`, or from the embed URL - `https://www.youtube.com/embed/[youtubeID]`.
39
+
> You need to pass just the YouTube video ID, not the whole URL. You can get the `youtubeID` from the regular Youtube video URL - `https://www.youtube.com/watch?v=[youtubeID]`, or from the embed URL - `https://www.youtube.com/embed/[youtubeID]`.
36
40
37
-
### Add code highlights at video timestamps
38
-
The video highlights are in the format `start-end=(range)`.
39
-
The start and the end timestamps are in the `H:M:S` format and the hours are optional (`M:S`).
41
+
### Highlight code lines as the video plays
42
+
The code line highlights are in the format `videoStartTime-videoEndTime=(codeLinesRange)`.
43
+
The start and the end timestamps are in the `H:M:S` format. Hours are optional (`M:S`).
40
44
41
-
In **Markdown** add highlight attributes to the code block:
45
+
Add the highlight attributes to the code block in **Markdown**:
The example above will highlight a code line number `1` from the time `0:10` until `1:00`. Then highlights code lines `1`, `2`, `3`, and `4` from the time `1:10` to the time `1:20`.
55
+
49
56
If you are using **MDX/JSX/TSX**[`CodeBlock`](https://docusaurus.io/docs/markdown-features/code-blocks) add the highlight attributes as props:
> The highlight range format is the same as in the [Docusaurus code blocks](https://docusaurus.io/docs/markdown-features/code-blocks#highlighting-with-metadata-string), just with the `()` parentheses instead of the `{}` parentheses.
59
66
60
-
> You can change the video line highlight style by customizing the `docusaurus-highlight-code-line` class - the same way you would change the [default Docusaurus highlight style](https://docusaurus.io/docs/markdown-features/code-blocks#line-highlighting).
61
-
62
-
## Supported video sources
63
-
- YouTube
67
+
#### Highlight styling
68
+
You can change the code lines' highlight style by customizing the `docusaurus-highlight-code-line` class - the same way you would change the [default Docusaurus highlight style](https://docusaurus.io/docs/markdown-features/code-blocks#line-highlighting).
0 commit comments