Skip to content

Commit ed9ccb0

Browse files
committed
wip: better
1 parent c4de615 commit ed9ccb0

File tree

5 files changed

+96
-19
lines changed

5 files changed

+96
-19
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Prompter Text Formatting
2+
3+
The Sofie Prompter supports formatted text using simple inline markers. This formatting is displayed both in the prompter view and in hover previews throughout the Sofie UI.
4+
5+
Providing formatted text is optional, Sofie will use the un-formatted version when only that is provided.
6+
7+
## Emphasis and Strong
8+
9+
Wrap text to add emphasis or bold:
10+
11+
- `*italic*` or `_italic_`_italic_
12+
- `**bold**` or `__bold__`**bold**
13+
14+
```
15+
This is *emphasized text* and this is **strong text**.
16+
```
17+
18+
## Invert Color
19+
20+
Invert the text colour (swap foreground/background):
21+
22+
```
23+
Show ~reversed~ for emphasis.
24+
```
25+
26+
## Hidden Text
27+
28+
Hide text from display using `|` or `$` — useful for notes or off-script remarks:
29+
30+
```
31+
Begin the speech |remember to smile| then continue.
32+
```
33+
34+
## Underline
35+
36+
Use double markers `||` or `$$` to underline text:
37+
38+
```
39+
This word is ||underlined|| for emphasis.
40+
```
41+
42+
## Colour
43+
44+
Apply colour using `[colour=#hex]...[/colour]`:
45+
46+
```
47+
[colour=#ffff00]This text appears in yellow[/colour]
48+
[colour=#ff0000]This text appears in red[/colour]
49+
```
50+
51+
## Screen Marker
52+
53+
Insert a screen marker for teleprompter control using `(X)`:
54+
55+
```
56+
Begin speech (X) pause here, then continue.
57+
```
58+
59+
## Escaping
60+
61+
Prefix any special character with `\` to display it literally:
62+
63+
```
64+
This is \*not italic\* and this is \~not reversed\~.
65+
```
66+
67+
## Full Example
68+
69+
```
70+
Good morning, *everyone*.
71+
|Don't forget the greeting| Welcome to the ||annual conference||.
72+
[colour=#ffff00]Please note[/colour] the schedule has changed. (X)
73+
For questions, contact us at example\@email.com.
74+
```

packages/webui/src/client/styles/prompter.scss

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,17 @@ body.prompter-scrollbar {
313313
}
314314

315315
.script-text-formatted {
316+
--background-color: #000;
317+
--foreground-color: #fff;
318+
--header-color: #999;
319+
320+
color: var(--foreground-color);
321+
background: var(--background-color);
322+
323+
* {
324+
color: var(--foreground-color);
325+
}
326+
316327
p {
317328
margin: 0;
318329
padding: 0;
@@ -368,20 +379,6 @@ body.prompter-scrollbar {
368379
height: 100vh;
369380
}
370381

371-
.ProseMirror {
372-
outline: none;
373-
}
374-
375-
span.colour.red {
376-
color: red;
377-
}
378-
span.colour.yellow {
379-
color: yellow;
380-
}
381-
rev span.colour.yellow,
382-
span.colour.yellow rev {
383-
color: rgb(113, 0, 237);
384-
}
385382
span.screen-marker {
386383
margin: 10px;
387384
}

packages/webui/src/client/ui/Prompter/Formatted/MdDisplay.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,15 @@ function MdNode({ content }: { content: Node }): React.ReactNode {
2727
case 'underline':
2828
return React.createElement('u', {}, renderChildren(content))
2929
case 'colour':
30-
return React.createElement('span', { className: 'colour ' + content.colour }, renderChildren(content))
30+
return React.createElement(
31+
'span',
32+
{
33+
style: {
34+
'--foreground-color': content.colour,
35+
},
36+
},
37+
renderChildren(content)
38+
)
3139
case 'text':
3240
return content.value
3341
case 'hidden':

packages/webui/src/client/ui/Prompter/Formatted/mdParser/astNodes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export interface ReverseNode extends ParentNodeBase {
4747
export interface ColourNode extends ParentNodeBase {
4848
type: 'colour'
4949
code: string
50-
colour: 'red' | 'yellow'
50+
colour: string
5151
}
5252

5353
export interface BackScreenMarkerNode extends NodeBase {

packages/webui/src/client/ui/Prompter/Formatted/mdParser/constructs/colour.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,11 @@ export function colour(): NodeConstruct {
3737

3838
state.flushBuffer()
3939

40-
const colour = rest.includes('#ffff00') ? 'yellow' : 'red'
41-
4240
const colourNode: ColourNode = {
4341
type: 'colour',
4442
children: [],
4543
code: char,
46-
colour: colour,
44+
colour: rest.slice(7, 14),
4745
}
4846
state.pushNode(colourNode)
4947

0 commit comments

Comments
 (0)