Pre-formatted and verbatim text - PGML

From WeBWorK
(Difference between revisions)
Jump to: navigation, search
(Verbatim text)
(Document PGML code block)
 
Line 4: Line 4:
 
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.
 
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,
+
:  This is preformatted,
  :      and can include any text, e.g., <, >, $, etc.,
+
:      and can include any text, e.g., <, >, $, etc.,
  :      but [@ "commands" @] and other *mark up* are performed normally.
+
:      but [@ "commands" @] and other *mark up* are performed normally.
  
 
Pre-formatted sections can be indented.
 
Pre-formatted sections can be indented.
  
  This is flush left.
+
This is flush left.
      Here is some indenting
+
    Here is some indenting
      :  with pre-formatting
+
    :  with pre-formatting
      :  on several lines.
+
    :  on several lines.
      Now back to normal, but indented.
+
    Now back to normal, but indented.
  
 
== Verbatim text ==
 
== Verbatim text ==
Line 20: Line 20:
 
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 <code>[|...|]</code>.
 
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 <code>[|...|]</code>.
  
  If you enter [|*bold*|] in PGML it will be *bold*
+
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.
 
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.
Line 26: Line 26:
 
If you need to include <code>|]</code> within your verbatim section, use ''two'' vertical bars to start and end verbatim mode.
 
If you need to include <code>|]</code> within your verbatim section, use ''two'' vertical bars to start and end verbatim mode.
  
  You can use [|| [|...|] ||] to produce 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.
 
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.
Line 33: Line 33:
  
 
'''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.
 +
 +
== Code ==
 +
 +
If you want multiline verbatim text, as you might want when presenting a block of code, use three backticks to start and end a block of "code". Example:
 +
 +
```
 +
$a = 1;
 +
$b = $a + 1;
 +
```
 +
  
 
See also [[Special Characters - PGML|Escaping Special Characters]] for how to prevent the interpretation of special characters.
 
See also [[Special Characters - PGML|Escaping Special Characters]] for how to prevent the interpretation of special characters.

Latest revision as of 01:30, 6 January 2019

Contents

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.

Code

If you want multiline verbatim text, as you might want when presenting a block of code, use three backticks to start and end a block of "code". Example:

```
$a = 1;
$b = $a + 1;
```


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

follow us