Skip to content

Commit 283e36b

Browse files
authored
Update README.md
1 parent a9e1ea4 commit 283e36b

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

README.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ import MyComponentSource from '!!raw-loader!./myComponent';
5454
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]`.
5555

5656
## 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.
5858

5959
Add the highlight attributes to the code block in **Markdown**:
6060

@@ -64,15 +64,8 @@ Add the highlight attributes to the code block in **Markdown**:
6464
console.log(2);
6565
}
6666
```
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:
7669

7770
```jsx
7871
import CodeBlock from '@theme/CodeBlock';
@@ -81,11 +74,20 @@ import MyComponentSource from '!!raw-loader!./myComponent';
8174
<CodeBlock
8275
language="jsx"
8376
youtubeID="4HGNqFdaD34"
84-
{...{ ["0:10-1:00"]: "(1)", ["1:10-1:20"]: "(1,2-4)" }}
77+
"0:10-1:00"="(1)"
78+
"1:10-1:20"="(1,2-4)"
8579
>
8680
{MyComponentSource}
8781
</CodeBlock>
8882
```
8983

84+
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+
9092
## Styling
9193
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

Comments
 (0)