Skip to content

Commit bb64d38

Browse files
committed
captions
1 parent 69143b0 commit bb64d38

File tree

2 files changed

+91
-39
lines changed

2 files changed

+91
-39
lines changed

xmdx/demo/cake.mdx

Lines changed: 90 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,27 @@
88
/>
99

1010
```srt
11-
0.5 –> 6
11+
1.9 –> 6.8
1212
Let's start with this markdown file
1313
I'm assuming we all know markdown
14-
6 –> 15
14+
6.6 –> 12
1515
there's a reason why it's so popular,
16-
the syntax is so clean
17-
15 –> 22.5
16+
it has a very clean syntax
17+
12 –> 17.1
1818
I'm sure I'm not the only one who likes
1919
to move as much content as possible to markdown
20-
22.5 –> 27.5
20+
17.1 –> 20.7
2121
even content that doesn't originally
2222
belong to markdown
23-
27.5 –> 29.9
23+
20.7 –> 23.7
2424
And that's why we have MDX, right?
25-
29.9 –> 36
25+
23.7 –> 31.4
2626
we had to extend the original format
2727
so we could put more things on it
28-
36 –> 39.8
28+
31.4 –> 34
2929
In this talk,
3030
we'll take this to the extreme,
31-
39.8 –> 48
31+
34 –> 39
3232
we'll use MDX for more
3333
unusual content and layouts.
3434
```
@@ -45,11 +45,11 @@ unusual content and layouts.
4545
/>
4646

4747
```srt
48-
0.3 –> 3.9
48+
0.3 –> 3.7
4949
But first I need to show you how this works
50-
3.9 –> 8
50+
3.7 –> 7.9
5151
we are going to start with this small react app
52-
8 –> 16
52+
8 –> 14
5353
this is using Next.js but the same applies to
5454
any app that has the MDX loader
5555
```
@@ -66,6 +66,17 @@ any app that has the MDX loader
6666
tabs={["demo/hello.md", "pages/hello.js"]}
6767
/>
6868

69+
```srt
70+
0.2 -> 3.9
71+
most of the magic comes from this import
72+
3.9 -> 11.5
73+
here the MDX loader transforms the markdown file
74+
into a React component that we can use anywhere
75+
11.5 -> 17
76+
and, you can see, it renders
77+
what you expect here on the right
78+
```
79+
6980
---
7081

7182
<Video src="003.webm" start={0} end={20.03} />
@@ -78,11 +89,15 @@ any app that has the MDX loader
7889
/>
7990

8091
```srt
81-
If we want to change what's rendered, we can use the MDXProvider component.
82-
83-
It has a components prop, that let us override any of the default components.
84-
85-
For example, here we are changing all the h1s, adding a purple border.
92+
0.2 -> 6.5
93+
if we want to change what's rendered,
94+
we can use the MDXProvider component
95+
6.5 -> 13.7
96+
it has a components prop,
97+
that let us override any of the default components
98+
13.7 -> 20
99+
for example, here we are changing all the h1s,
100+
and adding a purple border
86101
```
87102

88103
---
@@ -98,11 +113,18 @@ For example, here we are changing all the h1s, adding a purple border.
98113
/>
99114

100115
```srt
101-
A special component we can override is the Wrapper.
102-
103-
The wrapper is the component that wraps the content. Here we are just adding a border to it.
104-
105-
But the cool thing about this component is that in the children prop, we get all the content from the markdown file as React elements.
116+
1.5 -> 5.1
117+
A special component we can override
118+
is the Wrapper
119+
5.1 -> 16.5
120+
the wrapper is the component that wraps the content,
121+
here we are just adding a border to it
122+
16.5 -> 20.5
123+
but the cool thing about this component
124+
is that in the children prop
125+
20.5 -> 26.3
126+
we get all the content from the markdown file
127+
as React elements
106128
```
107129

108130
---
@@ -118,15 +140,27 @@ But the cool thing about this component is that in the children prop, we get all
118140
/>
119141

120142
```srt
121-
And React elements are just javascript objects.
122-
123-
So here you can see what's inside the children prop.
124-
125-
We are rendering the wrapper children as JSON, and filtering some properties to make it easier to read.
126-
127-
You'll see that it is an array. The first element is an h1, the second a paragraph.
128-
129-
Each element comes with an mdxType, we can, and we will, use that mdxType to extract information about the content or to change the elements.
143+
0.3 -> 3.9
144+
and React elements are just javascript objects
145+
3.9 -> 8.2
146+
so here you can see what's inside the children prop
147+
8.2 -> 11.8
148+
we are rendering the wrapper children as JSON
149+
11.8 -> 16.4
150+
and filtering some properties
151+
to make it easier to read
152+
16.4 -> 20.45
153+
you'll see that it is an array
154+
20.45 -> 24.4
155+
the first element is an h1,
156+
the second a paragraph
157+
24.4 -> 28.5
158+
each element comes with an mdxType,
159+
28.5 -> 34.5
160+
we can, and we will, use that mdxType to
161+
extract information about the content
162+
34.5 -> 36.6
163+
or to change the elements
130164
```
131165

132166
---
@@ -142,13 +176,31 @@ Each element comes with an mdxType, we can, and we will, use that mdxType to ext
142176
/>
143177

144178
```srt
145-
For example, we could get a list of all the H1s from the children, and render it as a table of contents.
146-
147-
This is a simple example, but it illustrates the pattern we are going to use on the rest of the examples.
148-
149-
In all of them, first, we extract some data from the children, and then we render it in a specific way.
150-
151-
Keep in mind that this runs on every render. In most cases, it isn't a performance problem, but if it is, you can move it to a plugin, and run the transformation on build-time.
179+
0 -> 1.5
180+
For example
181+
1.5 -> 5.5
182+
we could get a list of all the H1s
183+
from the children,
184+
5.5 -> 9.5
185+
and render it as a table of contents
186+
9.5 -> 12.7
187+
this is a simple example,
188+
but it illustrates
189+
12.7 -> 17.3
190+
the pattern we are going to use
191+
on the rest of the examples
192+
17.3 -> 21
193+
in all of them, first,
194+
we extract some data from the children,
195+
21 -> 24.7
196+
and then we render it in a specific way
197+
24.7 -> 27.7
198+
keep in mind that this runs on every render
199+
27.7 -> 31.3
200+
in most cases, it isn't a performance problem,
201+
31.3 -> 37.7
202+
but if it is, you can move it to a plugin,
203+
and run the transformation on build-time
152204
```
153205

154206
---

xmdx/src/speaker.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
background: linear-gradient(
6161
to right,
6262
#222 38%,
63-
transparent 75%
63+
transparent 65%
6464
);
6565
color: #ddd;
6666
padding: 32px;

0 commit comments

Comments
 (0)