Skip to content

🎥 Make videos programmatically with React

Captions Docs: Whitespace sensitivity

Jonny Burgerdccdf5cad97b
diff --git a/packages/docs/docs/captions/caption.mdx b/packages/docs/docs/captions/caption.mdx
index 008870688d..3bbaedeb39 100644
--- a/packages/docs/docs/captions/caption.mdx
+++ b/packages/docs/docs/captions/caption.mdx
@@ -44,6 +44,11 @@ Otherwise, it is not defined, but may be the average of the start and end timest
A number between 0 and 1 that indicates how confident the transcription is.
+## Whitespace sensitivity
+
+The `text` field is white-space sensitive. You should include spaces in it, as none are added automatically.
+While rendering, apply the `white-space: pre` CSS property to the container of the caption to ensure that the spaces are preserved.
+
## See also
- [Source code for this type](https://github.com/remotion-dev/remotion/blob/main/packages/captions/src/caption.ts)
diff --git a/packages/docs/docs/captions/create-tiktok-style-captions.mdx b/packages/docs/docs/captions/create-tiktok-style-captions.mdx
index 75f41fa7b2..f49ebcced1 100644
--- a/packages/docs/docs/captions/create-tiktok-style-captions.mdx
+++ b/packages/docs/docs/captions/create-tiktok-style-captions.mdx
@@ -115,6 +115,11 @@ A page consists of:
- `fromMs`: The absolute start time of the token in milliseconds.
- `toMs`: The absolute end time of the token in milliseconds.
+## Whitespace sensitivity
+
+The `text` field is white-space sensitive. You should include spaces in it, as none are added automatically.
+While rendering, apply the `white-space: pre` CSS property to the container of the caption to ensure that the spaces are preserved.
+
## See also
- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/captions/src/create-tiktok-style-captions.ts)