Skip to content

🎥 Make videos programmatically with React

mention whitespace needs to be at the start of createTikTokStyleCaptions()

Jonny Burgerd4d2780f2956
diff --git a/packages/docs/docs/captions/caption.mdx b/packages/docs/docs/captions/caption.mdx
index 52d382bcb1..af5b325f3d 100644
--- a/packages/docs/docs/captions/caption.mdx
+++ b/packages/docs/docs/captions/caption.mdx
@@ -47,8 +47,9 @@ 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.
+The [`text`](#text) field is whitespace sensitive. You should include spaces in it, ideally before each word.
+
+While rendering, apply the [`white-space: pre`](https://developer.mozilla.org/en-US/docs/Web/CSS/white-space) CSS property to the container of the caption to ensure that the spaces are preserved.
## See also
diff --git a/packages/docs/docs/captions/create-tiktok-style-captions.mdx b/packages/docs/docs/captions/create-tiktok-style-captions.mdx
index 580c21db28..7cb8c6d706 100644
--- a/packages/docs/docs/captions/create-tiktok-style-captions.mdx
+++ b/packages/docs/docs/captions/create-tiktok-style-captions.mdx
@@ -13,6 +13,10 @@ A high value for `combineTokensWithinMilliseconds` will fit many words on 1 page
This function is safe to use in the browser, Node.js and Bun.
+:::note
+This API expects the whitespace to be included in the `text` field **before each word**.
+:::
+
```tsx twoslash title="Create pages from captions"
import {createTikTokStyleCaptions, Caption} from '@remotion/captions';
@@ -120,8 +124,9 @@ A page consists of:
## 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.
+The [`text`](/docs/captions/caption#text) field is whitespace sensitive. You should include spaces in it, ideally before each word.
+
+While rendering, apply the [`white-space: pre`](https://developer.mozilla.org/en-US/docs/Web/CSS/white-space) CSS property to the container of the caption to ensure that the spaces are preserved.
## See also