The following statements support a simple text markup capability which provides the functionality to display bold and italic text, fixed width or proportional fonts and various colours:
Ask
Debug
Prompt
Prompt for Text
Markup is also available in the Prompt Help Button URL named variable when read by the optional help button on all prompt statements. Markup in Comment, Force Grouped, Tooltip and Version statements will be processed when displaying an action's descriptive text.
Note that the markup parsing only occurs in modes of the above statements that direct text to the Action Pending window. If you put markup commands in a Prompt statement displayed as an Alert you will see the markup commands.
The determination to parse a text string for markup commands only occurs at runtime. You activate the parsing by starting the text string with <m>. Markup commands start with <character> sequences and end with </character> sequences. In all cases character is a single character and is case sensitive. Non terminated commands remain in effect until the end of the text. Invalid markup commands are displayed as part of the text.
The context menu of each of the above statement's text fields have a Prompt Statement Markup submenu. Use of this menu may be easier than remembering the various markup sequences. Further, the menu items may be assigned a keyboard shortcut. When a markup sequence is inserted, a <m> sequence will also be inserted if required. Note that while markup sequences do not have to be terminated, the inserted markup sequences are always terminated to allow for the selection of text which is to be processed. As prompt messages can be constructed via the use of named and track variables which can also contain markup sequences, the following statements will provide the menu as well: Set and Set Named Variable. Additionally the muli line display which can be displayed from an Append and Prepend statement will also display the menu. Note that the initial prompt statement's text must start with a <m> sequence. Extra <m> sequences found in a named or track variable are ignored.
Closing markup commands do not have to be in order. When a closing markup sequence is found it looks for the last open sequence of the specified type and if found all open sequences from that point on will be terminated. If the sequence is not matched, the markup text will be included in the display.
The sequence </> will close all open markup sequences and is always valid.
Note that when displaying markup text the default or supplied colour settings in each of the above statements is ignored. All text is initially displayed as the default text control colour. (Black or white depending on Dark Mode).
Typically the initial display font is proportional but will be fixed width if Settings - Actions - Use monospace font for the Action Pending window is set.
Non terminated commands remain active and are restored when a subsequence command is terminated.
The following commands are available:
Markup Command | Description |
---|---|
s | strong (bold) text |
S | non strong (bold) text |
i | italic text |
I | non italic text |
u | underlined text |
U | non underlined text |
x | strikethrough text |
X | non strikethrough text |
f | display text in a fixed width font |
F | display text in a proportional font |
v | display text with a subscript font |
V | display text with a superscript font |
b | blue text |
B | brown text |
g | green text |
o | orange text |
p | purple text |
r | red text |
t | display text in the default control text colour. Typically black when not in dark mode and white in dark mode |
y | display yellow text |
L | Display a link. All text before a semicolon (;) is treated as the link. Text after the semicolon, until the </L> sequence is the text which is displayed for the link. The link is always displayed as underlined blue text. Note that a ; must be present and must precede the </L> sequence or the results are unpredictable. The following forms of the link are parsed.
|
When inserting a markup command from the context menu, holding down the Option key will supress the insertion of the closing sequence.
In the rare case where you have to escape a valid markup sequence replace the < character with &<. Example &<b> will display as <b>. If you want to display &< specify &&<.
You can assign keyboard shortcuts to the sequences.
Example 1:
<m><s><b>bold and blue</b> only bold</s> normal
displays:
bold and blue only bold normal
Explanation:
Example 2:
<m><r>red <g>green</g> back to red
displays:
red green back to red
Explanation:
Example 3:
<m><s><b>bold and blue</s> normal
displays:
bold and blue normal
Explanation: