mirror of
https://github.com/TeachBooks/template.git
synced 2026-11-12 22:25:52 +00:00
Update 008.md
This commit is contained in:
parent
683a8f1bae
commit
32dbabff4d
1 changed files with 6 additions and 50 deletions
|
|
@ -57,65 +57,21 @@ align: center
|
|||
|
||||
## Adding videos
|
||||
|
||||
7. You can also embed videos (e.g., from YouTube) into your book using the [`sphinx-iframes`](https://github.com/TeachBooks/sphinx-iframes) extension. Firstly the extension needs to be installed. If you're working locally, install the module using pip:
|
||||
7. You can also embed videos (e.g., from YouTube) into your book using the [`sphinx-iframes`](https://github.com/TeachBooks/sphinx-iframes) extension, which is already part of the TeachBooks template. Try the example below using the `video` directive with a regular YouTube URL:
|
||||
|
||||
```bash
|
||||
pip install sphinx-iframes
|
||||
```
|
||||
|
||||
8. After installation, add the package in your `requirements.txt` to track the dependency:
|
||||
|
||||
```
|
||||
sphinx-iframes
|
||||
```
|
||||
|
||||
9. Now the extension needs to be enabled. Do this by adding the extension to the list of Sphinx extra extensions in your `_config.yml` file (**important**: underscore, not dash):
|
||||
|
||||
```yaml
|
||||
sphinx:
|
||||
extra_extensions:
|
||||
.
|
||||
.
|
||||
.
|
||||
- sphinx_iframes
|
||||
.
|
||||
.
|
||||
.
|
||||
```
|
||||
|
||||
10. You can also configure several values which can be added to `_config.yml`, such as default video sizes. Add the following:
|
||||
|
||||
```yaml
|
||||
sphinx:
|
||||
config:
|
||||
iframe_blend: true
|
||||
iframe_width: calc(100% - 2.8rem)
|
||||
iframe_aspectratio: auto 2 / 1
|
||||
```
|
||||
|
||||
11. Let's test out this extension! Use the `{video}` directive to embed a video. Here’s an example you can try using a public YouTube video:
|
||||
|
||||
````md
|
||||
```{video} https://www.youtube.com/watch?v=x2eonqw5M6o
|
||||
:width: 80%
|
||||
:height: 400px
|
||||
:class: blend
|
||||
```{video} https://www.youtube.com/watch/B1J6Ou4q8vE
|
||||
```
|
||||
````
|
||||
|
||||
```{tip}
|
||||
The blend class helps the video look good in dark mode!
|
||||
```
|
||||
8. When you're ready, commit your changes to the repository by clicking the green `Commit changes` button.
|
||||
|
||||
12. Try to change the `width`and `height` of the video in the previous example to customise the display.
|
||||
9. Add a commit message.
|
||||
|
||||
13. When you're ready, commit your changes to the repository by clicking the green `Commit changes` button.
|
||||
10. To see your changes, go to {octicon}`play;1em` `Actions` – The most recent workflow run (`overview.md` / your commit message) – Wait for it to finish – In the summary, click on the link under `Branches deployed` and under `Primary book at root`.
|
||||
|
||||
14. Add a commit message.
|
||||
|
||||
15. To see your changes, go to {octicon}`play;1em` `Actions` – The most recent workflow run (`overview.md` / your commit message) – Wait for it to finish – In the summary, click on the link under `Branches deployed` and under `Primary book at root`.
|
||||
|
||||
16. Do you see your change? If you don't see it click `CTRL`+`F5`/`Control`+`F5`to refresh the page.
|
||||
11. Do you see your change? If you don't see it click `CTRL`+`F5`/`Control`+`F5`to refresh the page.
|
||||
|
||||
|
||||
```{admonition} Check your understanding
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue