Difference between revisions of "Pre-formatted and verbatim text - PGML"

From WeBWorK_wiki
Jump to navigation Jump to search
(→‎Verbatim text: document monospace verbatim variant)
Line 30: Line 30:
 
will produce "You can use [|...|] to produce verbatim mode. In fact, you can use as many vertical bars as needed, as long as they are the same number at each end.
 
will produce "You can use [|...|] to produce verbatim mode. In fact, you can use as many vertical bars as needed, as long as they are the same number at each end.
   
If you use an asterisk at the end of the verbatim, as in <code>[|taco|]*</code>, then the text will be printed in monospace font, like <span style="font-family:monospace;">taco</span>.
+
If you use an asterisk at the end of the verbatim, as in <code>[|WeBWorK|]*</code>, then the text will be printed in monospace font, like <span style="font-family:monospace;">WeBWorK</span>.
   
 
'''Note:''' some flavors of Markdown use back-ticks (<code>`</code>) to enter verbatim mode, but PGML isn't one of them.
 
'''Note:''' some flavors of Markdown use back-ticks (<code>`</code>) to enter verbatim mode, but PGML isn't one of them.

Revision as of 01:52, 6 January 2019

Pre-formatted text

Pre-formatted text starts with a colon and three spaces. It will be displayed in a monospaced font, and will respect the line breaks and spacing that you have used. But commands and other markup are still performed within the pre-formatted text as normal.

 :   This is preformatted,
 :       and can include any text, e.g., <, >, $, etc.,
 :       but [@ "commands" @] and other *mark up* are performed normally.

Pre-formatted sections can be indented.

 This is flush left.
     Here is some indenting
     :   with pre-formatting
     :   on several lines.
     Now back to normal, but indented.

Verbatim text

If you want to prevent commands from being performed and show the characters literally, you use verbatim mode. Surround the material that should be displayed verbatim with [|...|].

 If you enter [|*bold*|] in PGML it will be *bold*

would produce "if you enter *bold* in PGML it will be bold". Note that verbatim mode is restricted to one line at a time, it can't enclose a line break.

If you need to include |] within your verbatim section, use two vertical bars to start and end verbatim mode.

 You can use [|| [|...|] ||] to produce verbatim mode.

will produce "You can use [|...|] to produce verbatim mode. In fact, you can use as many vertical bars as needed, as long as they are the same number at each end.

If you use an asterisk at the end of the verbatim, as in [|WeBWorK|]*, then the text will be printed in monospace font, like WeBWorK.

Note: some flavors of Markdown use back-ticks (`) to enter verbatim mode, but PGML isn't one of them.

See also Escaping Special Characters for how to prevent the interpretation of special characters.