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
+13-11Lines changed: 13 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,7 +54,7 @@ import MyComponentSource from '!!raw-loader!./myComponent';
54
54
Pass the YouTube video ID, not the full URL. The `youtubeID` is part of the regular Youtube video URL - `https://www.youtube.com/watch?v=[youtubeID]`, or the embed video URL - `https://www.youtube.com/embed/[youtubeID]`.
55
55
56
56
## How to highlighting code lines as the video plays
57
-
The plugin allows you to highlight different code lines (and ranges of code lines) as the video plays.
57
+
The plugin allows you to highlight different code lines (and ranges of code lines) at different timestamps.
58
58
59
59
Add the highlight attributes to the code block in **Markdown**:
60
60
@@ -64,15 +64,8 @@ Add the highlight attributes to the code block in **Markdown**:
64
64
console.log(2);
65
65
}
66
66
```
67
-
68
-
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`.
69
-
70
-
The code line highlights are in the format `videoStartTime-videoEndTime=(codeLinesRange)`.
71
-
The start and the end timestamps are in the `H:M:S` format. Hours are optional (`M:S`).
72
-
73
-
> 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.
74
-
75
-
If you are using **MDX/JSX/TSX**[`CodeBlock`](https://docusaurus.io/docs/markdown-features/code-blocks) add the highlight attributes as props:
67
+
68
+
Or if you are using the [`CodeBlock`](https://docusaurus.io/docs/markdown-features/code-blocks) component add the highlight attributes as props:
76
69
77
70
```jsx
78
71
importCodeBlockfrom'@theme/CodeBlock';
@@ -81,11 +74,20 @@ import MyComponentSource from '!!raw-loader!./myComponent';
Both examples 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`.
85
+
86
+
The code line highlights are in the format `videoStartTime-videoEndTime=(codeLinesRange)`.
87
+
The start and the end timestamps are in the `H:M:S` format. Hours are optional (`M:S`).
88
+
89
+
> 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.
90
+
91
+
90
92
## Styling
91
93
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