diff --git a/src/video/components/actions/CaptionRendererAction.tsx b/src/video/components/actions/CaptionRendererAction.tsx index 4fed3369..6abc18c9 100644 --- a/src/video/components/actions/CaptionRendererAction.tsx +++ b/src/video/components/actions/CaptionRendererAction.tsx @@ -10,23 +10,32 @@ import { useSource } from "../../state/logic/source"; function CaptionCue({ text }: { text?: string }) { const { captionSettings } = useSettings(); + const textWithNewlines = (text || "").replaceAll(/\r?\n/g, "
"); + + // https://www.w3.org/TR/webvtt1/#dom-construction-rules + // added a
for newlines + const html = sanitize(textWithNewlines, { + ALLOWED_TAGS: ["c", "b", "i", "u", "span", "ruby", "rt", "br"], + ADD_TAGS: ["v", "lang"], + ALLOWED_ATTR: ["title", "lang"], + }); + return ( - + > + +

); }